with LilyPond and view the output. Details of this procedure may vary
from system to system. To create the output, one would issue the
command `@code{ly2dvi menuet}'. @file{ly2dvi} is a program that does
-the job of running LilyPond and TeX, handling of titles and
+the job of running LilyPond and @TeX{}, handling of titles and
adjusting of page margins.
If all goes well, the file @file{menuet.dvi} will be created.
point@footnote{A point is the standard measure of length for
printing. One point is 1/72.27 inch.} high staff. We want smaller
output (16 point staff height), so we must import the settings for
-that size, which is done.@example
+that size, which is done.
+@example
\score @{
note. If you add a high-quote an extra octave is added. The lowered
quote (a comma) will subtract an extra octave. Because the first note
has no predecessor, you have to give the (absolute) pitch of the note
-to start with.@example
+to start with.
+@example
\sequential @{
@end example
What follows is sequential music, i.e.,
-notes that are to be played and printed after each other.@example
+notes that are to be played and printed after each other.
+@example
\time 3/4;
@end example
This command changes the time signature of the current piece: a 3/4
sign is printed. This command is also used to generate bar lines in
-the right spots.@example
+the right spots.
+@example
\key g;
@end example
- This command changes the current key to G-major. Although this
+ This command changes the current key to G-major. Although this
command comes after the @code{\time} command, in the output, the key
signature comes before the time signature: LilyPond knows about music
-typesetting conventions. @example
+typesetting conventions.
+@example
\repeat "volta" 2
@end example
The subject of the repeat is again sequential music. Since
@code{\sequential} is such a common construct, a shorthand is provided:
-just leave off @code{\sequential}, and the result is the same. @example
+just leave off @code{\sequential}, and the result is the same.
+@example
d4
This is a note with pitch @code{d} (determined up to octaves). The
relative music was started with a @code{c''}, so the real pitch of this
note is @code{d''}. The @code{4} designates the duration of the note
-(it is a quarter note). @example
+(it is a quarter note).
+@example
a b
@end example
These are notes with pitch @code{a} and @code{b}. Because their
duration is the same as the @code{g}, there is no need to enter the
-duration (You may enter it anyway, eg. @code{a4 b4}) @example
+duration (You may enter it anyway, e.g. @code{a4 b4})
+@example
d4 g, g |
the beginning and ending note of the slur is marked with an opening and
closing parenthesis respectively. In the line shown above this is
done for two slurs. Slur markers (parentheses) are between
-the notes.@example
+the notes.
+@example
a4 [b8 a] [g fis]
@end example
Automatic beaming can be overridden by inserting beam marks
-(brackets). Brackets are put around notes you want beamed.@example
+(brackets). Brackets are put around notes you want beamed.
+@example
g2. |
@end example
A duration with augmentation dot is notated
-with the duration number followed by a period.@example
+with the duration number followed by a period.
+@example
@}
@end example
This ends the sequential music to be repeated. LilyPond will typeset
-a repeat bar. @example
+a repeat bar.
+@example
cis'4 b8 cis a4 |
@end example
This line shows that Lily will print an accidental if that is
needed: the first C sharp will be printed with an accidental, the
-second one without. @example
+second one without.
+@example
a8-. b-. cis-. d-. e-. fis-.
You can enter articulation signs either in a verbose form using a
shorthand. Here we demonstrate the shorthand: it is formed by a dash
and the the character for the articulation to use, e.g. `@code{-.}' for
-staccato as shown above. @example
+staccato as shown above.
+@example
fis a, r8 cis8
command `@code{\fermata}' is not part of the core of the language (most
of the other discussed elements are), but it is a shorthand for a more
complicated description of a fermata. @code{\fermata} names that
-description and is therefore called an @emph{identifier}. @example
+description and is therefore called an @emph{identifier}.
+@example
@}
}
@end mudela
-Again, we will dissect the file line by line.@example
+Again, we will dissect the file line by line.
+@example
\header @{
equal sign `@code{=}'. After the equal sign comes the expression you
want to store. In this case, you want to put in strings. The
information has to be quoted here, because it contains spaces. The
-assignment is finished with a semicolon.@example
+assignment is finished with a semicolon.
+@example
\include "paper16.ly"
@end example
-Smaller size for inclusion in a book.@example
+Smaller size for inclusion in a book.
+@example
melody = \notes \relative c' @{
@end example
The key is C minor: we have three flats.
-
@example
c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
\bar "|.";
@end example
+
We use explicit beaming. Since this is a song, we will turn automatic
-beams off, and use explicit beaming where needed.@example
+beams off, and use explicit beaming where needed.
+@example
@}
@end example
This ends the definition of @code{melody}. Note that there are no
-semicolons after assignments at top level.@example
+semicolons after assignments at top level.
+@example
text = \lyrics @{
Lyrics are formed by syllables that have duration, and not by
notes. To make LilyPond parse words as syllables, switch it into
lyrics mode with @code{\lyrics}. Again, the brace after @code{\lyrics}
-is a shorthand for @code{\sequential @{}. @example
+is a shorthand for @code{\sequential @{}.
+@example
- The4 ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
- ri- ver is flo- __ wing down to the sea.
- @}
+ The4 ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
+ ri- ver is flo- __ wing down to the sea.
+@}
@end example
The syllables themselves are separated by spaces. You can get syllable
r8
@end example
-There is no accompaniment during the anacrusis.@example
+There is no accompaniment during the anacrusis.
+@example
c2:3- f:3-.7
triad, while a minor triad is wanted. @code{3-} modifies the third to
be small. @code{7} modifies (adds) a seventh, which is small by default
to create the @code{f a c es} chord. Multiple modifiers must be
-separated by a dot.@example
+separated by a dot.
+@example
d:min es4 c8:min r8
@end example
Some modifiers have predefined names, eg. @code{min} is the same as
-@code{3-}, so @code{d-min} is a minor @code{d} chord.@example
+@code{3-}, so @code{d-min} is a minor @code{d} chord.
+@example
c2:min f:min7 g:7^3.5 c:min @}
to be separated by a dot. Tones from a chord are removed with chord
subtractions. Subtractions are started with a caret, and they are
also separated by dots. In this example, @code{g:7^3.5} produces a
-minor seventh. The brace ends the sequential music. @example
+minor seventh. The brace ends the sequential music.
+@example
\score @{
\simultaneous @{
@end example
We assemble the music in the @code{\score} block. Melody, lyrics and
accompaniment have to sound at the same time, so they should be
-@code{\simultaneous}.@example
+@code{\simultaneous}.
+@example
%\accompaniment
Chord mode generates notes grouped in @code{\simultaneous} music. If
you remove the comment sign, you can see the chords in normal
notation: they will be printed as note heads on a separate
-staff. @example
+staff.
+@example
\context ChordNames \accompaniment
The name is a string, it can be quoted with double quotes). The
second argument is the music that should be interpreted in this
context. For the previous line, we could have written @code{\context
-Staff \accompaniment}, and get the same effect.@example
+Staff \accompaniment}, and get the same effect.
+@example
\addlyrics
aligns the syllables of the second piece under the notes of the
first piece. If you would reverse the order, the notes would be
aligned on the lyrics, which is not very useful. (Besides, it looks
-silly.)@example
+silly.)
+@example
\context Staff = mel @{
before the ``note heads'' version of the accompaniment, the
accompaniment will be on a nameless staff. The melody has to be on a
different staff as the accompaniment. This is accomplished by giving
-the melody staff a different name.@example
+the melody staff a different name.
+@example
\property Staff.noAutoBeaming = "1"
An interpretation context has variables that tune its behaviour. One
of the variables is @code{noAutoBeaming}. If set and non-zero (i.e.,
true) LilyPond will not try to put automatic beaming on the current
-staff.@example
+staff.
+@example
\property Staff.automaticMelismata = "1"
@end example
Similarly, we don't want to print a syllable when there is
a slur. This sets up the Staff context to signal slurs while
-@code{\addlyrics} is processed. @example
+@code{\addlyrics} is processed.
+@example
\melody
@}
Finally, we put the melody on the current staff. Note that the
@code{\property} directives and @code{\melody} are grouped in sequential
music, so the property settings are done before the melody is
-processed. @example
+processed.
+@example
\context Lyrics \text
The second argument of @code{\addlyrics} is the text. The text also
should not land on a Staff, but on a interpretation context for
syllables, extenders, hyphens etc. This context is called
-Lyrics.@example
+Lyrics.
+@example
@}
@end example
-This ends @code{\simultaneous}.@example
+This ends @code{\simultaneous}.
+@example
\midi @{ @}
checking music you enter. You listen to the MIDI file: if you hear
something unexpected, it's probably a typing error. @code{\midi} is an
`output definition', a declaration that specifies how to output music
-analogous to @code{\paper @{ @}}.@example
+analogous to @code{\paper @{ @}}.
+@example
\paper @{ linewidth = 10.0\cm; @}
@end example
We also want notation output. The linewidth is short so the piece
-will be set in two lines. @example
+will be set in two lines.
+@example
@}
If it looks like incomprehensible gibberish to you@dots{} Then you are
right. The author has doctored this example to have as many quirks in
-one system as possible.@example
+one system as possible.
+@example
viola = \notes \relative c' \context Voice = viola @{
@end example
In this example, you can see multiple parts on a staff. Each part is
@code{Voice}. For each part we have to make sure that there is
precisely one Voice context@footnote{If @code{\context} would not
have been specified explicitly, three @code{Voice} contexts would be
-created: one for each note in the first chord.}.@example
+created: one for each note in the first chord.}.
+@example
<c4-\f g' c>
@end example
@code{<} and @code{>} are short hands for @code{\simultaneous @{} and
@code{@}}. So the expression enclosed in @code{<} and @code{>} is a
-chord. @code{\f} places a forte symbol under the chord.@example
+chord. @code{\f} places a forte symbol under the chord.
+@example
\property Voice.verticalDirection = \down
@end example
@code{verticalDirection} is a property of the voice context. It
symbols.
If @code{verticalDirection} is set to @code{\down}
(identifier for the integer -1) the stems go down,
-@code{\up} (identifier for the integer 1) makes the stems go up.@example
+@code{\up} (identifier for the integer 1) makes the stems go up.
+@example
g'8. b,16
@end example
Relative octaves work a little differently with chords. The starting
s1 s2. r4
@end example
@code{s} is a `spacer' rest. It does not print anything, but it does
-have the duration of a rest. @example
+have the duration of a rest.
+@example
oboes = \notes \relative c'' \context Voice = oboe @{
@end example
Now comes a part for two oboes. They play homophonically, so we
print the notes as one voice that makes chords. Again, we insure that
these notes are indeed processed by precisely one context with
-@code{\context}.@example
+@code{\context}.
+@example
\stemup s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>
@end example
@code{\stemup} is an identifier reference. It is shorthand for
arguments: a fraction and a piece of music. The duration of the
second argument is multiplied by the first argument. Triplets make
notes occupy 2/3 of their notated duration, so in this case the
-fraction is 2/3. @example
+fraction is 2/3.
+@example
@{ <d8 \< f> <e g> <f a> @}
@end example
The piece of music to be `tripletted' is sequential music containing
three notes. On the first chord (the @code{d}), a crescendo is started
-with @code{\<}.@example
+with @code{\<}.
+@example
<
@end example
At this point, the homophonic music splits into two rhythmically
different parts. We can't use a sequence of chords to enter this, so
we make a `chord' of sequences to do it. We start with the upper
-voice, which continues with upward stems: @example
+voice, which continues with upward stems:
+@example
@{ \times 2/3 @{ a8 g c @} \! c2 @}
@end example
The crescendo is ended at the half note by the escaped exclamation
-mark `@code{\!}'. @example
+mark `@code{\!}'.
+@example
\context Voice = oboeTwo @{
\stemdown
@end example
We can't share stems with the other voice, so we have to create a new
@code{Voice} context. We give it the name @code{oboeTwo} to distinguish
-it from the other context. Stems go down in this voice. @example
+it from the other context. Stems go down in this voice.
+@example
\grace @{
@end example
When a grace section is processed, a @code{Grace} context is
created. This context acts like a miniature score of its own. It has
its own time bookkeeping, and you can make notes, beams, slurs
etc. Here fiddle with a property and make a beam. The argument of
-@code{\grace} is sequential music.@example
+@code{\grace} is sequential music.
+@example
\property Grace.verticalDirection = \down
[f,16 g] @}
@end example
f8 e e2
@} >
@end example
-This ends the two-part section. @example
+This ends the two-part section.
+@example
\stemboth
\grace <c,8( e> <)b8. d8.-\trill> <c16 e> |
@end example
positioned as if it were single part music.
The bass has a little hoom-pah melody to demonstrate parts switching
-between staffs. Since it is repetitive, we use identifiers:@example
+between staffs. Since it is repetitive, we use identifiers:
+@example
hoomPah = \notes \transpose c' @{
@end example
Transposing can be done with @code{\transpose}. It takes two
without having to worry about getting the motive in a wrong
octave@footnote{@code{hoomPah = \relative @dots{}} would be more
intuitive to use, but that would not let me plug @code{\transpose}
-:-).}.@example
+:-).}.
+@example
c8 \translator Staff = top \stemdown
@end example
We assume that the first note will be put in the lower staff. After
precise, this @code{\translator} entry switches the current voice to a
@code{Staff} named @code{top}. So we have to name the upper staff
`@code{top}'. Stem directions are set to avoid interfering with the
-oboe voices. @example
+oboe voices.
+@example
c'8 \translator Staff = bottom \stemup @}
@end example
Then a note is put on the upper staff, and we switch again. We have
-to name the lower staff `@code{bottom}'. @example
+to name the lower staff `@code{bottom}'.
+@example
hoomPahHoomPah = @{ [\hoomPah \hoomPah] @}
@end example
Put two of these fragments in sequence, and beam them.@example
\hoomPahHoomPah
@end example
Entering the bass part is easy: the hoomPahHoomPah variable is
-referenced four times.@example
+referenced four times.
+@example
\context Voice = reallyLow @{\stemdown g2 ~ | g4 c8 @} >
@end example
-After skipping some lines, we see @code{~}. This mark makes ties.@example
+After skipping some lines, we see @code{~}. This mark makes ties.
+@example
\context PianoStaff
@end example
For piano music, a special context is needed to get cross staff
-beaming right. It is called @code{PianoStaff}.@example
+beaming right. It is called @code{PianoStaff}.
+@example
\context Staff = bottom < \time 2/2; \clef bass;
@end example
-The bottom staff must have a different clef.@example
+The bottom staff must have a different clef.
+@example
indent = 0.0;
@end example
To make some more room on the line, the first (in this case the only)