1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
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. See TRANSLATION for details.
11 @c A menu is needed before every deeper *section nesting of @node's; run
12 @c M-x texinfo-all-menus-update
13 @c to automatically fill in these menus before saving changes
16 @chapter Basic notation
18 This chapter explains how to use basic notation features.
24 * Expressive marks old::
33 Polyphony in music refers to having more than one voice occurring in
34 a piece of music. Polyphony in LilyPond refers to having more than
35 one voice on the same staff.
41 * Explicitly instantiating voices::
42 * Collision Resolution::
47 @unnumberedsubsubsec Chords
51 A chord is formed by a enclosing a set of pitches between @code{<}
52 and @code{>}. A chord may be followed by a duration, and a set of
53 articulations, just like simple notes
55 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
59 For more information about chords, see @ref{Chord names}.
62 @c I don't like having this here, but I can't think of
63 @c anywhere else to put it. :( -gp
65 @unnumberedsubsubsec Stems
67 Whenever a note is found, a @internalsref{Stem} object is created
68 automatically. For whole notes and rests, they are also created but
77 @funindex \stemNeutral
83 To change the direction of stems in the middle of the staff, use
85 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
87 \override Stem #'neutral-direction = #up
89 \override Stem #'neutral-direction = #down
94 @anchor{Basic polyphony}
95 @unnumberedsubsubsec Basic polyphony
99 The easiest way to enter fragments with more than one voice on a staff
100 is to enter each voice as a sequence (with @code{@{...@}}), and combine
101 them simultaneously, separating the voices with @code{\\}
105 @lilypond[quote,verbatim,fragment]
106 \new Staff \relative c' {
109 { g4 f e | d2 e2 } \\
110 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
116 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
117 voices are sometimes called @q{layers} in other notation packages}
119 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
120 each of these contexts, vertical direction of slurs, stems, etc., is set
123 These voices are all separate from the voice that contains the notes just
124 outside the @code{<< \\ >>} construct. This should be noted when making
125 changes at the voice level. This also means that slurs and ties cannot go
126 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
127 from separate @code{<< \\ >>} constructs on the same staff are the
128 same voice. Here is the same example, with different noteheads and
130 voice. Note that the change to the note-head style in the main voice does
132 the inside of the @code{<< \\ >>} constructs. Also, the change to the
134 voice in the first @code{<< \\ >>} construct is effective in the second
135 @code{<< \\ >>}, and the voice is tied across the two constructs.
137 @cindex note heads, styles
139 @lilypond[quote,verbatim,fragment]
140 \new Staff \relative c' {
141 \override NoteHead #'style = #'cross
142 \override NoteHead #'color = #red
146 { \override NoteHead #'style = #'triangle
147 \override NoteHead #'color = #blue
152 { c8 b16 a b8 g ~ g2 } \\
153 { \override NoteHead #'style = #'slash
154 \override NoteHead #'color = #green
160 Polyphony does not change the relationship of notes within a
161 @code{\relative @{ @}} block. Each note is calculated relative
162 to the note immediately preceding it.
165 \relative @{ noteA << noteB \\ noteC >> noteD @}
168 @code{noteC} is relative to @code{noteB}, not @code{noteA};
169 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
173 @anchor{Explicitly instantiating voices}
174 @unnumberedsubsubsec Explicitly instantiating voices
176 @internalsref{Voice} contexts can also be instantiated manually
177 inside a @code{<< >>} block to create polyphonic music, using
178 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
179 and a horizontal shift for each part.
183 << \upper \\ \lower >>
191 \new Voice = "1" @{ \voiceOne \upper @}
192 \new Voice = "2" @{ \voiceTwo \lower @}
196 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
197 articulations, text annotations, augmentation dots of dotted
198 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
199 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
200 make them point downwards.
201 The command @code{\oneVoice} will revert back to the normal setting.
203 An expression that appears directly inside a @code{<< >>} belongs to
204 the main voice. This is useful when extra voices appear while the main
205 voice is playing. Here is a more correct rendition of the example from
206 the previous section. The crossed colored noteheads demonstrate that the main
207 melody is now in a single voice context.
209 @lilypond[quote,ragged-right,verbatim]
210 \new Staff \relative c' {
211 \override NoteHead #'style = #'cross
212 \override NoteHead #'color = #red
217 \new Voice="1" { \voiceTwo
218 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
221 \new Voice { \voiceThree
230 The correct definition of the voices allows the melody to be slurred.
231 @lilypond[quote,ragged-right,verbatim]
232 \new Staff \relative c' {
237 \context Voice="1" { \voiceTwo
238 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
241 \new Voice { \voiceThree
250 Avoiding the @code{\\} separator also allows nesting polyphony
251 constructs, which in some case might be a more natural way to typeset
254 @lilypond[quote,ragged-right,verbatim]
255 \new Staff \relative c' {
260 \context Voice="1" { \voiceTwo
264 \new Voice { \voiceThree
276 In some instances of complex polyphonic music, you may need additional
277 voices to avoid collisions between notes. Additional voices are added
278 by defining an identifier, as shown below:
280 @lilypond[quote,verbatim,ragged-right,relative=2]
281 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
284 { \voiceOne g4 ~ \stemDown g32[ f( es d c b a b64 )g] } \\
292 @anchor{Collision Resolution}
293 @unnumberedsubsubsec Collision Resolution
295 Normally, note heads with a different number of dots are not merged, but
296 when the object property @code{merge-differently-dotted} is set in
297 the @internalsref{NoteCollision} object, they are merged:
299 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
302 \override Staff.NoteCollision
303 #'merge-differently-dotted = ##t
305 } \\ { g8.[ f16] g8.[ f16] } >>
308 Similarly, you can merge half note heads with eighth notes, by setting
309 @code{merge-differently-headed}:
311 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
314 \override Staff.NoteCollision
315 #'merge-differently-headed = ##t
316 c8 c4. } \\ { c2 c2 } >>
320 @code{merge-differently-headed} and @code{merge-differently-dotted}
321 only apply to opposing stem directions (ie. Voice 1 & 2).
323 LilyPond also vertically shifts rests that are opposite of a stem,
326 @lilypond[quote,ragged-right,fragment,verbatim]
327 \new Voice << c''4 \\ r4 >>
330 If three or more notes line up in the same column,
331 @code{merge-differently-headed} cannot
332 successfully complete the merge of the two notes that should be merged.
333 To allow the merge to work properly, apply a @code{\shift} to the note that
334 should not be merged. In the first measure of following example,
335 @code{merge-differently-headed} does not work (the half-note head is
336 solid). In the second measure, @code{\shiftOn} is applied to move the
337 top @code{g} out of the column, and @code{merge-differently-headed}
340 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
341 \override Staff.NoteCollision #'merge-differently-headed = ##t
344 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
345 { \voiceFour e,,2 e'2}
348 { d'=''2 \shiftOn g2 } \\
349 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
350 { \voiceFour e,,2 e'2}
363 @funindex \voiceThree
375 @code{\shiftOff}: these commands specify the
376 degree to which chords of the current voice should be shifted.
377 The outer voices (normally: voice one and
378 two) have @code{\shiftOff}, while the inner voices (three and four)
379 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
380 further shift levels.
382 When LilyPond cannot cope, the @code{force-hshift}
383 property of the @internalsref{NoteColumn} object and pitched rests can
384 be used to override typesetting decisions.
386 @lilypond[quote,verbatim,ragged-right]
393 \once \override NoteColumn #'force-hshift = #1.7
401 Program reference: the objects responsible for resolving collisions are
402 @internalsref{NoteCollision} and @internalsref{RestCollision}.
407 When using @code{merge-differently-headed} with an upstem eighth or a
408 shorter note, and a downstem half note, the eighth note gets the wrong
411 There is no support for clusters where the same note occurs with
412 different accidentals in the same chord. In this case, it is
413 recommended to use enharmonic transcription, or to use special cluster
414 notation (see @ref{Clusters}).
419 @section Staff notation
421 @cindex Staff notation
423 This section describes music notation that occurs on staff level,
424 such as key signatures, clefs and time signatures.
432 * System start delimiters::
434 * Writing music in parallel::
438 @anchor{System start delimiters}
439 @unnumberedsubsubsec System start delimiters
441 @cindex start of system
442 @cindex Staff, multiple
443 @cindex bracket, vertical
444 @cindex brace, vertical
449 Many scores consist of more than one staff. These staves can be
450 joined in four different ways
453 @item The group is started with a brace at the left, and bar lines are
454 connected. This is done with the @internalsref{GrandStaff} context.
456 @lilypond[verbatim,ragged-right,quote]
464 @item The group is started with a bracket, and bar lines are connected.
465 This is done with the
466 @internalsref{StaffGroup} context
468 @lilypond[verbatim,ragged-right,quote]
476 @item The group is started with a bracket, but bar lines are not
477 connected. This is done with the @internalsref{ChoirStaff} context.
479 @lilypond[verbatim,ragged-right,quote]
487 @item The group is started with a vertical line. Bar lines are not
488 connected. This is the default for the score.
490 @lilypond[verbatim,ragged-right,quote]
501 The bar lines at the start of each system are
502 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
503 @internalsref{SystemStartBracket}. Only one of these types is created
504 in every context, and that type is determined by the property
505 @code{systemStartDelimiter}.
510 System start delimiters may be deeply nested,
512 @lilypond[quote,ragged-right,verbatim]
515 \set StaffGroup.systemStartDelimiterHierarchy
516 = #'(SystemStartSquare (SystemStartBracket a (SystemStartSquare b)) d)
526 @anchor{Staff symbol}
527 @unnumberedsubsubsec Staff symbol
529 @cindex adjusting staff symbol
531 Notes, dynamic signs, etc., are grouped
532 with a set of horizontal lines, called a staff (plural @q{staves}). In
533 LilyPond, these lines are drawn using a separate layout object called
536 The staff symbol may be tuned in the number, thickness and distance
537 of lines, using properties. This is demonstrated in the example files
538 @lsr{staff,changing-the-number-of-lines-in-a-staff.ly} and
539 @lsr{staff,changing-the-staff-size.ly}.
541 In addition, staves may be started and stopped at will. This is done
542 with @code{\startStaff} and @code{\stopStaff}.
544 @lilypond[verbatim,relative=2,fragment]
546 \override Staff.StaffSymbol #'line-count = 2
547 \stopStaff \startStaff
549 \revert Staff.StaffSymbol #'line-count
550 \stopStaff \startStaff
554 In combination with Frenched staves, this may be used to typeset ossia
555 sections. An example is shown here
559 @lilypondfile{ossia.ly}
561 @cindex staff lines, setting number of
562 @cindex staff lines, setting thickness of
563 @cindex thickness of staff lines, setting
564 @cindex number of staff lines, setting
568 Program reference: @internalsref{StaffSymbol}.
570 Examples: @lsrdir{staff}
573 @anchor{Writing music in parallel}
574 @unnumberedsubsubsec Writing music in parallel
576 @cindex Writing music in parallel
577 @cindex Interleaved music
579 Music for multiple parts can be interleaved
581 @lilypond[quote,fragment,verbatim]
582 \parallelMusic #'(voiceA voiceB) {
583 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
585 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
589 \new Staff \new Voice \voiceA
590 \new Staff \new Voice \voiceB
594 This works quite well for piano music
596 @lilypond[quote,verbatim]
600 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
602 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c''
605 r8 a16[ d'] f'[ a d' f'] r8 a16[ d'] f'[ a d' f'] |
609 a'8 b' c'' d'' e'' f'' g'' a'' |
611 c16 d e f d e f g e f g a f g a b |
637 @node Connecting notes
638 @section Connecting notes
640 This section deals with notation that affects groups of notes.
646 * Laissez vibrer ties::
654 @node Expressive marks old
655 @section Expressive marks old
657 Expressive marks help musicians to bring more to the music than simple
662 * Fingering instructions::
672 @anchor{Fingering instructions}
673 @unnumberedsubsubsec Fingering instructions
676 @cindex finger change
678 Fingering instructions can be entered using
680 @var{note}-@var{digit}
682 For finger changes, use markup texts
684 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
686 c^\markup { \finger "2 - 3" }
689 You can use the thumb-script to indicate that a note should be
690 played with the thumb (e.g., in cello music)
691 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
692 <a_\thumb a'-3>8 <b_\thumb b'-3>
695 Fingerings for chords can also be added to individual notes
696 of the chord by adding them after the pitches
697 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
704 You may exercise greater control over fingering chords by
705 setting @code{fingeringOrientations}
707 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
708 \set fingeringOrientations = #'(left down)
709 <c-1 es-2 g-4 bes-5 > 4
710 \set fingeringOrientations = #'(up right down)
711 <c-1 es-2 g-4 bes-5 > 4
714 Using this feature, it is also possible to put fingering instructions
715 very close to note heads in monophonic music,
717 @lilypond[verbatim,ragged-right,quote,fragment]
718 \set fingeringOrientations = #'(right)
725 Program reference: @internalsref{Fingering}.
727 Examples: @lsr{expressive,fingering-chords.ly}
734 Repetition is a central concept in music, and multiple notations exist
741 * Manual repeat commands::
743 * Tremolo subdivisions::
748 @anchor{Repeat types}
749 @unnumberedsubsubsec Repeat types
753 The following types of repetition are supported
757 Repeated music is fully written (played) out. This is useful when
758 entering repetitious music. This is the only kind of repeat that
759 is included in MIDI output.
762 Repeats are not written out, but alternative endings (volte) are
763 printed, left to right with brackets. This is the standard notation
764 for repeats with alternatives. These are not played in MIDI output by
769 Make tremolo beams. These are not played in MIDI output by default.
772 Make beat or measure repeats. These look like percent signs. These
773 are not played in MIDI output by default. Percent repeats must be
774 declared within a @code{Voice} context.
779 @anchor{Repeat syntax}
780 @unnumberedsubsubsec Repeat syntax
784 @cindex seconda volta
787 LilyPond has one syntactic construct for specifying different types of
788 repeats. The syntax is
791 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
794 If you have alternative endings, you may add
795 @funindex \alternative
806 where each @var{alternative} is a music expression. If you do not
807 give enough alternatives for all of the repeats, the first alternative
808 is assumed to be played more than once.
810 Standard repeats are used like this
812 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
814 \repeat volta 2 { c4 d e f }
815 \repeat volta 2 { f e d c }
818 With alternative endings
820 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
822 \repeat volta 2 {c4 d e f}
823 \alternative { {d2 d} {f f,} }
826 Repeats with upbeats may be created.
828 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
831 \repeat volta 4 { c2 d2 | e2 f2 | }
832 \alternative { { g4 g g e } { a a a a | b2. } }
839 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
842 \repeat volta 4 { e | c2 d2 | e2 f2 | }
843 \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
851 Ties may be added to a second ending,
853 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
855 \repeat volta 2 {c4 d e f ~ }
856 \alternative { {f2 d} {f\repeatTie f,} }
859 It is possible to shorten volta brackets
860 by setting @code{voltaSpannerDuration}. In the next example, the
861 bracket only lasts one measure, which is a duration of 3/4.
863 @lilypond[verbatim,ragged-right,quote]
867 \set Score.voltaSpannerDuration = #(ly:make-moment 3 4)
868 \repeat volta 5 { d d d }
869 \alternative { { e e e f f f }
874 If you want to start a repeat at the beginning of a line and have a
875 double bar at the end of the previous line, use
877 @dots{} \bar "||:" \break
878 \repeat volta 2 @{ @dots{}
880 see @ref{Bar lines} for more information.
884 Program reference: @internalsref{VoltaBracket},
885 @internalsref{RepeatedMusic},
886 @internalsref{VoltaRepeatedMusic}, and
887 @internalsref{UnfoldedRepeatedMusic}.
891 Brackets for the repeat are normally only printed over the topmost
892 staff. This can be adjusted by moving @code{Volta_engraver} to the
893 Staff context where you want the brackets to appear;
894 see @ref{Modifying context plug-ins} and
896 @lsr{repeats,volta@/-multi@/-staff@/.ly}.
901 @cindex repeat, ambiguous
912 is ambiguous, since it is is not clear to which @code{\repeat} the
913 @code{\alternative} belongs. This ambiguity is resolved by always
914 having the @code{\alternative} belong to the inner @code{\repeat}.
915 For clarity, it is advisable to use braces in such situations.
917 Timing information is not remembered at the start of an alternative,
918 so after a repeat timing information must be reset by hand; for
919 example, by setting @code{Score.measurePosition} or entering
920 @code{\partial}. Similarly, slurs or ties are also not repeated.
923 @anchor{Repeats and MIDI}
924 @unnumberedsubsubsec Repeats and MIDI
926 @cindex expanding repeats
927 @funindex \unfoldRepeats
929 With a little bit of tweaking, all types of repeats can be present
930 in the MIDI output. This is achieved by applying the
931 @code{\unfoldRepeats} music function. This function changes all
932 repeats to unfold repeats.
934 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
936 \repeat tremolo 8 {c'32 e' }
937 \repeat percent 2 { c''8 d'' }
938 \repeat volta 2 {c'4 d' e' f'}
947 When creating a score file using @code{\unfoldRepeats} for MIDI,
948 it is necessary to make two @code{\score} blocks: one for MIDI (with
949 unfolded repeats) and one for notation (with volta, tremolo, and
950 percent repeats). For example,
958 \unfoldRepeats @var{..music..}
964 @anchor{Manual repeat commands}
965 @unnumberedsubsubsec Manual repeat commands
967 @funindex repeatCommands
969 The property @code{repeatCommands} can be used to control the layout of
970 repeats. Its value is a Scheme list of repeat commands.
973 @item @code{start-repeat}
974 Print a @code{|:} bar line.
976 @item @code{end-repeat}
977 Print a @code{:|} bar line.
979 @item @code{(volta @var{text})}
980 Print a volta bracket saying @var{text}: The text can be specified as
981 a text string or as a markup text, see @ref{Text markup}. Do not
982 forget to change the font, as the default number font does not contain
983 alphabetic characters;
985 @item @code{(volta #f)}
986 Stop a running volta bracket.
989 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
991 \set Score.repeatCommands = #'((volta "93") end-repeat)
993 \set Score.repeatCommands = #'((volta #f))
1000 Program reference: @internalsref{VoltaBracket},
1001 @internalsref{RepeatedMusic},
1002 @internalsref{VoltaRepeatedMusic}, and
1003 @internalsref{UnfoldedRepeatedMusic}.
1006 @anchor{Tremolo repeats}
1007 @unnumberedsubsubsec Tremolo repeats
1009 @cindex tremolo beams
1011 To place tremolo marks between notes, use @code{\repeat} with tremolo
1013 @lilypond[quote,verbatim,ragged-right]
1014 \new Voice \relative c' {
1015 \repeat tremolo 8 { c16 d16 }
1016 \repeat tremolo 4 { c16 d16 }
1017 \repeat tremolo 2 { c16 d16 }
1021 Tremolo marks can also be put on a single note. In this case, the
1022 note should not be surrounded by braces.
1023 @lilypond[quote,verbatim,ragged-right]
1024 \repeat tremolo 4 c'16
1027 Similar output is obtained using the tremolo subdivision, described in
1028 @ref{Tremolo subdivisions}.
1033 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
1035 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
1038 @anchor{Tremolo subdivisions}
1039 @unnumberedsubsubsec Tremolo subdivisions
1041 @cindex tremolo marks
1042 @funindex tremoloFlags
1044 Tremolo marks can be printed on a single note by adding
1045 @q{@code{:}[@var{number}]} after the note. The number indicates the
1046 duration of the subdivision, and it must be at least 8. A
1047 @var{length} value of 8 gives one line across the note stem. If the
1048 length is omitted, the last value (stored in @code{tremoloFlags}) is
1051 @lilypond[quote,ragged-right,verbatim,fragment]
1052 c'2:8 c':32 | c': c': |
1058 Tremolos entered in this way do not carry over into the MIDI output.
1063 In this manual: @ref{Tremolo repeats}.
1065 Elsewhere: @internalsref{StemTremolo}.
1068 @anchor{Measure repeats}
1069 @unnumberedsubsubsec Measure repeats
1071 @cindex percent repeats
1072 @cindex measure repeats
1074 In the @code{percent} style, a note pattern can be repeated. It is
1075 printed once, and then the pattern is replaced with a special sign.
1076 Patterns of one and two measures are replaced by percent-like signs,
1077 patterns that divide the measure length are replaced by slashes.
1078 Percent repeats must be declared within a @code{Voice} context.
1080 @lilypond[quote,verbatim,ragged-right]
1081 \new Voice \relative c' {
1082 \repeat percent 4 { c4 }
1083 \repeat percent 2 { c2 es2 f4 fis4 g4 c4 }
1087 Measure repeats of more than 2 measures get a counter, if you switch
1088 on the @code{countPercentRepeats} property,
1090 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
1092 \set countPercentRepeats = ##t
1093 \repeat percent 4 { c1 }
1099 Isolated percents can also be printed. This is done by putting a
1100 multi-measure rest with a different print function,
1102 @lilypond[fragment,verbatim,quote]
1103 \override MultiMeasureRest #'stencil
1104 = #ly:multi-measure-rest::percent
1113 Program reference: @internalsref{RepeatSlash},
1114 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
1115 @internalsref{DoublePercentRepeatCounter},
1116 @internalsref{PercentRepeatCounter},
1117 @internalsref{PercentRepeatedMusic}.