com.softsynth.jmsl.score.util
Class LilyPondWriter

java.lang.Object
  extended by com.softsynth.jmsl.score.util.LilyPondWriter

public class LilyPondWriter
extends java.lang.Object

LilyPond is a common music notation interpreter that generates postscript and pdf files from text-based input (visit www.lilypond.org).

LilyPondWriter exports a JMSL Score to LilyPond 2.10.0 format. Each staff of the JMSL Score is written to its own .ly file, then combined in a full ensemble score by a master .ly file. (According to LilyPond docs, this is the recommended method for creating a full ensemble score, so parts can be transposed and printed separately). So if your LilyPond filename is MyScore.ly, then LilyPondWriter will generate MyScoreStaffAA.ly, MyScoreStaffAB.ly, MyScoreStaffAC.ly, etc, one for each staff. MyScore.ly will contain the commands that combine these staff files into a full ensemble score. Double click MyScore.ly to generate a PDF (see LilyPond docs for updates, changes, and variations).

Usage:

 File lilyPondFile = new File("MyScore.ly");
 try {
     LilyPondWriter lilyPondWriter = new LilyPondWriter(score, lilyPondFile);
     lilyPondWriter.write();
     if (lilyPondWriter.durationErrorsInScore()) {
         System.err.println(lilyPondWriter.getDurationErrorReport());
     }
 } catch (IOException e) {
 }
 

Author:
Nick Didkovsky, didkovn@mail.rockefeller.edu

Field Summary
static java.lang.String LY_VERSION
          LilyPond version 2.10.0
 
Constructor Summary
LilyPondWriter(Score score, java.io.File file)
          Write JMSL score to LilyPond file
 
Method Summary
 boolean durationErrorsInScore()
          It is important that the input Score has correct total durations in each staff of each measure.

This is because LilyPond lays out its own barlines, so if you have 5 quarter notes in a measure of 4/4, for example, LilyPond will put the barline after the 4th note.
 java.lang.String getDurationErrorReport()
          It is important that the input Score has correct total durations in each staff of each measure.

This duration error report is generated by com.softsynth.jmsl.score.operators.DurationReporter on the Score that this LilyPondWriter is converting.
static void main(java.lang.String[] args)
          Create a JMSL Score with a variety of musical test cases and write to LilyPond format
 void write()
          Export Score in LilyPond format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LY_VERSION

public static final java.lang.String LY_VERSION
LilyPond version 2.10.0

See Also:
Constant Field Values
Constructor Detail

LilyPondWriter

public LilyPondWriter(Score score,
                      java.io.File file)
               throws java.io.IOException
Write JMSL score to LilyPond file

Throws:
java.io.IOException
Method Detail

write

public void write()
           throws java.io.IOException
Export Score in LilyPond format. Writes one file per staff plus a file that combines all staves into a full ensemble score.

Throws:
java.io.IOException

durationErrorsInScore

public boolean durationErrorsInScore()
It is important that the input Score has correct total durations in each staff of each measure.

This is because LilyPond lays out its own barlines, so if you have 5 quarter notes in a measure of 4/4, for example, LilyPond will put the barline after the 4th note. If you have too few durations, you will see barlines after the next measure's contents.

Returns:
true if some measures in JMSL Score contain total durations that are higher or lower than what is expected by time signature. false if your input score is OK
See Also:
getDurationErrorReport()

getDurationErrorReport

public java.lang.String getDurationErrorReport()
It is important that the input Score has correct total durations in each staff of each measure.

This duration error report is generated by com.softsynth.jmsl.score.operators.DurationReporter on the Score that this LilyPondWriter is converting.

Returns:
report of which measures and which staves in JMSL Score contained too few or too many durations. Measure 1 is first measure. Staff 1 is top staff.

main

public static void main(java.lang.String[] args)
Create a JMSL Score with a variety of musical test cases and write to LilyPond format