1 @c -*- coding: utf-8; mode: texinfo; -*-
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. For details, see the Contributors'
8 Guide, node Updating translation committishes..
14 Tutorial guidelines: (different from policy.txt!)
15 - unless you have a really good reason, use either
16 @lilypond[verbatim,quote]
18 @lilypond[verbatim,quote,relative=2]
20 Don't use any other relative=X commands.
22 - use "aes" and "ees" instead of "as" and "es". I know it's not
23 correct Dutch naming, but let's not confuse people with this
24 until we get to the Basic notation chapter.
26 - Add "Music Glossary: @rglos{foo}" to the *top* of the relevant
27 portions of the tutorial.
33 @chapter Common notation
35 This chapter explains how to create beautiful printed music
36 containing common musical notation, following the material in
40 * Single staff notation::
41 * Multiple notes at once::
47 @node Single staff notation
48 @section Single staff notation
50 This section introduces common notation that is used for one voice
55 * Accidentals and key signatures::
57 * Articulation and dynamics::
59 * Automatic and manual beams::
60 * Advanced rhythmic commands::
65 @subsection Bar checks
67 Though not strictly necessary, @emph{bar checks} should be
68 used in the input code to show where bar lines are expected
69 to fall. They are entered using the bar symbol, @code{|}.
70 With bar checks, the program can verify that you've entered
71 durations that make each measure add up to the correct
72 length. Bar checks also make your input code easier to
73 read, since they help to keep things organized.
75 @lilypond[verbatim,quote,relative=2]
76 g1 | e1 | c2. c'4 | g4 c g e | c4 r r2 |
81 @ruser{Bar and bar number checks}.
84 @node Accidentals and key signatures
85 @subsection Accidentals and key signatures
87 @warning{New users are often confused by these -- please read the
88 warning at the bottom of this page, especially if you are not
89 familiar with music theory!}
91 @subheading Accidentals
94 @cindex accidentals and key signatures
107 Music Glossary: @rglos{sharp}, @rglos{flat}, @rglos{double sharp},
108 @rglos{double flat}, @rglos{accidental}.
110 A @notation{sharp} pitch is made by adding @code{is} to the name,
111 and a @notation{flat} pitch by adding @code{es}. As you might
112 expect, a @notation{double sharp} or @notation{double flat} is
113 made by adding @code{isis} or @code{eses}. This syntax is derived
114 from note naming conventions in Nordic and Germanic languages,
115 like German and Dutch. To use other names for
116 @notation{accidentals}, see @ruser{Note names in other languages}.
118 @lilypond[verbatim,quote,relative=2]
119 cis4 ees fisis, aeses
122 @cindex key signature, setting
123 @subheading Key signatures
125 @cindex key signature
128 @cindex accidentals and key signature
129 @cindex content vs. layout
130 @cindex layout vs. content
139 Music Glossary: @rglos{key signature}, @rglos{major},
142 The @notation{key signature} is set with the command @code{\key}
143 followed by a pitch and @code{\major} or @code{\minor}.
145 @lilypond[verbatim,quote,relative=2]
154 @subheading Warning: key signatures and pitches
156 Music Glossary: @rglos{accidental}, @rglos{key signature},
157 @rglos{pitch}, @rglos{flat}, @rglos{natural}, @rglos{sharp},
158 @rglos{transposition}, @rglos{Pitch names}.
160 To determine whether to print an @notation{accidental}, LilyPond
161 examines the pitches and the @notation{key signature}. The key
162 signature only affects the @emph{printed} accidentals, not the
163 note's @notation{pitch}! This is a feature that often causes
164 confusion to newcomers, so let us explain it in more detail.
166 LilyPond makes a clear distinction between musical content and
167 layout. The alteration (@notation{flat}, @notation{natural sign} or
168 @notation{sharp}) of a note is part of the pitch, and is therefore
169 musical content. Whether an accidental (a @emph{printed} flat,
170 natural or sharp sign) is printed in front of the corresponding
171 note is a question of layout. Layout is something that follows
172 rules, so accidentals are printed automatically according to those
173 rules. The pitches in your music are works of art, so they will
174 not be added automatically, and you must enter what you want to
179 @lilypond[verbatim,quote,relative=2]
185 No note has a printed accidental, but you must still add
186 @code{is} and type @code{cis} and @code{fis} in the input file.
188 The code @code{b} does not mean @qq{print a black dot just on
189 the middle line of the staff.} Rather, it means @qq{there is a
190 note with pitch B-natural.} In the key of A-flat major, it
191 @emph{does} get an accidental:
193 @lilypond[verbatim,quote,relative=2]
198 If the above seems confusing, consider this: if you were playing a
199 piano, which key would you hit? If you would press a black key,
200 then you @emph{must} add @w{@code{-is}} or @w{@code{-es}} to the note
203 Adding all alterations explicitly might require a little more
204 effort when typing, but the advantage is that
205 @notation{transposing} is easier, and accidentals can be printed
206 according to different conventions. For some examples of how
207 accidentals can be printed according to different rules, see
208 @ruser{Automatic accidentals}.
213 @ruser{Note names in other languages},
215 @ruser{Automatic accidentals},
216 @ruser{Key signature}.
220 @subsection Ties and slurs
224 @cindex slur, phrasing
225 @cindex phrasing slur
234 Music Glossary: @rglos{tie}.
236 A @notation{tie} is created by appending a tilde @code{~} to the
237 first note being tied.
239 @lilypond[verbatim,quote,relative=2]
240 g4~ g c2~ | c4~ c8 a~ a2 |
246 Music Glossary: @rglos{slur}.
248 A @notation{slur} is a curve drawn across many notes. The
249 starting note and ending note are marked with @code{(} and
250 @code{)} respectively.
252 @lilypond[verbatim,quote,relative=2]
253 d4( c16) cis( d e c cis d) e( d4)
256 @subheading Phrasing slurs
258 Music Glossary: @rglos{slur}, @rglos{phrasing}.
260 Slurs to indicate longer @notation{phrasing} can be entered with
261 @code{\(} and @code{\)}. You can have both @notation{slurs}
262 and phrasing slurs at the same time, but you cannot have
263 simultaneous slurs or simultaneous phrasing slurs.
265 @lilypond[verbatim,quote,relative=2]
266 g4\( g8( a) b( c) b4\)
271 @cindex slurs versus ties
272 @subheading Warnings: slurs vs. ties
274 Music Glossary: @rglos{articulation}, @rglos{slur}, @rglos{tie}.
276 A @notation{slur} looks like a @notation{tie}, but it has a
277 different meaning. A tie simply makes the first note longer, and
278 can only be used on pairs of notes with the same pitch. Slurs
279 indicate the @notation{articulation} of notes, and can be used on
280 larger groups of notes. Slurs and ties can be nested.
282 @lilypond[verbatim,quote,relative=2]
291 @ruser{Phrasing slurs}.
294 @node Articulation and dynamics
295 @subsection Articulation and dynamics
298 @subheading Articulations
304 Music Glossary: @rglos{articulation}.
306 Common @notation{articulations} can be added to a note using a
307 dash @code{-} and a single character:
309 @lilypond[verbatim,quote,relative=2]
314 @subheading Fingerings
321 Music Glossary: @rglos{fingering}.
323 Similarly, @notation{fingering} indications can be added to a note
324 using a dash (@code{-}) and the digit to be printed:
326 @lilypond[verbatim,quote,relative=2]
330 Articulations and fingerings are usually placed automatically, but
331 you can specify a direction by replacing the dash (@code{-}) with
332 @code{^} (up) or @code{_} (down). You can also use multiple
333 articulations on the same note. However, in most cases it is best
334 to let LilyPond determine the articulation directions.
336 @lilypond[verbatim,quote,relative=2]
337 c4_-^1 d^. f^4_2-> e^-_+
359 Music Glossary: @rglos{dynamics}, @rglos{crescendo},
362 @notation{Dynamic} signs are made by adding the markings (with a
363 backslash) to the note:
365 @lilypond[verbatim,quote,relative=2]
370 @notation{Crescendi} and @notation{decrescendi} are started with
371 the commands @code{\<} and @code{\>}. The next dynamics sign, for
372 example @code{\f}, will end the (de)crescendo, or the command
373 @code{\!} can be used:
375 @lilypond[verbatim,quote,relative=2]
382 @ruser{Articulations and ornamentations},
383 @ruser{Fingering instructions},
388 @subsection Adding text
397 Text may be added to your scores:
399 @lilypond[verbatim,quote,relative=2]
403 Extra formatting may be added with the @code{\markup} command:
405 @lilypond[verbatim,quote,relative=2]
406 c2^\markup { \bold espr }
408 \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p
415 @ruser{Writing text}.
418 @node Automatic and manual beams
419 @subsection Automatic and manual beams
422 @cindex automatic beams
424 @cindex beams, automatic
425 @cindex beams, manual
426 @cindex beams, by hand
431 @funindex \autoBeamOff
432 @funindex autoBeamOff
433 @funindex \autoBeamOn
436 Music Glossary: @rglos{beam}.
438 All @notation{beams} are drawn automatically:
440 @lilypond[verbatim,quote,relative=2]
441 a8 ais d ees r d c16 b a8
444 If you do not like the automatic beams, they may be overridden
445 manually. To correct just an occasional beam mark the first note
446 to be beamed with @code{[} and the last one with @code{]}.
448 @lilypond[verbatim,quote,relative=2]
449 a8[ ais] d[ ees r d] c16 b a8
452 If you want to turn off automatic beaming entirely or for an
453 extended section of music, use the command @code{\autoBeamOff}
454 to turn off automatic beaming and @code{\autoBeamOn} to turn it
457 @lilypond[verbatim,quote,relative=2]
467 @ruser{Automatic beams},
468 @ruser{Manual beams}.
471 @node Advanced rhythmic commands
472 @subsection Advanced rhythmic commands
474 @subheading Partial measure
478 @cindex partial measure
483 Music Glossary: @rglos{anacrusis}.
485 A pickup (or @notation{anacrusis}) is entered with the keyword
486 @code{\partial}. It is followed by a duration: @code{\partial 4}
487 is a quarter note pickup and @code{\partial 8} an eighth note.
489 @lilypond[verbatim,quote,relative=2]
502 Music Glossary: @rglos{note value}, @rglos{triplet}.
504 @notation{Tuplets} are made with the @code{\times} keyword. It
505 takes two arguments: a fraction and a piece of music. The
506 duration of the piece of music is multiplied by the fraction.
507 Triplets make notes occupy 2/3 of their notated duration, so a
508 @notation{triplet} has 2/3 as its fraction
510 @lilypond[verbatim,quote,relative=2]
511 \times 2/3 { f8 g a }
512 \times 2/3 { c8 r c }
513 \times 2/3 { f,8 g16[ a g a] }
517 @subheading Grace notes
525 @funindex \acciaccatura
526 @funindex acciaccatura
527 @funindex \appoggiatura
528 @funindex acciaccatura
530 Music Glossary: @rglos{grace notes}, @rglos{acciaccatura},
531 @rglos{appoggiatura}.
533 @notation{Grace notes} are created with the @code{\grace} command,
534 although they can also be created by prefixing a music expression
535 with the keyword @code{\appoggiatura} or @code{\acciaccatura}:
537 @lilypond[verbatim,quote,relative=2]
538 c2 \grace { a32[ b] } c2 |
539 c2 \appoggiatura b16 c2 |
540 c2 \acciaccatura b16 c2 |
551 @node Multiple notes at once
552 @section Multiple notes at once
554 This section introduces having more than one note at the same
555 time: multiple instruments, multiple staves for a single
556 instrument (i.e. piano), and chords.
558 Polyphony in music refers to having more than one voice occurring
559 in a piece of music. Polyphony in LilyPond refers to having more
560 than one voice on the same staff.
563 * Music expressions explained::
566 * Combining notes into chords::
567 * Single staff polyphony::
571 @node Music expressions explained
572 @subsection Music expressions explained
574 @cindex music expression
575 @cindex expression, music
576 @cindex compound music expression
577 @cindex music expression, compound
579 In LilyPond input files, music is represented by @emph{music
580 expressions}. A single note is a music expression:
582 @lilypond[verbatim,quote,relative=2]
586 Enclosing a note in braces creates a @emph{compound music
587 expression}. Here we have created a compound music expression
590 @lilypond[verbatim,quote,relative=2]
594 Putting a group of music expressions (e.g. notes) in braces means
595 that they are in sequence (i.e. each one follows the previous
596 one). The result is another music expression:
598 @lilypond[verbatim,quote,relative=2]
602 @subheading Analogy: mathematical expressions
604 This mechanism is similar to mathematical formulas: a big formula
605 is created by composing small formulas. Such formulas are called
606 expressions, and they can contain other expressions, so you can
607 make arbitrarily complex and large expressions. For example,
616 ((1 + 2) * 3) / (4 * 5)
619 This is a sequence of expressions, where each expression is
620 contained in the next (larger) one. The simplest expressions are
621 numbers, and larger ones are made by combining expressions with
622 operators (like @code{+}, @code{*} and @code{/}) and parentheses.
623 Like mathematical expressions, music expressions can be nested
624 arbitrarily deep, which is necessary for complex music like
628 @subheading Simultaneous music expressions: multiple staves
630 @cindex multiple staves
631 @cindex staves, multiple
633 @cindex combining expressions in parallel
634 @cindex parallel expressions
635 @cindex expressions, parallel
636 @cindex relative notes and simultaneous music
637 @cindex relative notes and parallel expressions
638 @cindex simultaneous music and relative notes
639 @cindex parallel expressions and relative notes
645 Music Glossary: @rglos{polyphony}.
647 This technique is useful for @notation{polyphonic} music. To
648 enter music with more voices or more staves, we combine
649 expressions in parallel. To indicate that two voices should play
650 at the same time, simply enter a simultaneous combination of music
651 expressions. A @q{simultaneous} music expression is formed by
652 enclosing expressions inside @code{<<} and @code{>>}. In the
653 following example, three sequences (all containing two separate
654 notes) are combined simultaneously:
656 @lilypond[verbatim,quote]
666 Note that we have indented each level of the input with a
667 different amount of space. LilyPond does not care how much (or
668 little) space there is at the beginning of a line, but indenting
669 LilyPond code like this makes it much easier for humans to read.
671 @warning{each note is relative to the previous note in
672 the input, not relative to the @code{c''} in the initial
673 @code{@bs{}relative} command.}
676 @subheading Simultaneous music expressions: single staff
678 To determine the number of staves in a piece, LilyPond looks at
679 the beginning of the first expression. If there is a single note,
680 there is one staff; if there is a simultaneous expression, there
681 is more than one staff. The following example shows a complex
682 expression, but as it begins with a single note it will be set
683 out on a single staff.
685 @lilypond[verbatim,quote]
688 << { e2 f } { c2 <<b d>> } >> |
692 @node Multiple staves
693 @subsection Multiple staves
695 @cindex multiple staves
696 @cindex staves, multiple
698 @cindex context, notation
699 @cindex notation context
711 LilyPond input files are constructed out of music expressions, as
712 we saw in @ref{Music expressions explained}. If the score begins
713 with simultaneous music expressions, LilyPond creates multiples
714 staves. However, it is easier to see what happens if we create
715 each staff explicitly.
717 To print more than one staff, each piece of music that makes up a
718 staff is marked by adding @code{\new Staff} before it. These
719 @code{Staff} elements are then combined in parallel with @code{<<}
722 @lilypond[verbatim,quote]
725 \new Staff { \clef "treble" c4 }
726 \new Staff { \clef "bass" c,,4 }
731 The command @code{\new} introduces a @q{notation context.} A
732 notation context is an environment in which musical events (like
733 notes or @code{\clef} commands) are interpreted. For simple
734 pieces, such notation contexts are created automatically. For
735 more complex pieces, it is best to mark contexts explicitly.
737 There are several types of contexts. @code{Score}, @code{Staff},
738 and @code{Voice} handle melodic notation, while @code{Lyrics} sets
739 lyric texts and @code{ChordNames} prints chord names.
741 In terms of syntax, prepending @code{\new} to a music expression
742 creates a bigger music expression. In this way it resembles the
743 minus sign in mathematics. The formula @math{(4+5)} is an
744 expression, so @math{-(4+5)} is a bigger expression.
746 Time signatures entered in one staff affect all other staves by
747 default. On the other hand, the key signature of one staff does
748 @emph{not} affect other staves. This different default behavior
749 is because scores with transposing instruments are more common
750 than polyrhythmic scores.
752 @lilypond[verbatim,quote]
755 \new Staff { \clef "treble" \key d \major \time 3/4 c4 }
756 \new Staff { \clef "bass" c,,4 }
765 @subsection Staff groups
784 Piano music is typeset in two staves connected by a
786 Printing such a staff is similar to the polyphonic example in
787 @ref{Multiple staves}. However, now this entire expression is
788 inserted inside a @code{PianoStaff}:
797 Here is a small example:
799 @lilypond[verbatim,quote]
802 \new Staff { \time 2/4 c4 e | g g, | }
803 \new Staff { \clef "bass" c,,4 c' | e c | }
808 Other staff groupings are introduced with @code{\new GrandStaff},
809 suitable for orchestral scores, and @w{@code{\new ChoirStaff}},
810 suitable for vocal scores. These staff groups each form another
811 type of context, one that generates the brace at the left end of
812 every system and also controls the extent of bar lines.
817 @ruser{Keyboard and other multi-staff instruments},
818 @ruser{Displaying staves}.
821 @node Combining notes into chords
822 @subsection Combining notes into chords
824 Music Glossary: @rglos{chord}
827 @cindex note durations in chords
833 We saw earlier how notes can be combined into @notation{chords} by
834 indicating they are simultaneous by enclosing them in double angle
835 brackets. However, the normal way of indicating a chord is to
836 surround the pitches with @emph{single} angle brackets. Note that
837 all the notes in a chord must have the same duration, and that the
838 duration is placed after the closing bracket.
840 @lilypond[verbatim,quote,relative=2]
844 Think of chords as almost equivalent to single notes:
845 almost everything you can attach to a single note can be attached
846 to a chord, and everything must go @emph{outside} the angle
847 brackets. For example, you can combine markings like beams and
848 ties with chords. They must be placed outside the angle brackets.
850 @lilypond[verbatim,quote,relative=2]
851 r4 <c e g>~ <c f a>2 |
852 <c e g>8[ <c f a> <c e g> <c f a>]
853 <c e g>8\>[ <c f a> <c f a> <c e g>]\! |
854 r4 <c e g>8.\p <c f a>16( <c e g>4-. <c f a>) |
859 @ruser{Chorded notes}.
862 @node Single staff polyphony
863 @subsection Single staff polyphony
866 @cindex multiple voices
867 @cindex voices, more on one staff
868 @cindex single staff polyphony
872 @funindex << ... \\ ... >>
877 Polyphonic music in lilypond, while not difficult, uses concepts
878 that we haven't discussed yet, so we're not going to introduce
879 them here. Instead, the following sections introduce these concepts
880 and explain them thoroughly.
884 @ref{Voices contain music}.
887 @ruser{Simultaneous notes}.
892 This section introduces vocal music and simple song sheets.
895 * Setting simple songs::
896 * Aligning lyrics to a melody::
897 * Lyrics to multiple staves::
901 @node Setting simple songs
902 @subsection Setting simple songs
910 Music Glossary: @rglos{lyrics}.
912 Here is the start of the melody to a nursery
913 rhyme, @notation{Girls and boys come out to play}:
915 @lilypond[verbatim,quote]
919 d4 b8 c4 a8 | d4 b8 g4
923 The @notation{lyrics} can be set to these notes, combining both
924 with the @code{\addlyrics} keyword. Lyrics are entered by
925 separating each syllable with a space.
927 @lilypond[verbatim,quote]
932 d4 b8 c4 a8 | d4 b8 g4
935 Girls and boys come | out to play,
940 @warning{It is essential that the final syllable is separated from
941 the terminating curly bracket by a space or a newline, or it will be
942 assumed to be part of the syllable, giving rise to an obscure
943 error, see @rprogram{Apparent error in ../ly/init.ly}.}
945 Note the double angle brackets @w{@code{<< ... >>}} around the
946 whole piece to show that the music and lyrics are to occur at the
949 @node Aligning lyrics to a melody
950 @subsection Aligning lyrics to a melody
953 @cindex extender line
956 @cindex lyrics, aligning
957 @cindex aligning lyrics
958 @cindex lyrics, multi-syllable words
959 @cindex words with multiple syllables in lyrics
961 Music Glossary: @rglos{melisma}, @rglos{extender line}.
963 The next line in the nursery rhyme is @notation{The moon doth
964 shine as bright as day}. Let's extend it:
966 @lilypond[verbatim,quote]
971 d4 b8 c4 a8 | d4 b8 g4 g8 |
972 a4 b8 c b a | d4 b8 g4. |
975 Girls and boys come | out to play,
976 The | moon doth shine as | bright as day; |
981 If you compile the code in the example above, you should see some
982 warnings in the console output:
985 song.ly:12:29: warning: barcheck failed at: 5/8
986 The | moon doth shine as
988 song.ly:12:46: warning: barcheck failed at: 3/8
989 The | moon doth shine as | bright as day;
993 This is a good example of the usefulness of bar checks. Now,
994 looking at the music, we see that the extra lyrics do not align
995 properly with the notes. The word @notation{shine} should be sung
996 on two notes, not one. This is called a @notation{melisma}, a
997 single syllable sung to more than one note. There are several
998 ways to spread a syllable over multiple notes, the simplest being
999 to add a slur across them, for details, see @ref{Ties and slurs}:
1001 @lilypond[verbatim,quote]
1006 d4 b8 c4 a8 | d4 b8 g4 g8 |
1007 a4 b8 c( b) a | d4 b8 g4. |
1010 Girls and boys come | out to play,
1011 The | moon doth shine as | bright as day; |
1016 The words now line up correctly with the notes, but the automatic
1017 beaming for the notes above @notation{shine as} does not look right.
1018 We can correct this by inserting manual beaming commands to override
1019 the automatic beaming here, for details, see @ref{Automatic and
1022 @lilypond[verbatim,quote]
1027 d4 b8 c4 a8 | d4 b8 g4 g8 |
1028 a4 b8 c([ b]) a | d4 b8 g4. |
1031 Girls and boys come | out to play,
1032 The | moon doth shine as | bright as day; |
1037 As an alternative to using slurs, the melismata may be indicated
1038 in just the lyrics by using an underscore @code{_} for each note
1039 that should be included in the melisma:
1041 @lilypond[verbatim,quote]
1046 d4 b8 c4 a8 | d4 b8 g4 g8 |
1047 a4 b8 c[ b] a | d4 b8 g4. |
1050 Girls and boys come | out to play,
1051 The | moon doth shine _ as | bright as day; |
1056 If a syllable extends over several notes or a single very long
1057 note an @notation{extender line} is usually drawn from the
1058 syllable extending under all the notes for that syllable. It is
1059 entered as two underscores @code{__}. Here is an example from the
1060 first three bars of @notation{Dido's Lament}, from Purcell's
1061 @notation{Dido and Æneas}:
1063 @lilypond[verbatim,quote]
1068 g2 a bes | bes2( a) b2 |
1069 c4.( bes8 a4. g8 fis4.) g8 | fis1
1073 am | laid __ in | earth,
1078 None of the examples so far have involved words containing more
1079 than one syllable. Such words are usually split one syllable to a
1080 note, with hyphens between syllables. Such hyphens are entered as
1081 two dashes, resulting in a centered hyphen between the syllables.
1082 Here is an example showing this and everything we have learned so
1083 far about aligning lyrics to notes.
1085 @c no ragged-right here because otherwise the hyphens get lost,
1086 @c but the example is long enough to avoid looking strange.
1087 @lilypond[verbatim,quote,noragged-right]
1093 d4 | g4 g a8( b) | g4 g b8( c) |
1097 A -- | way in a __ | man -- ger,
1098 no __ | crib for a | bed, __
1103 Some lyrics, especially those in Italian, require the opposite:
1104 setting more than one syllable to a single note. This is
1105 achieved by linking the syllables together with a single
1106 underscore @code{_} (with no spaces), or enclosing them in quotes.
1107 Here's an example from Rossini's @notation{Figaro}, where
1108 @notation{al} has to be sung on the same note as the @notation{go} of
1109 @notation{Largo} in Figaro's aria @notation{Largo al factotum}:
1111 @c no ragged-right here because otherwise the hyphens get lost,
1112 @c but the example is long enough to avoid looking strange.
1113 @lilypond[verbatim,quote,noragged-right]
1119 c4.~ c8 d b | c8([ d]) b c d b | c8
1122 Lar -- go_al fac -- | to -- tum del -- la cit -- | tÃ
1130 @ruser{Vocal music}.
1133 @node Lyrics to multiple staves
1134 @subsection Lyrics to multiple staves
1136 @cindex lyrics and multiple staves
1137 @cindex multiple staves and lyrics
1139 The simple approach using @code{\addlyrics} can be used for
1140 placing lyrics under more than one staff. Here is an
1141 example from Handel's @notation{Judas Maccabæus}:
1143 @lilypond[verbatim,quote]
1149 c8 | c8([ bes]) a a([ g]) f | f'4. b, | c4.~ c4
1152 Let | flee -- cy flocks the | hills a -- | dorn, __
1158 r8 | r4. r4 c8 | a'8([ g]) f f([ e]) d | e8([ d]) c bes'4
1161 Let | flee -- cy flocks the | hills a -- dorn,
1166 Scores any more complex than this simple example are better
1167 produced by separating out the score structure from the notes and
1168 lyrics with variables. These are discussed in @ref{Organizing
1169 pieces with variables}.
1174 @ruser{Vocal music}.
1178 @section Final touches
1180 This is the final section of the tutorial; it demonstrates how to
1181 add the final touches to simple pieces, and provides an
1182 introduction to the rest of the manual.
1185 * Organizing pieces with variables::
1187 * Absolute note names::
1188 * After the tutorial::
1192 @node Organizing pieces with variables
1193 @subsection Organizing pieces with variables
1196 @cindex variables, defining
1199 @cindex assigning variables
1200 @cindex using variables
1201 @cindex variables, using
1202 @cindex variables, characters allowed in
1203 @cindex characters allowed in variables
1205 When all of the elements discussed earlier are combined to produce
1206 larger files, the music expressions get a lot bigger. In
1207 polyphonic music with many staves, the input files can become very
1208 confusing. We can reduce this confusion by using
1211 With variables (also known as identifiers or macros), we can break
1212 up complex music expressions. A variable is assigned as
1216 namedMusic = @{ @dots{} @}
1219 The contents of the music expression @code{namedMusic} can be used
1220 later by placing a backslash in front of the name
1221 (@code{\namedMusic}, just like a normal LilyPond command).
1223 @lilypond[verbatim,quote]
1224 violin = \new Staff {
1230 cello = \new Staff {
1246 The name of a variable must have alphabetic characters only, no
1247 numbers, underscores, or dashes.
1249 Variables must be defined @emph{before} the main music
1250 expression, but may be used as many times as required anywhere after
1251 they have been defined. They may even be used in a later definition
1252 of another variable, giving a way of shortening the input if a
1253 section of music is repeated many times.
1255 @lilypond[verbatim,quote]
1256 tripletA = \times 2/3 { c,8 e g }
1257 barA = { \tripletA \tripletA \tripletA \tripletA }
1264 Variables may be used for many other types of objects in
1265 the input. For example,
1270 aFivePaper = \paper @{ paperheight = 21.0 \cm @}
1273 Depending on its contents, the variable can be used in different
1274 places. The following example uses the above variables:
1289 @subsection Adding titles
1293 @cindex header block
1298 The title, composer, opus number, and similar information are
1299 entered in the @code{\header} block. This exists outside of the
1300 main music expression; the @code{\header} block is usually placed
1301 underneath the version number.
1304 \version @w{"@version{}"}
1313 @dots{} music @dots{}
1317 When the file is processed, the title and composer are printed
1318 above the music. More information on titling can be found in
1319 @ruser{Creating titles headers and footers}.
1322 @node Absolute note names
1323 @subsection Absolute note names
1326 @cindex note names, absolute
1327 @cindex absolute mode
1328 @cindex absolute values for pitches
1329 @cindex pitches, absolute values
1330 @cindex absolute note names
1332 So far we have always used @code{\relative} to define pitches.
1333 This is the easiest way to enter most music, but another way of
1334 defining pitches exists: absolute mode.
1336 If you omit the @code{\relative}, LilyPond treats all pitches as
1337 absolute values. A @code{c'} will always mean middle C, a
1338 @code{b} will always mean the note one step below middle C, and a
1339 @code{g,} will always mean the note on the bottom staff of the
1342 @lilypond[verbatim,quote]
1350 Here is a four-octave scale:
1352 @lilypond[verbatim,quote]
1367 As you can see, writing a melody in the treble clef involves a lot
1368 of quote @code{'} marks. Consider this fragment from Mozart:
1370 @lilypond[verbatim,quote]
1374 cis''8. d''16 cis''8 e''4 e''8 |
1375 b'8. cis''16 b'8 d''4 d''8 |
1379 All these quotes makes the input less readable and they are a source
1380 of errors. With @code{\relative}, the previous example is much
1381 easier to read and type:
1383 @lilypond[verbatim,quote]
1387 cis8. d16 cis8 e4 e8 |
1388 b8. cis16 b8 d4 d8 |
1392 If you make a mistake with an octave mark (@code{'} or @code{,})
1393 while working in @code{\relative} mode, it is very obvious -- many
1394 notes will be in the wrong octave. When working in absolute mode,
1395 a single mistake will not be as visible, and will not be as easy
1398 However, absolute mode is useful for music which has large
1399 intervals, and is extremely useful for computer-generated LilyPond
1404 @node After the tutorial
1405 @subsection After the tutorial
1407 After finishing the tutorial, you should probably try writing a
1408 piece or two. Start by adding notes to one of the
1409 @ref{Templates}. If you need any notation that was not covered in
1410 the tutorial, look at the Notation Reference, starting with
1411 @ruser{Musical notation}. If you want to write for an instrument
1412 ensemble that is not covered in the templates, take a look at
1413 @ref{Extending the templates}.
1415 Once you have written a few short pieces, read the rest of the
1416 Learning Manual (chapters 3-5). There's nothing wrong with
1417 reading it now, of course! However, the rest of the Learning
1418 Manual assumes that you are familiar with LilyPond input. You may
1419 wish to skim these chapters right now, and come back to them after
1420 you have more experience.
1422 In this tutorial and in the rest of the Learning Manual, there is a
1423 paragraph @strong{See also} at the end of each section, which contains
1424 cross-references to other sections: you should not follow these
1425 cross-references at first reading; when you have read all of the
1426 Learning Manual, you may want to read some sections again and follow
1427 cross-references for further reading.
1429 If you have not done so already, @emph{please} read @ref{Overview
1430 of manuals}. There is a lot of information about LilyPond, so
1431 newcomers often do not know where they should look for help. If
1432 you spend five minutes reading that section carefully, you might
1433 save yourself hours of frustration looking in the wrong places!