+
+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.
+