1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
4 @c A menu is needed before every deeper *section nesting of @node's; run
5 @c M-x texinfo-all-menus-update
6 @c to automatically fill in these menus before saving changes
9 @chapter Basic notation
11 This chapter explains how to use basic notation features.
16 * Multiple notes at once::
28 This section discusses how to specify the pitch of notes.
33 * Cautionary accidentals::
35 * Notes names in other languages::
45 @subsection Normal pitches
50 A pitch name is specified using lowercase letters @code{a} through @code{g}.
51 An ascending C-major scale is engraved with
53 @lilypond[quote,fragment,verbatim,ragged-right]
58 The note name @code{c} is engraved one octave below middle C.
60 @lilypond[quote,fragment,verbatim,ragged-right]
70 The optional octave specification takes the form of a series of
71 single quote (`@code{'}') characters or a series of comma
72 (`@code{,}') characters. Each @code{'} raises the pitch by one
73 octave; each @code{,} lowers the pitch by an octave.
75 @lilypond[quote,ragged-right,fragment,verbatim]
77 c' c'' e' g d'' d' d c
79 c, c,, e, g d,, d, d c
82 An alternate method may be used to declare which octave to
83 engrave a pitch; this method does not require as many
84 octave specifications (@code{'} and @code{,}). See
85 @ref{Relative octaves}.
89 @subsection Accidentals
91 @cindex note names, Dutch
92 @cindex note names, default
94 A sharp is formed by adding @code{-is} to the end of a pitch name and
95 a flat is formed by adding @code{-es}. Double sharps and double flats
96 are obtained by adding @code{-isis} or @code{-eses} to a note name.
98 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
104 These are the Dutch note names. In Dutch, @code{aes} is contracted to
105 @code{as}, but both forms are accepted. Similarly, both
106 @code{es} and @code{ees} are accepted
108 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
112 A natural will cancel the effect of an accidental or key signature.
113 However, naturals are not encoded into the note name syntax with a
114 suffix; a natural pitch is shown as a simple note name
116 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
120 The input @code{d e f} is interpreted as ``print a D-natural,
121 E-natural, and an F-natural,'' regardless of the key
122 signature. For more information about the distinction between
123 musical content and the presentation of that content, see
124 @ref{More about pitches}.
126 @lilypond[fragment,quote,ragged-right,verbatim,relative]
135 In accordance with standard typesetting rules, a natural sign is printed
136 before a sharp or flat if a previous accidental needs to be
137 cancelled. To change this behavior, use
138 @code{\set Staff.extraNatural = ##f}
140 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
142 \set Staff.extraNatural = ##f
149 Program reference: @internalsref{LedgerLineSpanner},
150 @internalsref{NoteHead}.
153 @node Cautionary accidentals
154 @subsection Cautionary accidentals
156 @cindex accidental, reminder
157 @cindex accidental, cautionary
158 @cindex accidental, parenthesized
159 @cindex reminder accidental
161 @cindex cautionary accidental
162 @cindex parenthesized accidental
165 Normally accidentals are printed automatically, but you may also
166 print them manually. A reminder accidental
167 can be forced by adding an exclamation mark @code{!}
168 after the pitch. A cautionary accidental
169 (i.e., an accidental within parentheses) can be obtained by adding the
170 question mark `@code{?}' after the pitch. These extra accidentals
171 can be used to produce natural signs, too.
173 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
174 cis cis cis! cis? c c? c! c
180 The automatic production of accidentals can be tuned in many
181 ways. For more information, see @ref{Automatic accidentals}.
185 @subsection Micro tones
187 @cindex quarter tones
188 @cindex semi-flats, semi-sharps
190 Half-flats and half-sharps are formed by adding @code{-eh} and
191 @code{-ih}; the following is a series of Cs with increasing pitches
193 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
194 \set Staff.extraNatural = ##f
198 Micro tones are also exported to the MIDI file.
203 There are no generally accepted standards for denoting
204 three-quarter flats, so LilyPond's symbol does not conform to any
208 @node Notes names in other languages
209 @subsection Notes names in other languages
211 There are predefined sets of note names for various other languages.
212 To use them, include the language specific init file. For
213 example, add @code{\include "english.ly"} to the top of the input
214 file. The available language files
215 and the note names they define are
217 @c what about micro-tunes, double-sharps, and double-flats? add
218 @c more columns to the table?
219 @c Oh, and should this be made into a multitable?
220 @cindex note names, other languages
222 Note Names sharp flat
223 nederlands.ly c d e f g a bes b -is -es
224 english.ly c d e f g a bf b -s/-sharp -f/-flat
226 deutsch.ly c d e f g a b h -is -es
227 norsk.ly c d e f g a b h -iss/-is -ess/-es
228 svenska.ly c d e f g a b h -iss -ess
229 italiano.ly do re mi fa sol la sib si -d -b
230 catalan.ly do re mi fa sol la sib si -d/-s -b
231 espanol.ly do re mi fa sol la sib si -s -b
235 @node Relative octaves
236 @subsection Relative octaves
239 @cindex Relative octave specification
242 Octaves are specified by adding @code{'} and @code{,} to pitch names.
243 When you copy existing music, it is easy to accidentally put a pitch
244 in the wrong octave and hard to find such an error. The relative
245 octave mode prevents these errors by making the mistakes much
246 larger: a single error puts the rest of the piece off by one octave
249 \relative @var{startpitch} @var{musicexpr}
256 \relative @var{musicexpr}
260 @code{c'} is used as the default if no starting pitch is defined.
262 The octave of notes that appear in @var{musicexpr} are calculated as
263 follows: if no octave changing marks are used, the basic interval
264 between this and the last note is always taken to be a fourth or
265 less. This distance is determined without regarding alterations; a
266 @code{fisis} following a @code{ceses} will be put above the
267 @code{ceses}. In other words, a doubly-augmented fourth is considered
268 a smaller interval than a diminished fifth, even though the
269 doubly-augmented fourth spans seven semitones while the diminished
270 fifth only spans six semitones.
272 The octave changing marks @code{'} and @code{,} can be added to raise
273 or lower the pitch by an extra octave. Upon entering relative mode,
274 an absolute starting pitch can be specified that will act as the
275 predecessor of the first note of @var{musicexpr}. If no starting pitch
276 is specified, then middle C is used as a start.
278 Here is the relative mode shown in action
279 @lilypond[quote,fragment,ragged-right,verbatim]
285 Octave changing marks are used for intervals greater than a fourth
287 @lilypond[quote,ragged-right,fragment,verbatim]
293 If the preceding item is a chord, the first note of the chord is used
294 to determine the first note of the next chord
296 @lilypond[quote,ragged-right,fragment,verbatim]
304 The pitch after @code{\relative} contains a note name.
306 The relative conversion will not affect @code{\transpose},
307 @code{\chordmode} or @code{\relative} sections in its argument. To use
308 relative within transposed music, an additional @code{\relative} must
309 be placed inside @code{\transpose}.
313 @subsection Octave check
317 Octave checks make octave errors easier to correct: a note may be
318 followed by @code{=}@var{quotes} which indicates what its absolute
319 octave should be. In the following example,
322 \relative c'' @{ c='' b=' d,='' @}
326 the @code{d} will generate a warning, because a @code{d''} is expected
327 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
328 found. In the output, the octave is corrected to be a @code{d''} and
329 the next note is calculated relative to @code{d''} instead of @code{d'}.
331 There is also an octave check that produces no visible output. The syntax
337 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
338 quotes) in @code{\relative} mode. If not, a warning is printed, and the
339 octave is corrected. The @var{pitch} is not printed as a note.
341 In the example below, the first check passes without incident, since
342 the @code{e} (in @code{relative} mode) is within a fifth of
344 the second check produces a warning, since the @code{e} is not within
345 a fifth of @code{b'}. The warning message is printed, and the octave
346 is adjusted so that the following notes are in the correct octave
358 The octave of a note following an octave check is determined with
359 respect to the note preceding it. In the next fragment, the last note
360 is an @code{a'}, above middle C. That means that the @code{\octave}
361 check passes successfully, so the check could be deleted without changing
362 the output of the piece.
364 @lilypond[quote,ragged-right,verbatim,fragment]
374 @subsection Transpose
377 @cindex Transposition of pitches
380 A music expression can be transposed with @code{\transpose}. The
383 \transpose @var{from} @var{to} @var{musicexpr}
386 This means that @var{musicexpr} is transposed by the interval between
387 the pitches @var{from} and @var{to}: any note with pitch @code{from}
388 is changed to @code{to}.
390 For example, consider a piece written in the key of D-major. If
391 this piece is a little too low for its performer, it can be
392 transposed up to E-major with
394 \transpose d e @dots{}
397 Consider a part written for violin (a C instrument). If
398 this part is to be played on the A clarinet (for which an
399 A is notated as a C, and which sounds a minor third lower
400 than notated), the following
401 transposition will produce the appropriate part
404 \transpose a c @dots{}
407 @code{\transpose} distinguishes between enharmonic pitches: both
408 @code{\transpose c cis} or @code{\transpose c des} will transpose up
409 half a tone. The first version will print sharps and the second
410 version will print flats
412 @lilypond[quote,ragged-right,verbatim]
413 mus = { \key d \major cis d fis g }
422 @code{\transpose} may also be used to input written notes for a
423 transposing instrument. Pitches are normally entered into LilyPond
424 in C (or ``concert pitch''), but they may be entered in another
425 key. For example, when entering music for a B-flat trumpet which
426 begins on concert D, one would write
429 \transpose c bes @{ e4 @dots{} @}
432 To print this music in B-flat again (i.e., producing a trumpet part,
433 instead of a concert pitch conductor's score) you would wrap the
434 existing music with another @code{transpose}
437 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
443 Program reference: @internalsref{TransposedMusic}.
448 If you want to use both @code{\transpose} and @code{\relative},
449 you must put @code{\transpose} outside of @code{\relative}, since
450 @code{\relative} will have no effect on music that appears inside a
461 Rests are entered like notes with the note name @code{r}
463 @lilypond[fragment,quote,ragged-right,verbatim]
467 Whole bar rests, centered in middle of the bar,
468 must be done with multi-measure rests. They can be used for a
469 single bar as well as many bars, and are discussed in
470 @ref{Multi measure rests}.
472 To explicitly specify a rest's vertical position, write a note
473 followed by @code{\rest}. A rest will be placed in the position
474 where the note would appear,
476 @lilypond[fragment,quote,ragged-right,verbatim]
481 This makes manual formatting of
482 polyphonic music much easier, since the automatic rest collision
483 formatter will leave these rests alone.
487 Program reference: @internalsref{Rest}.
494 @cindex Invisible rest
499 An invisible rest (also called a `skip') can be entered like a note
500 with note name `@code{s}' or with @code{\skip @var{duration}}
502 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
503 a4 a4 s4 a4 \skip 1 a4
506 The @code{s} syntax is only available in note mode and chord mode. In
507 other situations, for example, when entering lyrics, you should use
508 the @code{\skip} command
510 @lilypond[quote,ragged-right,verbatim]
513 \new Lyrics \lyricmode { \skip 2 bla2 }
517 The skip command is merely an empty musical placeholder. It does not
518 produce any output, not even transparent output.
520 The @code{s} skip command does create @internalsref{Staff} and
521 @internalsref{Voice} when necessary, similar to note and rest
522 commands. For example, the following results in an empty staff.
524 @lilypond[quote,ragged-right,verbatim]
528 The fragment @code{@{ \skip 4 @} } would produce an empty page.
532 Program reference: @internalsref{SkipMusic}.
539 This section discusses rhythms, durations, and bars.
543 * Augmentation dots::
545 * Scaling durations::
548 * Automatic note splitting::
553 @subsection Durations
560 In Note, Chord, and Lyrics mode, durations are designated by numbers and
561 dots: durations are entered as their reciprocal values. For example, a
562 quarter note is entered using a @code{4} (since it is a 1/4 note), while
563 a half note is entered using a @code{2} (since it is a 1/2 note). For
564 notes longer than a whole you must use the @code{\longa} and
565 @code{\breve} commands
569 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
571 r1 r2 r4 r8 r16 r32 r64 r64
577 a\breve*1/2 \autoBeamOff
578 a1 a2 a4 a8 a16 a32 a64 a64
581 r\longa*1/4 r\breve *1/2
582 r1 r2 r4 r8 r16 r32 r64 r64
589 \remove "Bar_number_engraver"
593 \remove "Clef_engraver"
594 \override StaffSymbol #'transparent = ##t
595 \override TimeSignature #'transparent = ##t
596 \override BarLine #'transparent = ##t
597 \consists "Pitch_squash_engraver"
603 If the duration is omitted then it is set to the previously entered
604 duration. The default for the first note is a quarter note.
606 @lilypond[quote,ragged-right,verbatim,fragment]
607 { a a a2 a a4 a a1 a }
611 @node Augmentation dots
612 @subsection Augmentation dots
616 To obtain dotted note lengths, simply add a dot (`@code{.}') to
617 the number. Double-dotted notes are produced in a similar way.
619 @lilypond[quote,ragged-right,fragment,verbatim]
620 a'4 b' c''4. b'8 a'4. b'4.. c''8.
625 Dots are normally moved up to avoid staff lines, except in polyphonic
626 situations. The following commands may be used to force a particular
633 @funindex \dotsNeutral
638 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
648 Tuplets are made out of a music expression by multiplying all durations
652 \times @var{fraction} @var{musicexpr}
656 The duration of @var{musicexpr} will be multiplied by the fraction.
657 The fraction's denominator will be printed over the notes, optionally
658 with a bracket. The most common tuplet is the triplet in which 3
659 notes have the length of 2, so the notes are 2/3 of their written
662 @lilypond[quote,ragged-right,fragment,verbatim]
663 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
666 Tuplets may be nested, for example,
668 @lilypond[fragment,ragged-right,verbatim,relative=2]
669 \set tupletNumberFormatFunction = #fraction-tuplet-formatter
672 \times 3/5 { a a a a a }
680 @funindex \tupletDown
682 @funindex \tupletNeutral
683 @code{\tupletNeutral}.
688 @funindex tupletNumberFormatFunction
689 @cindex tuplet formatting
691 The property @code{tupletSpannerDuration} specifies how long each
692 bracket should last. With this, you can make lots of tuplets while
693 typing @code{\times} only once, thus saving lots of typing. In the next
694 example, there are two triplets shown, while @code{\times} was only
697 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
698 \set tupletSpannerDuration = #(ly:make-moment 1 4)
699 \times 2/3 { c8 c c c c c }
703 For more information about @code{make-moment}, see
704 @ref{Time administration}.
706 The format of the number is determined by the property
707 @code{tupletNumberFormatFunction}. The default prints only the
708 denominator, but if it is set to the Scheme function
709 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
712 To avoid printing tuplet numbers, use
714 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
715 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
716 \override TupletNumber #'transparent = ##t
717 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
723 Program reference: @internalsref{TupletBracket},
724 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
726 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
730 @node Scaling durations
731 @subsection Scaling durations
733 You can alter the length of duration by a fraction @var{N/M}
734 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
735 will not affect the appearance of the notes or rests produced.
737 In the following example, the first three notes take up exactly two
738 beats, but no triplet bracket is printed.
739 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
741 a4*2/3 gis4*2/3 a4*2/3
749 This manual: @ref{Tuplets}
753 @subsection Bar check
756 @funindex barCheckSynchronize
759 Bar checks help detect errors in the durations. A bar check is
760 entered using the bar symbol, `@code{|}'. Whenever it is encountered
761 during interpretation, it should fall on a measure boundary. If it
762 does not, a warning is printed. In the next example, the second bar
763 check will signal an error
765 \time 3/4 c2 e4 | g2 |
768 Bar checks can also be used in lyrics, for example
773 Twin -- kle | Twin -- kle
777 Failed bar checks are caused by entering incorrect
778 durations. Incorrect durations often completely garble up the score,
779 especially if the score is polyphonic, so a good place to start correcting
780 input is by scanning for failed bar checks and incorrect durations.
785 It is also possible to redefine the meaning of @code{|}. This is done
786 by assigning a music expression to @code{pipeSymbol},
788 @lilypond[quote,ragged-right,verbatim]
789 pipeSymbol = \bar "||"
795 @node Barnumber check
796 @subsection Barnumber check
798 When copying large pieces of music, it can be helpful to check that
799 the LilyPond bar number corresponds to the original that you are
800 entering from. This can be checked with @code{\barNumberCheck}, for
808 will print a warning if the @code{currentBarNumber} is not 123 when it
812 @node Automatic note splitting
813 @subsection Automatic note splitting
815 Long notes can be converted automatically to tied notes. This is done
816 by replacing the @internalsref{Note_heads_engraver} by the
817 @internalsref{Completion_heads_engraver}.
818 In the following examples, notes crossing the bar line are split and tied.
820 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
822 \remove "Note_heads_engraver"
823 \consists "Completion_heads_engraver"
825 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
829 This engraver splits all running notes at the bar line, and inserts
830 ties. One of its uses is to debug complex scores: if the measures are
831 not entirely filled, then the ties exactly show how much each measure
837 Not all durations (especially those containing tuplets) can be
838 represented exactly with normal notes and dots, but the engraver will
841 @code{Completion_heads_engraver} only affects notes; it does not split
847 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
851 Program reference: @internalsref{Completion_heads_engraver}.
854 @node Multiple notes at once
855 @section Multiple notes at once
857 Polyphony in music refers to having more than one voice occurring in
858 a piece of music. Polyphony in LilyPond refers to having more than
859 one voice on the same staff.
865 * Explicitly instantiating voices::
866 * Collision Resolution::
875 A chord is formed by a enclosing a set of pitches between @code{<}
876 and @code{>}. A chord may be followed by a duration, and a set of
877 articulations, just like simple notes
879 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
883 For more information about chords, see @ref{Chord names}.
889 Whenever a note is found, a @internalsref{Stem} object is created
890 automatically. For whole notes and rests, they are also created but
899 @funindex \stemNeutral
905 To change the direction of stems in the middle of the staff, use
907 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
909 \override Stem #'neutral-direction = #up
911 \override Stem #'neutral-direction = #down
916 @node Basic polyphony
917 @subsection Basic polyphony
921 The easiest way to enter fragments with more than one voice on a staff
922 is to enter each voice as a sequence (with @code{@{...@}}), and combine
923 them simultaneously, separating the voices with @code{\\}
927 @lilypond[quote,verbatim,fragment]
928 \new Staff \relative c' {
931 { g4 f e | d2 e2 } \\
932 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
938 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
939 voices are sometimes called ``layers'' in other notation packages}
941 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
942 each of these contexts, vertical direction of slurs, stems, etc., is set
945 These voices are all separate from the voice that contains the notes just
946 outside the @code{<< \\ >>} construct. This should be noted when making
947 changes at the voice level. This also means that slurs and ties cannot go
948 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
949 from separate @code{<< \\ >>} constructs on the same staff are the the
950 same voice. Here is the same example, with different noteheads for each
951 voice. Note that the change to the note-head style in the main voice does
953 the inside of the @code{<< \\ >>} constructs. Also, the change to the
955 voice in the first @code{<< \\ >>} construct is effective in the second
956 @code{<< \\ >>}, and the voice is tied across the two constructs.
958 @cindex note heads, styles
960 @lilypond[quote,verbatim,fragment]
961 \new Staff \relative c' {
962 \override NoteHead #'style = #'cross
966 { \override NoteHead #'style = #'triangle
971 { c8 b16 a b8 g ~ g2 } \\
972 { \override NoteHead #'style = #'slash s4 b4 c2 }
977 Polyphony does not change the relationship of notes within a
978 @code{\relative @{ @}} block. Each note is calculated relative
979 to the note immediately preceding it.
982 \relative @{ noteA << noteB \\ noteC >> noteD @}
985 @code{noteC} is relative to @code{noteB}, not @code{noteA};
986 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
989 @node Explicitly instantiating voices
990 @subsection Explicitly instantiating voices
992 @internalsref{Voice} contexts can also be instantiated manually
993 inside a @code{<< >>} block to create polyphonic music, using
994 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
995 and a horizontal shift for each part.
999 << \upper \\ \lower >>
1007 \new Voice = "1" @{ \voiceOne \upper @}
1008 \new Voice = "2" @{ \voiceTwo \lower @}
1012 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1013 articulations, text annotations, augmentation dots of dotted
1014 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
1015 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1016 make them point downwards.
1017 The command @code{\oneVoice} will revert back to the normal setting.
1019 An expression that appears directly inside a @code{<< >>} belongs to
1020 the main voice. This is useful when extra voices appear while the main
1021 voice is playing. Here is a more correct rendition of the example from
1022 the previous section. The crossed noteheads demonstrate that the main
1023 melody is now in a single voice context.
1025 @lilypond[quote,ragged-right,verbatim]
1026 \new Staff \relative c' {
1027 \override NoteHead #'style = #'cross
1032 \new Voice="1" { \voiceTwo
1033 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1036 \new Voice { \voiceThree
1045 The correct definition of the voices allows the melody to be slurred.
1046 @lilypond[quote,ragged-right,verbatim]
1047 \new Staff \relative c' {
1052 \context Voice="1" { \voiceTwo
1053 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1056 \new Voice { \voiceThree
1065 Avoiding the @code{\\} separator also allows nesting polyphony
1066 constructs, which in some case might be a more natural way to typeset
1069 @lilypond[quote,ragged-right,verbatim]
1070 \new Staff \relative c' {
1075 \context Voice="1" { \voiceTwo
1078 {c8 b16 a b8 g ~ g2}
1079 \new Voice { \voiceThree
1092 @node Collision Resolution
1093 @subsection Collision Resolution
1095 Normally, note heads with a different number of dots are not merged, but
1096 when the object property @code{merge-differently-dotted} is set in
1097 the @internalsref{NoteCollision} object, they are merged
1098 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1101 \override Staff.NoteCollision
1102 #'merge-differently-dotted = ##t
1104 } \\ { g8.[ f16] g8.[ f16] } >>
1107 Similarly, you can merge half note heads with eighth notes, by setting
1108 @code{merge-differently-headed}
1109 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1112 \override Staff.NoteCollision
1113 #'merge-differently-headed = ##t
1114 c8 c4. } \\ { c2 c2 } >>
1117 LilyPond also vertically shifts rests that are opposite of a stem,
1120 @lilypond[quote,ragged-right,fragment,verbatim]
1121 \new Voice << c''4 \\ r4 >>
1133 @funindex \voiceThree
1135 @funindex \voiceFour
1142 @funindex \shiftOnnn
1145 @code{\shiftOff}: these commands specify in what chords of the current
1146 voice should be shifted. The outer voices (normally: voice one and
1147 two) have @code{\shiftOff}, while the inner voices (three and four)
1148 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
1149 further shift levels.
1151 When LilyPond cannot cope, the @code{force-hshift}
1152 property of the @internalsref{NoteColumn} object and pitched rests can
1153 be used to override typesetting decisions.
1155 @lilypond[quote,verbatim,ragged-right]
1162 \once \override NoteColumn #'force-hshift = #1.7
1170 Program reference: the objects responsible for resolving collisions are
1171 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1174 @inputfileref{input/@/regression,collision@/-dots@/.ly},
1175 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
1176 @inputfileref{input/@/regression,collision@/-heads@/.ly},
1177 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
1178 @inputfileref{input/@/regression,collisions@/.ly}.
1183 When using @code{merge-differently-headed} with an upstem eighth or a
1184 shorter note, and a downstem half note, the eighth note gets the wrong
1187 There is no support for clusters where the same note occurs with
1188 different accidentals in the same chord. In this case, it is
1189 recommended to use enharmonic transcription, or to use special cluster
1190 notation (see @ref{Clusters}).
1194 @node Staff notation
1195 @section Staff notation
1197 @cindex Staff notation
1199 This section describes music notation that occurs on staff level,
1200 such as key signatures, clefs and time signatures.
1206 * Partial measures::
1209 * System start delimiters::
1211 * Writing music in parallel::
1220 The clef indicates which lines of the staff correspond to which
1221 pitches. The clef is set with the @code{\clef} command
1223 @lilypond[quote,ragged-right,fragment,verbatim]
1224 { c''2 \clef alto g'2 }
1233 @cindex soprano clef
1234 @cindex mezzosoprano clef
1235 @cindex baritone clef
1236 @cindex varbaritone clef
1237 @cindex subbass clef
1239 Supported clefs include
1241 @multitable @columnfractions .33 .66
1242 @headitem Clef @tab Position
1243 @item @code{treble}, violin, G, G2 @tab
1245 @item @code{alto, C} @tab
1247 @item @code{tenor} @tab
1249 @item @code{bass, F} @tab
1251 @item @code{french} @tab
1252 G clef on 1st line, so-called French violin clef
1253 @item @code{soprano} @tab
1255 @item @code{mezzosoprano} @tab
1257 @item @code{baritone} @tab
1259 @item @code{varbaritone} @tab
1261 @item @code{subbass} @tab
1263 @item @code{percussion} @tab
1265 @item @code{tab} @tab
1269 By adding @code{_8} or @code{^8} to the clef name, the clef is
1270 transposed one octave down or up, respectively, and @code{_15} and
1271 @code{^15} transposes by two octaves. The argument @var{clefname}
1272 must be enclosed in quotes when it contains underscores or digits. For
1275 @cindex choral tenor clef
1276 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1283 The command @code{\clef "treble_8"} is equivalent to setting
1285 @code{clefPosition} (which controls the Y position of the clef),
1286 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1287 when any of these properties are changed. The following example shows
1288 possibilities when setting properties manually.
1290 @lilypond[quote,ragged-right,verbatim]
1292 \set Staff.clefGlyph = #"clefs.F"
1293 \set Staff.clefPosition = #2
1295 \set Staff.clefGlyph = #"clefs.G"
1297 \set Staff.clefGlyph = #"clefs.C"
1299 \set Staff.clefOctavation = #7
1301 \set Staff.clefOctavation = #0
1302 \set Staff.clefPosition = #0
1306 \set Staff.middleCPosition = #4
1314 Manual: @ref{Grace notes}.
1316 Program reference: @internalsref{Clef}.
1320 @subsection Key signature
1322 @cindex Key signature
1325 The key signature indicates the tonality in which a piece is played. It
1326 is denoted by a set of alterations (flats or sharps) at the start of the
1329 Setting or changing the key signature is done with the @code{\key}
1333 @code{\key} @var{pitch} @var{type}
1342 @funindex \mixolydian
1346 @cindex church modes
1348 Here, @var{type} should be @code{\major} or @code{\minor} to get
1349 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1350 use the standard mode names (also called ``church modes''): @code{\ionian},
1351 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1352 @code{\phrygian}, and @code{\dorian}.
1354 This command sets the context property
1355 @code{Staff.keySignature}. Non-standard key signatures
1356 can be specified by setting this property directly.
1358 Accidentals and key signatures often confuse new users, because
1359 unaltered notes get natural signs depending on the key signature. For
1360 more information, see @ref{Accidentals} or @ref{More about pitches}.
1362 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1371 A natural sign is printed to cancel any previous accidentals. This
1372 can be suppressed by setting the @code{Staff.printKeyCancellation}
1375 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1380 \set Staff.printKeyCancellation = ##f
1390 Program reference: @internalsref{KeyCancellation},
1391 @internalsref{KeySignature}.
1394 @node Time signature
1395 @subsection Time signature
1397 @cindex Time signature
1401 Time signature indicates the metrum of a piece: a regular pattern of
1402 strong and weak beats. It is denoted by a fraction at the start of the
1405 The time signature is set with the @code{\time} command
1407 @lilypond[quote,ragged-right,fragment,verbatim]
1408 \time 2/4 c'2 \time 3/4 c'2.
1413 The symbol that is printed can be customized with the @code{style}
1414 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1417 @lilypond[fragment,quote,ragged-right,verbatim]
1420 \override Staff.TimeSignature #'style = #'()
1425 There are many more options for its layout. See @ref{Ancient time
1426 signatures} for more examples.
1428 @code{\time} sets the property @code{timeSignatureFraction},
1429 @code{beatLength} and @code{measureLength} in the @code{Timing}
1430 context, which is normally aliased to @internalsref{Score}. The
1431 property @code{measureLength} determines where bar lines should be
1432 inserted, and how automatic beams should be generated. Changing the
1433 value of @code{timeSignatureFraction} also causes the symbol to be
1436 More options are available through the Scheme function
1437 @code{set-time-signature}. In combination with the
1438 @internalsref{Measure_grouping_engraver}, it will create
1439 @internalsref{MeasureGrouping} signs. Such signs ease reading
1440 rhythmically complex modern music. In the following example, the 9/8
1441 measure is subdivided in 2, 2, 2 and 3. This is passed to
1442 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1444 @lilypond[quote,ragged-right,verbatim]
1447 #(set-time-signature 9 8 '(2 2 2 3))
1448 g8[ g] d[ d] g[ g] a8[( bes g]) |
1449 #(set-time-signature 5 8 '(3 2))
1455 \consists "Measure_grouping_engraver"
1464 Program reference: @internalsref{TimeSignature}, and
1465 @internalsref{Timing_translator}.
1467 Examples: @inputfileref{input/@/test,compound@/-time@/.ly}.
1472 Automatic beaming does not use the measure grouping specified with
1473 @code{set-time-signature}.
1476 @node Partial measures
1477 @subsection Partial measures
1481 @cindex partial measure
1482 @cindex measure, partial
1483 @cindex shorten measures
1486 Partial measures, such as an anacrusis or upbeat, are entered using the
1488 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1489 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1492 The syntax for this command is
1495 \partial @var{duration}
1498 where @code{duration} is the rhythmic length to be added before
1501 This is internally translated into
1504 \set Timing.measurePosition = -@var{length of duration}
1507 The property @code{measurePosition} contains a rational number
1508 indicating how much of the measure has passed at this point. Note
1509 that this is a negative number; @code{\partial 4} is internally
1510 translated to mean ``there is a quarter note left in the bar''.
1515 This command does not take into account grace notes at the start of
1516 the music. When a piece starts with graces notes in the pickup, then
1517 the @code{\partial} should follow the grace notes
1519 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1528 @subsection Bar lines
1532 @cindex measure lines
1535 Bar lines delimit measures, but are also used to indicate
1536 repeats. Normally they are inserted automatically. Line
1537 breaks may only happen on bar lines.
1539 Special types of bar lines can be forced with the @code{\bar} command
1541 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1545 The following bar types are available
1547 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1549 In addition, you can specify @code{"||:"}, which is equivalent to
1550 @code{"|:"} except at line breaks, where it gives a double bar line at
1551 the end of the line and a start repeat at the beginning of the next
1554 To allow a line break where there is no visible bar line, use
1561 This will insert an invisible bar line and allow line breaks at this
1562 point. This also increases the bar number counter.
1564 In scores with many staves, a @code{\bar} command in one staff is
1565 automatically applied to all staves. The resulting bar lines are
1566 connected between different staves of a StaffGroup
1568 @lilypond[quote,ragged-right,fragment,verbatim]
1576 \new Staff { \clef bass c4 g e g }
1578 \new Staff { \clef bass c2 c2 }
1586 @funindex repeatCommands
1587 @funindex defaultBarType
1589 The command @code{\bar }@var{bartype} is a short cut for doing
1590 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1591 is set to a string, a bar line of that type is created.
1593 A bar line is created whenever the @code{whichBar} property is set.
1594 At the start of a measure it is set to the contents of
1595 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are
1597 to override default measure bars.
1599 You are encouraged to use @code{\repeat} for repetitions. See
1605 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1607 Program reference: @internalsref{BarLine} (created at
1608 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1610 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1613 @node Unmetered music
1614 @subsection Unmetered music
1617 @funindex \cadenzaOn
1618 @funindex \cadenzaOff
1620 Bar lines and bar numbers are calculated automatically. For unmetered
1621 music (cadenzas, for example), this is not desirable. To turn off
1622 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1623 and @code{\cadenzaOff}.
1625 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1637 LilyPond will only insert line breaks and page breaks at a
1638 barline. Unless the unmetered music ends before the end of
1639 the staff line, you will need to insert
1647 to indicate where breaks can occur.
1650 @node System start delimiters
1651 @subsection System start delimiters
1653 @cindex start of system
1654 @cindex Staff, multiple
1655 @cindex bracket, vertical
1656 @cindex brace, vertical
1659 @cindex staff, choir
1661 Many scores consist of more than one staff. These staves can be
1662 joined in four different ways
1665 @item The group is started with a brace at the left, and bar lines are
1666 connected. This is done with the @internalsref{GrandStaff} context.
1668 @lilypond[verbatim,ragged-right,quote]
1676 @item The group is started with a bracket, and bar lines are connected.
1677 This is done with the
1678 @internalsref{StaffGroup} context
1680 @lilypond[verbatim,ragged-right,quote]
1688 @item The group is started with a bracket, but bar lines are not
1689 connected. This is done with the @internalsref{ChoirStaff} context.
1691 @lilypond[verbatim,ragged-right,quote]
1699 @item The group is started with a vertical line. Bar lines are not
1700 connected. This is the default for the score.
1702 @lilypond[verbatim,ragged-right,quote]
1713 The bar lines at the start of each system are
1714 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1715 @internalsref{SystemStartBracket}. Only one of these types is created
1716 in every context, and that type is determined by the property
1717 @internalsref{systemStartDelimiter}.
1721 @subsection Staff symbol
1723 @cindex adjusting staff symbol
1725 Notes, dynamic signs, etc., are grouped
1726 with a set of horizontal lines, called a staff (plural `staves'). In
1727 LilyPond, these lines are drawn using a separate layout object called
1728 @code{staff symbol}.
1730 The staff symbol may be tuned in the number, thickness and distance
1731 of lines, using properties. This is demonstrated in the example files
1732 @inputfileref{input/@/test,staff@/-lines@/.ly},
1733 @inputfileref{input/@/test,staff@/-size@/.ly}.
1735 In addition, staves may be started and stopped at will. This is done
1736 with @code{\startStaff} and @code{\stopStaff}.
1738 @lilypond[verbatim,relative=2,fragment]
1740 \override Staff.StaffSymbol #'line-count = 2
1741 \stopStaff \startStaff
1743 \revert Staff.StaffSymbol #'line-count
1744 \stopStaff \startStaff
1748 In combination with Frenched staves, this may be used to typeset ossia
1749 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1754 @lilypondfile{ossia.ly}
1756 @cindex staff lines, setting number of
1757 @cindex staff lines, setting thickness of
1758 @cindex thickness of staff lines, setting
1759 @cindex number of staff lines, setting
1763 Program reference: @internalsref{StaffSymbol}.
1765 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1766 @inputfileref{input/@/test@/,ossia.ly},
1767 @inputfileref{input/@/test,staff@/-size@/.ly},
1768 @inputfileref{input/@/regression,staff@/-line@/-positions@/.ly}.
1771 @node Writing music in parallel
1772 @subsection Writing music in parallel
1774 @cindex Writing music in parallel
1775 @cindex Interleaved music
1777 Music for multiple parts can be interleaved
1779 @lilypond[quote,fragment,verbatim]
1780 \parallelMusic #'(voiceA voiceB) {
1781 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
1783 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
1787 \new Staff \new Voice \voiceA
1788 \new Staff \new Voice \voiceB
1794 @node Connecting notes
1795 @section Connecting notes
1797 This section deals with notation that affects groups of notes.
1803 * Laissez vibrer ties::
1816 A tie connects two adjacent note heads of the same pitch. The tie in
1817 effect extends the length of a note. Ties should not be confused with
1818 slurs, which indicate articulation, or phrasing slurs, which indicate
1819 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1821 @lilypond[quote,ragged-right,fragment,verbatim]
1822 e' ~ e' <c' e' g'> ~ <c' e' g'>
1825 When a tie is applied to a chord, all note heads whose pitches match
1826 are connected. When no note heads match, no ties will be created.
1828 A tie is just a way of extending a note duration, similar to the
1829 augmentation dot. The following example shows two ways of notating
1830 exactly the same concept
1832 @lilypond[quote,fragment,ragged-right]
1833 \time 3/4 c'2. c'2 ~ c'4
1837 Ties are used either when the note crosses a bar line, or when dots
1838 cannot be used to denote the rhythm. When using ties, larger note
1839 values should be aligned to subdivisions of the measure, such as
1841 @lilypond[fragment,quote,ragged-right]
1843 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1847 If you need to tie a lot of notes over bars, it may be easier to use
1848 automatic note splitting (see @ref{Automatic note splitting}). This
1849 mechanism automatically splits long notes, and ties them across bar
1852 When a second alternative of a repeat starts with a tied note, you
1853 have to repeat the tie. This can be achieved with @code{\repeatTie},
1855 @lilypond[fragment,quote,ragged-right,relative=2]
1859 @cindex repeating ties
1860 @cindex volta brackets and ties
1864 Ties are sometimes used to write out arpeggios. In this case, two tied
1865 notes need not be consecutive. This can be achieved by setting the
1866 @code{tieWaitForNote} property to true. The same feature is also useful,
1867 for example, to tie a tremolo to a chord. For example,
1869 @lilypond[fragment,verbatim,relative=1,ragged-right]
1870 \set tieWaitForNote = ##t
1871 \grace { c16[~ e~ g]~ } <c, e g>2
1872 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1883 @funindex \tieNeutral
1885 @funindex \tieDotted
1887 @funindex \tieDashed
1895 In this manual: @ref{Automatic note splitting}.
1897 Program reference: @internalsref{Tie}.
1900 @inputfileref{input/@/regression,tie-arpeggio.ly}
1901 @inputfileref{input/@/regression,tie-manual.ly}
1908 Switching staves when a tie is active will not produce a slanted tie.
1916 A slur indicates that notes are to be played bound or
1917 @emph{legato}. They are entered using parentheses
1919 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1920 f( g a) a8 b( a4 g2 f4)
1924 The direction of a slur can be specified with
1925 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1926 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1929 However, there is a convenient shorthand for forcing slur
1930 directions. By adding @code{_} or @code{^} before the opening
1931 parentheses, the direction is also set. For example,
1933 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1937 Only one slur can be printed at once. If you need to print a long
1938 slur over a few small slurs, please see @ref{Phrasing slurs}.
1943 Some composers write two slurs when they want legato chords. This can
1944 be achieved in LilyPond by setting @code{doubleSlurs},
1946 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1947 \set doubleSlurs = ##t
1948 <c e>4 ( <d f> <c e> <d f> )
1958 @funindex \slurNeutral
1959 @code{\slurNeutral},
1960 @funindex \slurDashed
1962 @funindex \slurDotted
1964 @funindex \slurSolid
1969 Program reference: @seeinternals{Slur}.
1972 @node Phrasing slurs
1973 @subsection Phrasing slurs
1975 @cindex phrasing slurs
1976 @cindex phrasing marks
1978 A phrasing slur (or phrasing mark) connects notes and is used to
1979 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1982 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1983 \time 6/4 c'\( d( e) f( e) d\)
1986 Typographically, the phrasing slur behaves almost exactly like a
1987 normal slur. However, they are treated as different objects. A
1988 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1989 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1990 @code{\phrasingSlurNeutral}.
1992 You cannot have simultaneous phrasing slurs.
1997 @funindex \phrasingSlurUp
1998 @code{\phrasingSlurUp},
1999 @funindex \phrasingSlurDown
2000 @code{\phrasingSlurDown},
2001 @funindex \phrasingSlurNeutral
2002 @code{\phrasingSlurNeutral}.
2007 Program reference: @internalsref{PhrasingSlur}.
2010 @node Laissez vibrer ties
2011 @subsection Laissez vibrer ties
2012 @cindex Laissez vibrer
2013 @cindex Ties, laissez vibrer
2015 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
2016 end. It is used in notation for piano, harp and other string and
2017 percussion instruments. They can be entered using @code{\laissezVibrer},
2019 @lilypond[fragment,ragged-right,verbatim,relative=1]
2020 <c f g>\laissezVibrer
2026 @internalsref{LaissezVibrerTie}
2027 @internalsref{LaissezVibrerTieColumn}
2030 @inputfileref{input/regression,laissez-vibrer-tie.ly}
2033 @node Automatic beams
2034 @subsection Automatic beams
2036 LilyPond inserts beams automatically
2038 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2039 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
2042 When these automatic decisions are not good enough, beaming can be
2043 entered explicitly. It is also possible to define beaming patterns
2044 that differ from the defaults. See @ref{Setting automatic beam behavior}
2047 Individual notes may be marked with @code{\noBeam} to prevent them
2050 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2051 \time 2/4 c8 c\noBeam c c
2057 Program reference: @internalsref{Beam}.
2061 @subsection Manual beams
2063 @cindex beams, manual
2067 In some cases it may be necessary to override the automatic beaming
2068 algorithm. For example, the autobeamer will not put beams over rests
2069 or bar lines. Such beams are specified manually by marking the begin
2070 and end point with @code{[} and @code{]}
2072 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2074 r4 r8[ g' a r8] r8 g[ | a] r8
2081 @funindex stemLeftBeamCount
2082 @funindex stemRightBeamCount
2084 Normally, beaming patterns within a beam are determined automatically.
2085 If necessary, the properties @code{stemLeftBeamCount} and
2086 @code{stemRightBeamCount} can be used to override the defaults. If
2087 either property is set, its value will be used only once, and then it
2090 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2095 \set stemLeftBeamCount = #1
2100 The property @code{subdivideBeams} can be set in order to subdivide
2101 all 16th or shorter beams at beat positions, as defined by the
2102 @code{beatLength} property.
2104 @lilypond[fragment,quote,relative=2,verbatim]
2106 \set subdivideBeams = ##t
2108 \set Score.beatLength = #(ly:make-moment 1 8)
2111 @funindex subdivideBeams
2114 For more information about @code{make-moment}, see
2115 @ref{Time administration}.
2117 Line breaks are normally forbidden when beams cross bar lines. This
2118 behavior can be changed by setting @code{allowBeamBreak}.
2120 @funindex allowBeamBreak
2121 @cindex beams and line breaks
2122 @cindex beams, kneed
2124 @cindex auto-knee-gap
2129 Kneed beams are inserted automatically when a large gap is detected
2130 between the note heads. This behavior can be tuned through the object.
2132 Automatically kneed cross-staff beams cannot be used together with
2133 hidden staves. See @ref{Hiding staves}.
2135 Beams do not avoid collisions with symbols around the notes, such as
2136 texts and accidentals.
2140 @subsection Grace notes
2145 @cindex appoggiatura
2146 @cindex acciaccatura
2148 Grace notes are ornaments that are written out. The most common ones
2149 are acciaccatura, which should be played as very short. It is denoted
2150 by a slurred small note with a slashed stem. The appoggiatura is a
2151 grace note that takes a fixed fraction of the main note, and is
2152 denoted as a slurred note in small print without a slash. They
2153 are entered with the commands @code{\acciaccatura} and
2154 @code{\appoggiatura}, as demonstrated in the following example
2156 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2157 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2158 \acciaccatura { g16[ f] } e4
2161 Both are special forms of the @code{\grace} command. By prefixing this
2162 keyword to a music expression, a new one is formed, which will be
2163 printed in a smaller font and takes up no logical time in a measure.
2165 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2167 \grace { c16[ d16] } c2 c4
2171 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2172 @code{\grace} command does not start a slur.
2174 Internally, timing for grace notes is done using a second, `grace'
2175 timing. Every point in time consists of two rational numbers: one
2176 denotes the logical time, one denotes the grace timing. The above
2177 example is shown here with timing tuples
2179 @lilypond[quote,ragged-right]
2182 c4 \grace c16 c4 \grace {
2185 \new Lyrics \lyricmode {
2186 \override LyricText #'font-family = #'typewriter
2190 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2191 \markup { (\fraction 1 4 , 0 ) } 4
2193 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2194 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2196 \markup { ( \fraction 2 4 , 0 ) }
2201 The placement of grace notes is synchronized between different staves.
2202 In the following example, there are two sixteenth grace notes for
2203 every eighth grace note
2205 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2206 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2207 \new Staff { c4 \grace { g8[ b] } c4 } >>
2210 @funindex \afterGrace
2212 If you want to end a note with a grace, use the @code{\afterGrace}
2213 command. It takes two arguments: the main note, and the grace notes
2214 following the main note.
2216 @lilypond[ragged-right, verbatim,relative=2,fragment]
2217 c1 \afterGrace d1 { c16[ d] } c4
2220 This will put the grace notes after a ``space'' lasting 3/4 of the
2221 length of the main note. The fraction 3/4 can be changed by setting
2222 @code{afterGraceFraction}, ie.
2225 afterGraceFraction = #(cons 7 8)
2229 will put the grace note at 7/8 of the main note.
2231 The same effect can be achieved manually by doing
2233 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2236 { s2 \grace { c16[ d] } } >>
2242 By adjusting the duration of the skip note (here it is a half-note),
2243 the space between the main-note and the grace is adjusted.
2245 A @code{\grace} section will introduce special typesetting settings,
2246 for example, to produce smaller type, and set directions. Hence, when
2247 introducing layout tweaks, they should be inside the grace section,
2250 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2262 The overrides should also be reverted inside the grace section.
2264 The layout of grace sections can be changed throughout the music using
2265 the function @code{add-grace-property}. The following example
2266 undefines the @code{Stem} direction for this grace, so
2267 that stems do not always point up.
2271 #(add-grace-property 'Voice 'Stem 'direction '())
2277 Another option is to change the variables @code{startGraceMusic},
2278 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2279 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2280 @code{stopAppoggiaturaMusic}. More information is in the file
2281 @file{ly/@/grace@/-init@/.ly}.
2284 The slash through the stem in acciaccaturas can be obtained
2285 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
2289 Program reference: @internalsref{GraceMusic}.
2294 A score that starts with a @code{\grace} section needs an explicit
2295 @code{\new Voice} declaration, otherwise the main note and the grace
2296 note end up on different staves.
2298 Grace note synchronization can also lead to surprises. Staff notation,
2299 such as key signatures, bar lines, etc., are also synchronized. Take
2300 care when you mix staves with grace notes and staves without, for example,
2302 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2303 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2304 \new Staff { c4 \bar "|:" d4 } >>
2308 This can be remedied by inserting grace skips of the corresponding
2309 durations in the other staves. For the above example
2312 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2315 Grace sections should only be used within sequential music
2316 expressions. Nesting or juxtaposing grace sections is not supported,
2317 and might produce crashes or other errors.
2321 @node Expressive marks
2322 @section Expressive marks
2324 Expressive marks help musicians to bring more to the music than simple
2329 * Fingering instructions::
2339 @subsection Articulations
2341 @cindex Articulations
2345 A variety of symbols can appear above and below notes to indicate
2346 different characteristics of the performance. They are added to a note
2347 by adding a dash and the character signifying the
2348 articulation. They are demonstrated here
2350 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2352 The meanings of these shorthands can be changed. See
2353 @file{ly/@/script@/-init@/.ly} for examples.
2355 The script is automatically placed, but the direction can be forced as
2356 well. Like other pieces of LilyPond code, @code{_} will place them
2357 below the staff, and @code{^} will place them above.
2359 @lilypond[quote,ragged-right,fragment,verbatim]
2363 Other symbols can be added using the syntax
2364 @var{note}@code{\}@var{name}. Again, they
2365 can be forced up or down using @code{^} and @code{_},
2368 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2369 c\fermata c^\fermata c_\fermata
2374 @cindex staccatissimo
2384 @cindex organ pedal marks
2393 @cindex prallmordent
2397 @cindex thumb marking
2402 Here is a chart showing all scripts available,
2404 @lilypondfile[ragged-right,quote]{script-chart.ly}
2409 The vertical ordering of scripts is controlled with the
2410 @code{script-priority} property. The lower this number, the closer it
2411 will be put to the note. In this example, the
2412 @internalsref{TextScript} (the sharp symbol) first has the lowest
2413 priority, so it is put lowest in the first example. In the second, the
2414 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2415 inside. When two objects have the same priority, the order in which
2416 they are entered decides which one comes first.
2418 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2419 \once \override TextScript #'script-priority = #-100
2420 a4^\prall^\markup { \sharp }
2422 \once \override Script #'script-priority = #-100
2423 a4^\prall^\markup { \sharp }
2429 Program reference: @internalsref{Script}.
2434 These signs appear in the printed output but have no effect on the
2435 MIDI rendering of the music.
2438 @node Fingering instructions
2439 @subsection Fingering instructions
2442 @cindex finger change
2444 Fingering instructions can be entered using
2446 @var{note}-@var{digit}
2448 For finger changes, use markup texts
2450 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2452 c^\markup { \finger "2 - 3" }
2455 You can use the thumb-script to indicate that a note should be
2456 played with the thumb (e.g., in cello music)
2457 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2458 <a_\thumb a'-3>8 <b_\thumb b'-3>
2461 Fingerings for chords can also be added to individual notes
2462 of the chord by adding them after the pitches
2463 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2464 < c-1 e-2 g-3 b-5 >4
2470 You may exercise greater control over fingering chords by
2471 setting @code{fingeringOrientations}
2473 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2474 \set fingeringOrientations = #'(left down)
2475 <c-1 es-2 g-4 bes-5 > 4
2476 \set fingeringOrientations = #'(up right down)
2477 <c-1 es-2 g-4 bes-5 > 4
2480 Using this feature, it is also possible to put fingering instructions
2481 very close to note heads in monophonic music,
2483 @lilypond[verbatim,ragged-right,quote,fragment]
2484 \set fingeringOrientations = #'(right)
2491 Program reference: @internalsref{Fingering}.
2493 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2497 @subsection Dynamics
2518 Absolute dynamic marks are specified using a command after a note
2519 @code{c4\ff}. The available dynamic marks are @code{\ppppp},
2520 @code{\pppp}, @code{\ppp},
2521 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2522 @code{\fff}, @code{\ffff}, @code{\fp}, @code{\sf}, @code{\sff},
2523 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2525 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2526 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2527 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2534 A crescendo mark is started with @code{\<} and terminated with
2535 @code{\!} or an absolute dynamic. A decrescendo is started with
2536 @code{\>} and is also terminated with @code{\!} or an absolute
2537 dynamic. @code{\cr} and @code{\decr} may be used instead of
2538 @code{\<} and @code{\>}. Because these marks are bound to notes, you must
2539 use spacer notes if multiple marks are needed during one note
2541 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2543 << f1 { s4 s4\< s4\! \> s4\! } >>
2547 A hairpin starts at the left edge of the beginning note and ends on the
2548 right edge of the ending note.
2550 In some situations the @code{\espressivo} articulation mark may
2551 be suitable to indicate a crescendo and decrescendo on the one note,
2553 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2554 c2 b4 a g1\espressivo
2557 This may give rise to very short hairpins. Use @code{minimum-length}
2558 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2562 \override Voice.Hairpin #'minimum-length = #5
2569 You can also use text saying @emph{cresc.} instead of hairpins
2571 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2582 You can also supply your own texts
2583 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2584 \set crescendoText = \markup { \italic "cresc. poco" }
2585 \set crescendoSpanner = #'dashed-line
2589 To create new dynamic marks or text that should be aligned
2590 with dynamics, see @ref{New dynamic marks}.
2595 Dynamics that occur at, begin on, or end on, the same note
2596 will be vertically aligned. If you want to ensure that dynamics
2597 are aligned when they do not occur on the same note, you can
2598 increase the @code{staff-padding} property.
2601 \override DynamicLineSpanner #'staff-padding = #4
2604 You may also use this property if the dynamics are colliding
2605 with other notation.
2607 Crescendi and decrescendi that end on the first note of a
2608 new line are not printed. To change this behavior, use
2611 \override Score.Hairpin #'after-line-breaking = ##t
2614 Text style dynamic changes (such as @emph{cresc.} and @emph{dim.})
2616 dashed line showing their extent. To surpress printing this line, use
2619 \override DynamicTextSpanner #'dash-period = #-1.0
2625 @funindex \dynamicUp
2627 @funindex \dynamicDown
2628 @code{\dynamicDown},
2629 @funindex \dynamicNeutral
2630 @code{\dynamicNeutral}.
2635 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2636 Vertical positioning of these symbols is handled by
2637 @internalsref{DynamicLineSpanner}.
2641 @subsection Breath marks
2643 Breath marks are entered using @code{\breathe}
2645 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2652 The glyph of the breath mark can be tuned by overriding the
2653 @code{text} property of the @code{BreathingSign} layout object with
2654 any markup text. For example,
2655 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2657 \override BreathingSign #'text
2658 = #(make-musicglyph-markup "scripts.rvarcomma")
2665 Program reference: @internalsref{BreathingSign}.
2667 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2673 Short trills are printed like normal articulation; see @ref{Articulations}.
2675 Long running trills are made with @code{\startTrillSpan} and
2676 @code{\stopTrillSpan},
2678 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2680 << { c1 \startTrillSpan }
2681 { s2. \grace { d16[\stopTrillSpan e] } } >>
2685 @cindex Pitched trills
2687 Trills that should be executed on an explicitly specified pitch can be
2688 typeset with the command @code{pitchedTrill},
2690 @lilypond[ragged-right,verbatim,fragment,relative=1,quote]
2691 \pitchedTrill c4\startTrillSpan fis
2695 The first argument is the main note. The pitch of the second
2696 is printed as a stemless note head in parentheses.
2701 @code{\startTrillSpan},
2702 @funindex \startTrillSpan
2703 @code{\stopTrillSpan}.
2704 @funindex \stopTrillSpan
2709 Program reference: @internalsref{TrillSpanner}.
2713 @subsection Glissando
2716 @funindex \glissando
2718 A glissando is a smooth change in pitch. It is denoted by a line or a
2719 wavy line between two notes. It is requested by attaching
2720 @code{\glissando} to a note
2722 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2724 \override Glissando #'style = #'zigzag
2731 Program reference: @internalsref{Glissando}.
2733 Example files: @file{input/@/regression/@/glissando@/.ly}.
2738 Printing text over the line (such as @emph{gliss.}) is not supported.
2742 @subsection Arpeggio
2745 @cindex broken chord
2748 You can specify an arpeggio sign (also known as broken chord) on a
2749 chord by attaching an @code{\arpeggio} to a chord
2751 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2755 A square bracket on the left indicates that the player should not
2756 arpeggiate the chord
2758 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2763 The direction of the arpeggio is sometimes denoted by adding an
2764 arrowhead to the wiggly line
2766 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2778 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2779 in both staves and set
2780 @internalsref{PianoStaff}.@code{connectArpeggios}
2782 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2784 \set PianoStaff.connectArpeggios = ##t
2785 \new Staff { <c' e g c>\arpeggio }
2786 \new Staff { \clef bass <c,, e g>\arpeggio }
2794 @funindex \arpeggioUp
2796 @funindex \arpeggioDown
2797 @code{\arpeggioDown},
2798 @funindex \arpeggioNeutral
2799 @code{\arpeggioNeutral},
2800 @funindex \arpeggioBracket
2801 @code{\arpeggioBracket}.
2806 Notation manual: @ref{Ties}, for writing out arpeggios.
2808 Program reference: @internalsref{Arpeggio}.
2813 It is not possible to mix connected arpeggios and unconnected
2814 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2823 Repetition is a central concept in music, and multiple notations exist
2829 * Repeats and MIDI::
2830 * Manual repeat commands::
2832 * Tremolo subdivisions::
2838 @subsection Repeat types
2843 The following types of repetition are supported
2847 Repeated music is fully written (played) out. This is useful when
2848 entering repetitious music. This is the only kind of repeat that
2849 is included in MIDI output.
2852 Repeats are not written out, but alternative endings (volte) are
2853 printed, left to right with brackets. This is the standard notation
2854 for repeats with alternatives. These are not played in MIDI output by
2859 Alternative endings are written stacked. This has limited use but may be
2860 used to typeset two lines of lyrics in songs with repeats, see
2861 @inputfileref{input,star-spangled-banner@/.ly}.
2865 Make tremolo beams. These are not played in MIDI output by default.
2868 Make beat or measure repeats. These look like percent signs. These
2869 are not played in MIDI output by default. Percent repeats must be
2870 declared within a @code{Voice} context.
2876 @subsection Repeat syntax
2878 LilyPond has one syntactic construct for specifying different types of
2879 repeats. The syntax is
2882 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2885 If you have alternative endings, you may add
2886 @funindex \alternative
2897 where each @var{alternative} is a music expression. If you do not
2898 give enough alternatives for all of the repeats, the first alternative
2899 is assumed to be played more than once.
2901 Standard repeats are used like this
2902 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2904 \repeat volta 2 { c4 d e f }
2905 \repeat volta 2 { f e d c }
2908 With alternative endings
2909 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2911 \repeat volta 2 {c4 d e f}
2912 \alternative { {d2 d} {f f,} }
2915 In the following example, the first ending is not a complete
2916 bar (it only had 3 beats). The beginning of the second ending
2917 contains the 4th beat from the first ending. This ``extra''
2918 beat in the second ending is due to the first time ending,
2919 and has nothing to do with the @code{\partial} at the
2920 beginning of the example.
2922 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2925 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2926 \alternative { { g4 g g } { a | a a a a | b2. } }
2930 It is possible to shorten volta brackets
2931 by setting @code{voltaSpannerDuration}. In the next example, the
2932 bracket only lasts one measure, which is a duration of 3/4.
2934 @lilypond[verbatim,ragged-right,quote]
2938 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2939 \repeat "volta" 5 { d d d }
2940 \alternative { { e e e f f f }
2950 Brackets for the repeat are normally only printed over the topmost
2951 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2952 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2957 @cindex repeat, ambiguous
2959 A nested repeat like
2968 is ambiguous, since it is is not clear to which @code{\repeat} the
2969 @code{\alternative} belongs. This ambiguity is resolved by always
2970 having the @code{\alternative} belong to the inner @code{\repeat}.
2971 For clarity, it is advisable to use braces in such situations.
2973 Timing information is not remembered at the start of an alternative,
2974 so after a repeat timing information must be reset by hand; for
2975 example, by setting @code{Score.measurePosition} or entering
2976 @code{\partial}. Similarly, slurs or ties are also not repeated.
2979 @node Repeats and MIDI
2980 @subsection Repeats and MIDI
2982 @cindex expanding repeats
2983 @funindex \unfoldRepeats
2985 With a little bit of tweaking, all types of repeats can be present
2986 in the MIDI output. This is achieved by applying the
2987 @code{\unfoldRepeats} music function. This function changes all
2988 repeats to unfold repeats.
2990 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2992 \repeat tremolo 8 {c'32 e' }
2993 \repeat percent 2 { c''8 d'' }
2994 \repeat volta 2 {c'4 d' e' f'}
3003 When creating a score file using @code{\unfoldRepeats} for MIDI,
3004 it is necessary to make two @code{\score} blocks: one for MIDI (with
3005 unfolded repeats) and one for notation (with volta, tremolo, and
3006 percent repeats). For example,
3014 \unfoldRepeats @var{..music..}
3020 @node Manual repeat commands
3021 @subsection Manual repeat commands
3023 @funindex repeatCommands
3025 The property @code{repeatCommands} can be used to control the layout of
3026 repeats. Its value is a Scheme list of repeat commands.
3029 @item @code{start-repeat}
3030 Print a @code{|:} bar line.
3032 @item @code{end-repeat}
3033 Print a @code{:|} bar line.
3035 @item @code{(volta @var{text})}
3036 Print a volta bracket saying @var{text}: The text can be specified as
3037 a text string or as a markup text, see @ref{Text markup}. Do not
3038 forget to change the font, as the default number font does not contain
3039 alphabetic characters;
3041 @item @code{(volta #f)}
3042 Stop a running volta bracket.
3045 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3047 \set Score.repeatCommands = #'((volta "93") end-repeat)
3049 \set Score.repeatCommands = #'((volta #f))
3056 Program reference: @internalsref{VoltaBracket},
3057 @internalsref{RepeatedMusic},
3058 @internalsref{VoltaRepeatedMusic},
3059 @internalsref{UnfoldedRepeatedMusic}, and
3060 @internalsref{FoldedRepeatedMusic}.
3063 @node Tremolo repeats
3064 @subsection Tremolo repeats
3066 @cindex tremolo beams
3068 To place tremolo marks between notes, use @code{\repeat} with tremolo
3070 @lilypond[quote,verbatim,ragged-right]
3071 \new Voice \relative c' {
3072 \repeat "tremolo" 8 { c16 d16 }
3073 \repeat "tremolo" 4 { c16 d16 }
3074 \repeat "tremolo" 2 { c16 d16 }
3078 Tremolo marks can also be put on a single note. In this case, the
3079 note should not be surrounded by braces.
3080 @lilypond[quote,verbatim,ragged-right]
3081 \repeat "tremolo" 4 c'16
3084 Similar output is obtained using the tremolo subdivision, described in
3085 @ref{Tremolo subdivisions}.
3090 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3092 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3094 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3095 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3098 @node Tremolo subdivisions
3099 @subsection Tremolo subdivisions
3101 @cindex tremolo marks
3102 @funindex tremoloFlags
3104 Tremolo marks can be printed on a single note by adding
3105 `@code{:}[@var{number}]' after the note. The number indicates the
3106 duration of the subdivision, and it must be at least 8. A
3107 @var{length} value of 8 gives one line across the note stem. If the
3108 length is omitted, the last value (stored in @code{tremoloFlags}) is
3111 @lilypond[quote,ragged-right,verbatim,fragment]
3112 c'2:8 c':32 | c': c': |
3118 Tremolos entered in this way do not carry over into the MIDI output.
3123 In this manual: @ref{Tremolo repeats}.
3125 Elsewhere: @internalsref{StemTremolo}.
3128 @node Measure repeats
3129 @subsection Measure repeats
3131 @cindex percent repeats
3132 @cindex measure repeats
3134 In the @code{percent} style, a note pattern can be repeated. It is
3135 printed once, and then the pattern is replaced with a special sign.
3136 Patterns of one and two measures are replaced by percent-like signs,
3137 patterns that divide the measure length are replaced by slashes.
3138 Percent repeats must be declared within a @code{Voice} context.
3140 @lilypond[quote,verbatim,ragged-right]
3141 \new Voice \relative c' {
3142 \repeat "percent" 4 { c4 }
3143 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3147 Measure repeats of more than 2 measures get a counter, if you switch
3148 on the @code{countPercentRepeats} property,
3150 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3152 \set countPercentRepeats = ##t
3153 \repeat "percent" 4 { c1 }
3159 Isolated percents can also be printed. This is done by putting a
3160 multi-measure rest with a different print function,
3162 @lilypond[fragment,verbatim,quote]
3163 \override MultiMeasureRest #'stencil
3164 = #ly:multi-measure-rest::percent
3173 Program reference: @internalsref{RepeatSlash},
3174 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3175 @internalsref{DoublePercentRepeatCounter},
3176 @internalsref{PercentRepeatCounter},
3177 @internalsref{PercentRepeatedMusic}.