mudela(verbatim)(% lines preceded by a percent are comments.
\include "paper16.ly"
\score {
- \notes
- \relative c'' {
+ \notes
+ \relative c'' {
\key g;
- \time 3/4;
+ \time 3/4;
\repeat "volta" 2 {
d4 g,8 a b c d4 g, g |
music. The music is combined with the output directions by putting
them into a code(\score) block.
verb(
- \notes
+ \notes
) COMMENT(
)This makes LilyPond ready for accepting notes.
mode, octaves of notes without quotes are chosen such that a note is
as close as possible (graphically, on the staff) to the the preceding
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
+quote (a comma) will substract an extra octave. Because the first note
has no predecessor, you have to give the (absolute) pitch of the note
to start with.COMMENT(
sect(Lyrics and chords)
-In this section we show how to typeset a song of (unknown
-origin)footnote(The author would welcome information about the origin
+In this section we show how to typeset a song of unknown
+origin.footnote(The author would welcome information about the origin
of this song.).
verb(\header {
title = "The river is flowing";
- composer = "Traditonal (?)";
+ composer = "Traditional (?)";
}
\include "paper16.ly"
melody = \notes \relative c' {
\context ChordNames \accompaniment
\addlyrics
- \context Staff = mel {
+ \context Staff = mel {
\property Staff.noAutoBeaming = "1"
- \property Staff.automaticMelismas = "1"
+ \property Staff.automaticMelismata = "1"
\melody
}
\context Lyrics \text
})
-The result would look bind(this)footnote(The titling and font size shown
+The result would look nop(this)footnote(The titling and font size shown
may differ, since the titling in this document is not generated by
file(ly2dvi).).
center(bf(Large(The river is flowing))
-var(Traditonal (?))
+var(Traditional (?))
)
mudela(center)(\header {
title = "The river is flowing";
- composer = "Traditonal (?)";
+ composer = "Traditional (?)";
}
\include "paper16.ly"
melody = \notes \relative c' {
\addlyrics
\context Staff = mel {
- \property Staff.noAutoBeaming = "1"
- \property Staff.automaticMelismas = "1"
+ \property Staff.noAutoBeaming = "1"
+ \property Staff.automaticMelismata = "1"
\melody
}
\context Lyrics \text
information to print titles above the music.
verb(
title = "The river is flowing";
- composer = "Traditonal (?)";)COMMENT(
+ composer = "Traditional (?)";)COMMENT(
-)the code(\header) contains block assignments. An assignment starts
+)the code(\header) block contains assignments. An assignment starts
with a string. (which is unquoted, in this case). Then comes the
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 have to be quoted, because they contain spaces. The
+information has to be quoted here, because it contains spaces. The
assignment is finished with a semicolon.COMMENT(
)verb(
\bar "|.";
)COMMENT(
-)We use explicit beaming. Since this is a song, we turn automatic
+)We use explicit beaming. Since this is a song, we will turn automatic
beams off, and use explicit beaming where needed.COMMENT(
)verb(
)COMMENT(
)This ends the definition of code(melody). Note that there are no
-semicolons after declarations at top level.COMMENT(
+semicolons after assignments at top level.COMMENT(
)verb(
text = \lyrics {
}
)COMMENT(
-)The syllables themselves, separated by spaces. You can get syllable
+)The syllables themselves are separated by spaces. You can get syllable
extenders by entering `code(__)', and centered hyphens with
-`code(--)'. We enter the syllables as if they are all quarter notes
+`code(-)code(-)'. We enter the syllables as if they are all quarter notes
in length (hence the code(4)), and use a feature to align the
-syllables to the music, which obviously isn't all quarter notes.
+syllables to the music (which obviously isn't all quarter notes.)
COMMENT(
)verb(
)verb(
c2-3- f-3-.7
-)A chords is started by a note that is the tonic of the chord. The
+)A chord is started by the tonic of the chord. The
first one lasts a half note. An unadorned note creates a major
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
)A named modifier code(min) and a normal modifier code(7) do not have
to be separated by a dot. Tones from a chord are removed with chord
-subtractions. Subtractions are started with a caret, and they are
+substractions. Substractions 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. COMMENT(
)Chord mode generates notes grouped in code(\simultaneous) music. If
you remove the comment sign, you can see the chords in normal
-notation. The chords will then be printed as chords of note heads on
-a separate staff. COMMENT(
+notation: they will be printed as note heads on a separate
+staff. COMMENT(
)verb(
\context ChordNames \accompaniment
)Normally, the notes that you enter are transformed into note heads.
The note heads alone make no sense, they need surrounding information:
-a key signature, a clef, staff lines, etc. They need em(context).
-This context also is a thing that has to be created. This is done by
-code(\context). It takes two arguments. The first is the name of a
-em(notation) or em(interpration context). The name is a string, it
-can be quoted with code(") quotes). The second argument is the music
-that should be interpreted in this context.
+a key signature, a clef, staff lines, etc. They need em(context). In
+LilyPond, these symbols are created by objects called `interpretation
+context'. Interpretation contexts only exist during a run of
+LilyPond. Interpretation contexts that are for printing music (as
+opposed to playing music) are called `notation context'.
+
+By default, LilyPond will create a Staff contexts for you. If you
+would remove the code(%) sign in the previous line, you can see that
+mechanism in action.
+
-By default, LilyPond will create a Staff context for you. If you
-would remove the code(%) sign in the previous line, you see that
-mechanism in action. For the previous line, we could have written
-code(\context Staff \accompaniment), and get the same effect.COMMENT(
+We don't want default contexts here, because we want names, not note
+heads. An interpretation context can also created upon explicit
+request. The keyword for such a request is code(\context). It takes
+two arguments. The first is the name of a interpretation context.
+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.COMMENT(
)verb(
\addlyrics
)The lyrics need to be aligned with the melody. This is done by
combining both with code(\addlyrics). code(\addlyrics) takes two
pieces of music (usually a melody and lyrics, in that order) and
-aligns the lyrics syllables of the second piece under the notes of the
+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.)COMMENT(
\context Staff = mel {
)COMMENT(
-)This is first piece of music. We instantiate a code(Staff) context
-explicitly: should you chose to remove comment before the ``note
-heads'' version of the accompaniment, the accompaniment will be on a
-nameless staff. In that case, the melody has to be on a different
-staff as the accompaniment. This is accomplished by giving the melody
-staff a different name.COMMENT(
+)This is the argument of code(\addlyrics). We instantiate a
+code(Staff) context explicitly: should you chose to remove comment
+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.COMMENT(
)verb(
\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 automatic beaming on the current
+true) LilyPond will not try to put automatic beaming on the current
staff.COMMENT(
)verb(
- \property Staff.automaticMelismas = "1"
+ \property Staff.automaticMelismata = "1"
)COMMENT(
-)Similarly, we want do not want to put a lyric syllable when there is
+)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. COMMENT(
}
)COMMENT(
-)Finally, we put the melody on the current. Note that the
+)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
+music, so the property settings are done before the melody is
processed. COMMENT(
)verb(
\context Lyrics \text
)COMMENT(
-)The second argument of code(\addlyrics) is the text. Text also
-should land on a Staff, but on a context for syllables,
-extenders, hyphens etc. This context is called Lyrics.COMMENT(
+)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.COMMENT(
)verb(
}
\midi { }
)COMMENT(
-)This makes the music go to a MIDI file as well. MIDI is great for
+)This makes the music go to a MIDI file. MIDI is great for
checking music you enter. You listen to the MIDI file: if you hear
-something unexpected, it's probably a typing error. code(\midi) is a
+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 { }).COMMENT(
\paper { linewidth = 10.0\cm; }
)COMMENT(
-)We also want notation output.COMMENT(
+)We also want notation output. The linewidth is short so the piece
+will be set in two lines. COMMENT(
)verb(
}
)COMMENT(
)End the score block.
+
+sect(Piano music)
+
+Our third subject is a piece piano music. The fragment in the input
+file is a piano reduction of the G major Sinfonia by Giovanni Battista
+Sammartini. It was composed around 1740. COMMENT(Sesam atlas vd
+Muziek. Deel II, blz 414)
+
+mudela(verbatim)(
+\include "paper16.ly";
+
+viola = \notes \relative c' \context Voice = viola {
+ <c4-\f g' c>
+ \property Voice.verticalDirection = \down g'8. b,16
+ s1 s2. r4
+ g
+}
+
+oboes = \notes \relative c'' \context Voice = oboe {
+ \stemup s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>
+ \grace <e8( g> <d4 f> <c2 e> \times 2/3 { <d8 \< f> <e g> <f a> }
+ <
+ { \times 2/3 { a8 g c } \! c2 }
+ \context Voice = oboeTwo {
+ \stemdown
+ \grace {
+ \property Grace.verticalDirection = \down
+ [f,16 g] }
+ f8 e e2
+ } >
+ \stemboth
+ \grace <c,8( e> <)b8. d8.-\trill> <c16 e> |
+ [<d ( f> < )f8. a>] <)b,8 d> r [<d16( f> <f8. )a>] <b,8 d> r |
+ [<c16( e> < )e8. g>] <c8 e,>
+}
+
+hoomPah = \notes \transpose c' {
+ c8 \translator Staff = top \stemdown
+ c'8 \translator Staff = bottom \stemup }
+
+hoomPahHoomPah = { [\hoomPah \hoomPah] }
+
+bassvoices = \notes \relative c' {
+ c4 g8. b,16
+ \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
+ \stemdown [c8 c'8] r4
+ <g d'> r4
+ < {\stemup r2 <e4 c'> <c8 g'> }
+ \context Voice = reallyLow {\stemdown g2 ~ | g4 c8 } >
+}
+
+\score {
+ \context PianoStaff \notes <
+ \context Staff = top < \time 2/2;
+ \context Voice = viola \viola
+ \oboes
+ >
+ \context Staff = bottom < \time 2/2; \clef bass;
+ \bassvoices
+ >
+ >
+ \midi { }
+ \paper {
+ indent = 0.0;
+ linewidth = 14.5 \cm; }
+})
+
+If it looks like incomprehensible gibberish to you... Then you are
+right. The author has doctored this example to have as many quirks in
+one system as possible.COMMENT(
+
+)verb(viola = \notes \relative c' \context Voice = viola {)COMMENT(
+
+)In this example, you can see multiple parts on a staff. Each part is
+associated with one notation context. This notation context handles
+stems and dynamics (among others). The name of this context is
+code(Voice). For each part we have to make sure that there is
+precisely one Voice nop(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.).COMMENT(
+
+)verb(<c4-\f g' c>)COMMENT(
+
+)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.COMMENT(
+
+)verb(\property Voice.verticalDirection = \down)COMMENT(
+
+)code(verticalDirection) is a property of the voice context. It
+controls the directions of stems, articulations marks and other
+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.COMMENT(
+
+)verb( g'8. b,16)COMMENT(
+
+)Relative octaves work a little differently with chords. The starting
+point for the note following a chord is the first note of the chord. So
+the code(g) gets an octave up quote: it is a fifth above the starting
+note of the previous chord (the central C).
+
+verb(s1 s2. r4)COMMENT(
+
+)code(s) is a `spacer' rest. It does not print anything, but it does
+have duration of a rest. COMMENT(
+
+)verb(oboes = \notes \relative c'' \context Voice = oboe {)COMMENT(
+
+)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).COMMENT(
+
+)verb(\stemup s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>)COMMENT(
+
+)code(\stemup) is an identifier reference. It is shorthand for
+code(\property Voice.verticalDirection = \up). If possible, you
+should use predefined identifiers like these for setting properties.
+Your input will be less dependent upon the implementation of LilyPond.
+COMMENT(
+
+)verb(\grace <e8( g> < )d4 f> <c2 e>)COMMENT(
+
+)code(\grace) introduces grace notes. It takes one argument, in this
+case a chord. The slur started on the code(e) of the chord
+will be attached to the next nop(note.)footnote(LilyPond will squirm
+about unended Slurs. In this case, you can ignore the warning).
+COMMENT(
+
+)verb(\times 2/3)COMMENT(
+
+)Tuplets are made with the code(\times) keyword. It takes two
+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. COMMENT(
+
+)verb({ <d8 \< f> <e g> <f a> })COMMENT(
+
+)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(\<).COMMENT(
+
+)verb(<)COMMENT(
+
+)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: COMMENT(
+
+)verb( { \times 2/3 { a8 g c } \! c2 })COMMENT(
+
+)The crescendo is ended at the half note by the escaped exclamation
+mark `code(\!)'. COMMENT(
+
+)verb(\context Voice = oboeTwo {
+\stemdown)COMMENT(
+
+)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. COMMENT(
+
+)verb(\grace { )COMMENT(
+
+)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.COMMENT(
+
+)verb(\property Grace.verticalDirection = \down
+[f,16 g] })COMMENT(
+
+)Normally, grace notes are always stem up, but in this case, the upper
+voice interferes. We set the stems down here.
+
+As far as relative mode is concerned, the previous note is the
+code(c'''2) of the upper voice, so we have to go an octave down for
+the code(f).
+COMMENT(
+
+)verb(
+ f8 e e2
+} >)COMMENT(
+
+)This ends the two-part section. COMMENT(
+
+)verb(\stemboth
+\grace <c,8( e> <)b8. d8.-\trill> <c16 e> | )COMMENT(
+
+)code(\stemboth) ends the forced stem directions. From here, stems are
+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:COMMENT(
+
+)verb(hoomPah = \notes \transpose c' {)COMMENT(
+
+)Transposing can be done with code(\transpose). It takes two
+arguments; the first specifies what central C should be transposed to.
+The second is the to-be-transposed music. As you can see, in this
+case, the transposition is a no-op. Central C is transposed to
+central C.
+
+The purpose of this no-op is circumventing relative mode. Relative
+mode can not be used in conjunction with transposition, so relative
+mode will leave the contents of code(\hoomPah) alone. We can use it
+without having to worry about getting the motive in a wrong
+nop(octave)footnote(code(hoomPah = \relative ...) would be more
+intuitive to use, but that would not let me plug code(\transpose)
+:-CHAR(41).).COMMENT(
+
+)verb(c8 \translator Staff = top \stemdown )COMMENT(
+
+)We assume that the first note will be put in the lower staff. After
+that note we switch to the upper staff with code(\translator). To be
+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. COMMENT(
+
+)verb(c'8 \translator Staff = bottom \stemup })COMMENT(
+
+)Then a note is put on the upper staff, and we switch again. We have
+to name the lower staff `code(bottom)'. COMMENT(
+
+)verb(hoomPahHoomPah = { [\hoomPah \hoomPah] })COMMENT(
+
+)Put two of these fragments in sequence, and beam them.COMMENT(
+
+)verb(bassvoices = \notes \relative c' {
+c4 g8. b,16
+\hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
+\hoomPahHoomPah)COMMENT(
+
+)Entering the bass part is easy: the hoomPahHoomPah variable is
+referenced four times.COMMENT(
+
+)verb(\context Voice = reallyLow {\stemdown g2 ~ | g4 c8 } >)COMMENT(
+
+)After skipping some lines, we see code(~). This mark makes ties.COMMENT(
+
+)verb(\context PianoStaff)COMMENT(
+
+)For piano music, a special context is needed to get cross staff
+beaming right. It is called code(PianoStaff).COMMENT(
+
+)verb(\context Staff = bottom < \time 2/2; \clef bass;)COMMENT(
+
+)The bottom staff must have a different clef.COMMENT(
+
+)verb(indent = 0.0;)COMMENT(
+
+)To make some more room on the line, the first (in this case the only)
+line is not indented.
+
+This example shows a lot of features, but the organisation isn't
+perfect. For example, it would be less confusing to use a chord
+containing sequential music than a sequence of chords for the oboe
+parts.
+
+[TODO: demonstrate Hara-Kiri with scores and part extraction.]
+
+sect(The end)
+
+That's all folks. From here, you can either try fiddling with input
+files, or you can read the reference manual.
+