Lily Pond

LilyPond is a music typesetter, part of the GNU project, written by HanWenNienhuys

You can find Lily at http://www.lilypond.org


''can you explain the difference between this and to MusicTeX or MusixTeX''?

MusicTeX or MusixTeX are macro packages that run on top of TeX. They're rather arcane, probably because TeX is not well suited to 2D typesetting: musixtex is a 3-pass system (that involves a separate program for breaking lines). Typical musi?tex input looks like line noise.

If you know Mus?tex well already, and especially if you need to have extremely fine control over the output, musi?tex may just suit you fine.

LilyPond is a stand-alone program, that also supports direct output to PostScript (although the TeX output mode is usually more convenient). The input format is much more high-level. This means that learning and using LilyPond is easier; for example, this is the start of twinkle twinkle little star

\relative { 
\time 2/4;
c4 c | g' g | a a | g2 | f4 f | e e | d d | c2 }
}

Both lily and Musi?TeX are highly tweakable, but LilyPond uses a much more elegant mechanism: the backend is built around GuileScheme. You can override formatting details by commands that add SchemeLanguage expressions to objects in the back end; these commands are actually readable. For example, vertically translating a rest downwards is done by

\once \override Rest #'staff-position = #-8
r8% 8th rest

The hash sign signifies that what follows should be interpreted as a single Scheme expression.

\override Rest #'staff-position = #(lambda (x) (= 1 x) 0 -1)

would also be valid input, although it would generate a warning, since the staff-position for Rest should have a number value.

The above shows part of the Yacc special purpose music language. However, this language is a just a layer of syntactic sugar over Scheme data structures. The same might have been entered as

  #(make-grob-property-override 'Rest 'staff-position -8)

Moreover, it is possible to mix Scheme and lilypond constructs almost seamlessly.


One thing that you should realize, is that music and music scores are two entirely different things. Music is an abstract combination of pitches, durations, articulations, etc, and a musical score is a 2D configuration of lines, font glyphs and other graphic symbols.

LilyPond is a program that parses a rather abstract music definition (think pitch and duration), then transforms it into a 2D layout problem, and solves that layout problem. Most music-typesetting programs don't make this distinction between layout and meaning. IMO, that makes those programs broken by design.

\property sets a property of that transformation-to-layout at a certain point in musical time. In this case, a cons '(staff-position . -8) is pushed onto the layout description of the rest; all Rest objects created from that point on within that Voice are translated downwards.

You can also set properties that are not used directly in the formatting process, such as location within the measure, or the current bar number, eg.

\property Score.currentBarNumber = #21


I don't know the exact Musi?TeX equivalent, but Musictex commands usually involve a magical concatenations that look like

\zqxxxf

Lily also includes a music font that looks nicer, IMHO.


A 3rd party comparison of Musi?Tex and LilyPond is at http://www.gmd.de/Mail/mutex-archive/3264.html


DenemoEditor is a graphical frontend to LilyPond.


EditText of this page (last edited December 23, 2005) or FindPage with title or text search