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
10 @chapter Basic notation
12 This chapter explains how to use all basic notation features.
16 * Alternate music entry::
30 This section is about basic notation elements like notes, rests, and
31 related constructs, such as stems, tuplets and ties.
36 * Cautionary accidentals::
52 @cindex Note specification
53 @cindex entering notes
55 A note is printed by specifying its pitch and then its duration,
57 @lilypond[quote,verbatim,ragged-right,fragment]
63 This manual: @ref{Pitches}, @ref{Durations}
72 The most common syntax for pitch entry is used for standard notes and
73 @code{\chordmode} modes. In these modes, pitches may be designated by
74 names. The notes are specified by the letters @code{a} through
75 @code{g}. The octave is formed with notes ranging from @code{c}
76 to @code{b}. The pitch @code{c} is an octave below middle C and the
77 letters span the octave above that C
79 @lilypond[quote,fragment,verbatim,ragged-right]
81 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
87 The optional octave specification takes the form of a series of
88 single quote (`@code{'}') characters or a series of comma
89 (`@code{,}') characters. Each @code{'} raises the pitch by one
90 octave; each @code{,} lowers the pitch by an octave
92 @lilypond[quote,ragged-right,fragment,verbatim]
96 @cindex note names, Dutch
98 A sharp is formed by adding @code{-is} to the end of a pitch name and
99 a flat is formed by adding @code{-es}. Double sharps and double flats
100 are obtained by adding @code{-isis} or @code{-eses}. These
101 names are the Dutch note names. In Dutch, @code{aes} is contracted to
102 @code{as}, but both forms are accepted. Similarly, both
103 @code{es} and @code{ees} are accepted
105 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
114 There are predefined sets of note names for various other languages.
115 To use them, include the language specific init file. For
116 example: @code{\include "english.ly"}. The available language files
117 and the note names they define are
122 Note Names sharp flat
123 nederlands.ly c d e f g a bes b -is -es
124 english.ly c d e f g a bf b -s/-sharp -f/-flat
126 deutsch.ly c d e f g a b h -is -es
127 norsk.ly c d e f g a b h -iss/-is -ess/-es
128 svenska.ly c d e f g a b h -iss -ess
129 italiano.ly do re mi fa sol la sib si -d -b
130 catalan.ly do re mi fa sol la sib si -d/-s -b
131 espanol.ly do re mi fa sol la sib si -s -b
137 In accordance with standard typsetting rules, a natural sign is printed
138 before a sharp or flat if a previous accidental needs to be
139 cancelled. To change this behaviour, use
140 @code{\set Staff.extraNatural = ##f}
142 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
144 \set Staff.extraNatural = ##f
150 Suggested accidentals (used in notating musica ficta) may
151 be written with @code{suggestAccidentals}
153 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
154 \set suggestAccidentals = ##t
161 Program reference: @internalsref{LedgerLineSpanner}, @internalsref{NoteHead}.
164 @node Cautionary accidentals
165 @subsection Cautionary accidentals
167 @cindex reminder accidental
169 @cindex cautionary accidental
170 @cindex parenthesized accidental
173 Normally accidentals are printed automatically, but you may also
174 print them manually. A reminder accidental
175 can be forced by adding an exclamation mark @code{!}
176 after the pitch. A cautionary accidental
177 (i.e., an accidental within parentheses) can be obtained by adding the
178 question mark `@code{?}' after the pitch. These extra accidentals
179 can be used to produce natural signs, too.
181 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
182 cis cis cis! cis? c c? c! c
188 The automatic production of accidentals can be tuned in many
189 ways. For more information, refer to @ref{Automatic accidentals}.
194 @subsection Micro tones
196 @cindex quarter tones
197 @cindex semi-flats, semi-sharps
199 Half-flats and half-sharps are formed by adding @code{-eh} and
200 @code{-ih}; the following is a series of Cs with increasing pitches
202 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
203 \set Staff.extraNatural = ##f
207 Micro tones are also exported to the MIDI file.
212 There are no generally accepted standards for denoting three quarter
213 flats, so LilyPond's symbol does not conform to any standard.
221 A chord is formed by a enclosing a set of pitches in @code{<} and
222 @code{>}. A chord may be followed by a duration, and a set of
223 articulations, just like simple notes
225 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
229 For more information about chords, see @ref{Chord names}.
240 Rests are entered like notes with the note name @code{r}
242 @lilypond[fragment,quote,ragged-right,verbatim]
246 Whole bar rests, centered in middle of the bar,
247 must be done with multi-measure rests. They can be used for a
248 single bar as well as many bars, and are discussed in
249 @ref{Multi measure rests}.
252 A rest's vertical position may be explicitly specified by entering a
253 note with the @code{\rest} keyword appended, the rest will be placed at
254 the note's place. This makes manual formatting in polyphonic music
255 easier. Automatic rest collision formatting will leave these rests
258 @lilypond[fragment,quote,ragged-right,verbatim]
264 Program reference: @internalsref{Rest}.
271 @cindex Invisible rest
276 An invisible rest (also called a `skip') can be entered like a note
277 with note name `@code{s}' or with @code{\skip @var{duration}}
279 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
280 a4 a4 s4 a4 \skip 1 a4
283 The @code{s} syntax is only available in note mode and chord mode. In
284 other situations, for example, when entering lyrics, you should use
285 the @code{\skip} command
287 @lilypond[quote,ragged-right,verbatim]
290 \new Lyrics \lyricmode { \skip 2 bla2 }
294 The skip command is merely an empty musical placeholder. It does not
295 produce any output, not even transparent output.
297 The @code{s} skip command does create @internalsref{Staff} and
298 @internalsref{Voice} when necessary, similar to note and rest
299 commands. For example, the following results in an empty staff.
301 @lilypond[quote,ragged-right,verbatim]
305 The fragment @code{@{ \skip 4 @} } would produce an empty page.
309 Program reference: @internalsref{SkipMusic}.
313 @subsection Durations
316 @cindex @code{\longa}
317 @cindex @code{\breve}
318 @cindex @code{\maxima}
320 In Note, Chord, and Lyrics mode, durations are designated by numbers and
321 dots: durations are entered as their reciprocal values. For example, a
322 quarter note is entered using a @code{4} (since it is a 1/4 note), while
323 a half note is entered using a @code{2} (since it is a 1/2 note). For
324 notes longer than a whole you must use the variables @code{\longa} and
329 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
331 r1 r2 r4 r8 r16 r32 r64 r64
337 a\breve*1/2 \autoBeamOff
338 a1 a2 a4 a8 a16 a32 a64 a64
341 r\longa*1/4 r\breve *1/2
342 r1 r2 r4 r8 r16 r32 r64 r64
348 \remove "Clef_engraver"
349 \override StaffSymbol #'transparent = ##t
350 \override TimeSignature #'transparent = ##t
351 \override BarLine #'transparent = ##t
352 \consists "Pitch_squash_engraver"
358 If the duration is omitted then it is set to the previously entered
359 duration. The default for the first note is a quarter note.
361 @lilypond[quote,ragged-right,verbatim,fragment]
362 { a a a2 a a4 a a1 a }
366 @node Augmentation dots
367 @subsection Augmentation dots
371 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
372 the number. Double-dotted notes are produced in a similar way.
374 @lilypond[quote,ragged-right,fragment,verbatim]
375 a'4 b' c''4. b'8 a'4. b'4.. c''8.
380 Dots are normally moved up to avoid staff lines, except in polyphonic
381 situations. The following commands may be used to force a particular
384 @cindex @code{\dotsUp}
386 @cindex @code{\dotsDown}
388 @cindex @code{\dotsNeutral}
393 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
401 @cindex @code{\times}
403 Tuplets are made out of a music expression by multiplying all durations
407 \times @var{fraction} @var{musicexpr}
411 The duration of @var{musicexpr} will be multiplied by the fraction.
412 The fraction's denominator will be printed over the notes, optionally
413 with a bracket. The most common tuplet is the triplet in which 3
414 notes have the length of 2, so the notes are 2/3 of their written
417 @lilypond[quote,ragged-right,fragment,verbatim]
418 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
421 Tuplets may be nested, for example,
423 @lilypond[fragment,ragged-right,verbatim,relative=2]
424 \set tupletNumberFormatFunction = #fraction-tuplet-formatter
427 \times 3/5 { a a a a a }
433 @cindex @code{\tupletUp}
435 @cindex @code{\tupletDown}
437 @cindex @code{\tupletNeutral}
438 @code{\tupletNeutral}.
443 @cindex @code{tupletNumberFormatFunction}
444 @cindex tuplet formatting
446 The property @code{tupletSpannerDuration} specifies how long each
447 bracket should last. With this, you can make lots of tuplets while
448 typing @code{\times} only once, thus saving lots of typing. In the next
449 example, there are two triplets shown, while @code{\times} was only
452 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
453 \set tupletSpannerDuration = #(ly:make-moment 1 4)
454 \times 2/3 { c8 c c c c c }
458 For more information about @code{make-moment}, see
459 @ref{Time administration}.
461 The format of the number is determined by the property
462 @code{tupletNumberFormatFunction}. The default prints only the
463 denominator, but if it is set to the Scheme function
464 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
467 To avoid printing tuplet numbers, use
469 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
470 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
471 \override TupletNumber #'transparent = ##t
472 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
478 Program reference: @internalsref{TupletBracket},
479 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
481 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
485 @node Scaling durations
486 @subsection Scaling durations
488 You can alter the length of duration by a fraction @var{N/M}
489 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
490 will not affect the appearance of the notes or rests produced.
492 In the following example, the first three notes take up exactly two
493 beats, but no triplet bracket is printed.
494 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
496 a4*2/3 gis4*2/3 a4*2/3
504 This manual: @ref{Tuplets}
510 Whenever a note is found, a @internalsref{Stem} object is created
511 automatically. For whole notes and rests, they are also created but
516 @cindex @code{\stemUp}
518 @cindex @code{\stemDown}
520 @cindex @code{\stemNeutral}
526 To change the direction of stems in the middle of the staff, use
528 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
530 \override Stem #'neutral-direction = #up
532 \override Stem #'neutral-direction = #down
537 @node Alternate music entry
538 @section Alternate music entry
541 This section deals with tricks and features of the input language that
542 were added solely to help entering music and finding and correcting
543 mistakes. There are also external tools that make debugging easier.
544 See @ref{Point and click} for more information.
546 It is also possible to enter and edit music using other programs, such as
547 GUI interfaces or MIDI sequencers. Refer to the LilyPond
548 website for more information.
556 * Skipping corrected music::
557 * Automatic note splitting::
558 * Writing music in parallel::
562 @node Relative octaves
563 @subsection Relative octaves
566 @cindex Relative octave specification
567 @cindex @code{\relative}
569 Octaves are specified by adding @code{'} and @code{,} to pitch names.
570 When you copy existing music, it is easy to accidentally put a pitch
571 in the wrong octave and hard to find such an error. The relative
572 octave mode prevents these errors by making the mistakes much
573 larger: a single error puts the rest of the piece off by one octave
576 \relative @var{startpitch} @var{musicexpr}
583 \relative @var{musicexpr}
586 The octave of notes that appear in @var{musicexpr} are calculated as
587 follows: if no octave changing marks are used, the basic interval
588 between this and the last note is always taken to be a fourth or
589 less. This distance is determined without regarding alterations; a
590 @code{fisis} following a @code{ceses} will be put above the
591 @code{ceses}. In other words, a doubly-augmented fourth is considered
592 a smaller interval than a diminished fifth, even though the
593 doubly-augmented fourth spans seven semitones while the diminished
594 fifth only spans six semitones.
596 The octave changing marks @code{'} and @code{,} can be added to raise
597 or lower the pitch by an extra octave. Upon entering relative mode,
598 an absolute starting pitch can be specified that will act as the
599 predecessor of the first note of @var{musicexpr}. If no starting pitch
600 is specified, then middle C is used as a start.
602 Here is the relative mode shown in action
603 @lilypond[quote,fragment,ragged-right,verbatim]
609 Octave changing marks are used for intervals greater than a fourth
610 @lilypond[quote,ragged-right,fragment,verbatim]
616 If the preceding item is a chord, the first note of the chord is used
617 to determine the first note of the next chord
619 @lilypond[quote,ragged-right,fragment,verbatim]
627 The pitch after the @code{\relative} contains a note name.
629 The relative conversion will not affect @code{\transpose},
630 @code{\chordmode} or @code{\relative} sections in its argument. To use
631 relative within transposed music, an additional @code{\relative} must
632 be placed inside @code{\transpose}.
636 @subsection Octave check
640 Octave checks make octave errors easier to correct: a note may be
641 followed by @code{=}@var{quotes} which indicates what its absolute
642 octave should be. In the following example,
645 \relative c'' @{ c='' b=' d,='' @}
649 the @code{d} will generate a warning, because a @code{d''} is expected
650 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
651 found. In the output, the octave is corrected to be a @code{d''} and
652 the next note is calculated relative to @code{d''} instead of @code{d'}.
654 There is also an octave check that produces no visible output. The syntax
660 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
661 quotes) in \relative mode. If not, a warning is printed, and the
662 octave is corrected. The @var{pitch} is not printed as a note.
664 In the example below, the first check passes without incident, since
665 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
666 the second check produces a warning, since the @code{e} is not within
667 a fifth of @code{b'}. The warning message is printed, and the octave
668 is adjusted so that the following notes are in the correct octave
680 The octave of a note following an octave check is determined with
681 respect to the note preceding it. In the next fragment, the last note
682 is an @code{a'}, above middle C. That means that the @code{\octave}
683 check passes successfully, so the check could be deleted without changing
684 the output of the piece.
686 @lilypond[quote,ragged-right,verbatim,fragment]
696 @subsection Transpose
699 @cindex transposition of pitches
700 @cindex @code{\transpose}
702 A music expression can be transposed with @code{\transpose}. The
705 \transpose @var{from} @var{to} @var{musicexpr}
708 This means that @var{musicexpr} is transposed by the interval between
709 the pitches @var{from} and @var{to}: any note with pitch @code{from}
710 is changed to @code{to}.
712 For example, consider a piece written in the key of D-major. If
713 this piece is a little too low for its performer, it can be
714 transposed up to E-major with
716 \transpose d e @dots{}
719 Consider a part written for violin (a C instrument). If
720 this part is to be played on the A clarinet (for which an
721 A is notated as a C, and which sounds a minor third lower
722 than notated), the following
723 transposition will produce the appropriate part
726 \transpose a c @dots{}
729 @code{\transpose} distinguishes between enharmonic pitches: both
730 @code{\transpose c cis} or @code{\transpose c des} will transpose up
731 half a tone. The first version will print sharps and the second
732 version will print flats
734 @lilypond[quote,ragged-right,verbatim]
735 mus = { \key d \major cis d fis g }
744 @code{\transpose} may also be used to input written notes for a
745 transposing instrument. Pitches are normally entered into LilyPond
746 in C (or ``concert pitch''), but they may be entered in another
747 key. For example, when entering music for a B-flat trumpet which
748 begins on concert D, one would write
751 \transpose c bes @{ e4 @dots{} @}
754 To print this music in B-flat again (ie producing a trumpet part,
755 instead of a concert pitch conductor's score) you would wrap the
756 existing music with another @code{transpose}
759 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
765 Program reference: @internalsref{TransposedMusic}.
770 If you want to use both @code{\transpose} and @code{\relative},
771 you must put @code{\transpose} outside of @code{\relative}, since
772 @code{\relative} will have no effect music that appears inside a
777 @subsection Bar check
780 @cindex @code{barCheckSynchronize}
783 Bar checks help detect errors in the durations. A bar check is
784 entered using the bar symbol, `@code{|}'. Whenever it is encountered
785 during interpretation, it should fall on a measure boundary. If it
786 does not, a warning is printed. In the next example, the second bar
787 check will signal an error
789 \time 3/4 c2 e4 | g2 |
792 Bar checks can also be used in lyrics, for example
797 Twin -- kle | Twin -- kle
801 Failed bar checks are caused by entering incorrect
802 durations. Incorrect durations often completely garble up the score,
803 especially if the score is polyphonic, so a good place to start correcting
804 input is by scanning for failed bar checks and incorrect durations.
807 @cindex @code{pipeSymbol}
809 It is also possible to redefine the meaning of @code{|}. This is done
810 by assigning a music expression to @code{pipeSymbol},
812 @lilypond[quote,ragged-right,verbatim]
813 pipeSymbol = \bar "||"
819 @node Barnumber check
820 @subsection Barnumber check
822 When copying large pieces of music, it can be helpful to check that
823 the LilyPond bar number corresponds to the original that you are
824 entering from. This can be checked with @code{\barNumberCheck}, for
832 will print a warning if the @code{currentBarNumber} is not 123 when it
836 @node Skipping corrected music
837 @subsection Skipping corrected music
840 @cindex @code{skipTypesetting}
841 @cindex @code{showLastLength}
843 When entering or copying music, usually only the music near the end (where you
844 are adding notes) is interesting to view and correct. To speed up
845 this correction process, it is possible to skip typesetting of all but
846 the last few measures. This is achieved by putting
849 showLastLength = R1*5
854 in your source file. This will render only the last 5 measures
855 (assuming 4/4 time signature) of every @code{\score} in the input
856 file. For longer pieces, rendering only a small part is often an order
857 of magnitude quicker than rendering it completely
859 Skipping parts of a score can be controlled in a more fine-grained
860 fashing with the property @code{Score.skipTypesetting}. When it is
861 set, no typesetting is performed at all.
863 @lilypond[quote,fragment,ragged-right,verbatim]
866 \set Score.skipTypesetting = ##t
868 \set Score.skipTypesetting = ##f
872 In polyphonic music, @code{Score.skipTypesetting} will affect all
873 voices and staves, saving even more time.
876 @node Automatic note splitting
877 @subsection Automatic note splitting
879 Long notes can be converted automatically to tied notes. This is done
880 by replacing the @internalsref{Note_heads_engraver} by the
881 @internalsref{Completion_heads_engraver}.
882 In the following examples, notes crossing the bar line are split and tied.
884 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
886 \remove "Note_heads_engraver"
887 \consists "Completion_heads_engraver"
889 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
893 This engraver splits all running notes at the bar line, and inserts
894 ties. One of its uses is to debug complex scores: if the measures are
895 not entirely filled, then the ties exactly show how much each measure
901 Not all durations (especially those containing tuplets) can be
902 represented exactly with normal notes and dots, but the engraver will
905 @code{Completion_heads_engraver} only affects notes; it does not split
911 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
915 Program reference: @internalsref{Completion_heads_engraver}.
918 @node Writing music in parallel
919 @subsection Writing music in parallel
920 @cindex Writing music in parallel
921 @cindex Interleaved music
923 Music for multiple parts can be interleaved
925 @lilypond[quote,fragment,verbatim,relative=1]
926 \parallelMusic #'(voiceA voiceB) {
927 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
929 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
933 \new Staff \new Voice \voiceA
934 \new Staff \new Voice \voiceB
940 @section Staff notation
942 @cindex Staff notation
944 This section describes music notation that occurs on staff level,
945 such as key signatures, clefs and time signatures.
954 * System start delimiters::
964 The clef indicates which lines of the staff correspond to which
965 pitches. The clef is set with the @code{\clef} command
967 @lilypond[quote,ragged-right,fragment,verbatim]
968 { c''2 \clef alto g'2 }
978 @cindex mezzosoprano clef
979 @cindex baritone clef
980 @cindex varbaritone clef
983 Supported clefs finclude
985 @item treble, violin, G, G2
994 G clef on 1st line, so-called French violin clef
1011 By adding @code{_8} or @code{^8} to the clef name, the clef is
1012 transposed one octave down or up, respectively, and @code{_15} and
1013 @code{^15} transposes by two octaves. The argument @var{clefname}
1014 must be enclosed in quotes when it contains underscores or digits. For
1017 @cindex choral tenor clef
1018 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1025 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
1026 @code{clefPosition} (which controls the Y position of the clef),
1027 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1028 when any of these properties are changed. The following example shows
1029 possibilities when setting properties manually.
1031 @lilypond[quote,ragged-right,verbatim]
1033 \set Staff.clefGlyph = #"clefs.F"
1034 \set Staff.clefPosition = #2
1036 \set Staff.clefGlyph = #"clefs.G"
1038 \set Staff.clefGlyph = #"clefs.C"
1040 \set Staff.clefOctavation = #7
1042 \set Staff.clefOctavation = #0
1043 \set Staff.clefPosition = #0
1047 \set Staff.middleCPosition = #4
1055 Program reference: @internalsref{Clef}.
1059 @subsection Key signature
1061 @cindex Key signature
1064 The key signature indicates the tonality in which a piece is played. It
1065 is denoted by a set of alterations (flats or sharps) at the start of the
1068 Setting or changing the key signature is done with the @code{\key}
1072 @code{\key} @var{pitch} @var{type}
1075 @cindex @code{\minor}
1076 @cindex @code{\major}
1077 @cindex @code{\minor}
1078 @cindex @code{\ionian}
1079 @cindex @code{\locrian}
1080 @cindex @code{\aeolian}
1081 @cindex @code{\mixolydian}
1082 @cindex @code{\lydian}
1083 @cindex @code{\phrygian}
1084 @cindex @code{\dorian}
1085 @cindex church modes
1087 Here, @var{type} should be @code{\major} or @code{\minor} to get
1088 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1089 use the standard mode names (also called ``church modes''): @code{\ionian},
1090 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1091 @code{\phrygian}, and @code{\dorian}.
1093 This command sets the context property
1094 @code{Staff.keySignature}. Non-standard key signatures
1095 can be specified by setting this property directly.
1097 Accidentals and key signatures often confuse new users, because
1098 unaltered notes get natural signs depending on the key signature. For
1099 more information, see @ref{More about pitches}.
1104 A natural sign is printed to cancel any previous accidentals. This
1105 can be suppressed by setting the @code{Staff.printKeyCancellation}
1108 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1113 \set Staff.printKeyCancellation = ##f
1123 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1126 @node Time signature
1127 @subsection Time signature
1129 @cindex Time signature
1131 @cindex @code{\time}
1133 Time signature indicates the metrum of a piece: a regular pattern of
1134 strong and weak beats. It is denoted by a fraction at the start of the
1137 The time signature is set with the @code{\time} command
1139 @lilypond[quote,ragged-right,fragment,verbatim]
1140 \time 2/4 c'2 \time 3/4 c'2.
1145 The symbol that is printed can be customized with the @code{style}
1146 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1149 @lilypond[fragment,quote,ragged-right,verbatim]
1152 \override Staff.TimeSignature #'style = #'()
1157 There are many more options for its layout. See @ref{Ancient time
1158 signatures} for more examples.
1160 @code{\time} sets the property @code{timeSignatureFraction},
1161 @code{beatLength} and @code{measureLength} in the @code{Timing}
1162 context, which is normally aliased to @internalsref{Score}. The
1163 property @code{measureLength} determines where bar lines should be
1164 inserted, and how automatic beams should be generated. Changing the
1165 value of @code{timeSignatureFraction} also causes the symbol to be
1168 More options are available through the Scheme function
1169 @code{set-time-signature}. In combination with the
1170 @internalsref{Measure_grouping_engraver}, it will create
1171 @internalsref{MeasureGrouping} signs. Such signs ease reading
1172 rhythmically complex modern music. In the following example, the 9/8
1173 measure is subdivided in 2, 2, 2 and 3. This is passed to
1174 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1176 @lilypond[quote,ragged-right,verbatim]
1179 #(set-time-signature 9 8 '(2 2 2 3))
1180 g8[ g] d[ d] g[ g] a8[( bes g]) |
1181 #(set-time-signature 5 8 '(3 2))
1187 \consists "Measure_grouping_engraver"
1195 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
1200 Automatic beaming does not use the measure grouping specified with
1201 @code{set-time-signature}.
1204 @node Partial measures
1205 @subsection Partial measures
1209 @cindex partial measure
1210 @cindex measure, partial
1211 @cindex shorten measures
1212 @cindex @code{\partial}
1214 Partial measures, such as an anacrusis or upbeat, are entered using the
1216 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1217 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1220 The syntax for this command is
1223 \partial @var{duration}
1226 This is internally translated into
1229 \set Timing.measurePosition = -@var{length of duration}
1232 The property @code{measurePosition} contains a rational number
1233 indicating how much of the measure has passed at this point.
1238 This command does not take into account grace notes at the start of
1239 the music. When a piece starts with graces notes in the pickup, then
1240 the @code{\partial} should follow the grace notes
1242 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1251 @subsection Bar lines
1255 @cindex measure lines
1258 Bar lines delimit measures, but are also used to indicate
1259 repeats. Normally they are inserted automatically. Line
1260 breaks may only happen on bar lines.
1262 Special types of bar lines can be forced with the @code{\bar} command
1264 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1268 The following bar types are available
1270 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1272 To allow a line break where there is no visible bar line, use
1279 This will insert an invisible bar line and allow line breaks at this
1282 In scores with many staves, a @code{\bar} command in one staff is
1283 automatically applied to all staves. The resulting bar lines are
1284 connected between different staves of a StaffGroup
1286 @lilypond[quote,ragged-right,fragment,verbatim]
1294 \new Staff { \clef bass c4 g e g }
1296 \new Staff { \clef bass c2 c2 }
1303 @cindex @code{whichBar}
1304 @cindex @code{repeatCommands}
1305 @cindex @code{defaultBarType}
1307 The command @code{\bar }@var{bartype} is a short cut for doing
1308 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1309 is set to a string, a bar line of that type is created.
1311 A bar line is created whenever the @code{whichBar} property is set.
1312 At the start of a measure it is set to the contents of
1313 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1314 to override default measure bars.
1316 You are encouraged to use @code{\repeat} for repetitions. See
1322 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1324 Program reference: @internalsref{BarLine} (created at
1325 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1327 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1330 @node Unmetered music
1331 @subsection Unmetered music
1334 @cindex @code{\cadenzaOn}
1335 @cindex @code{\cadenzaOff}
1337 Bar lines and bar numbers are calculated automatically. For unmetered
1338 music (cadenzas, for example), this is not desirable. To turn off
1339 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1340 and @code{\cadenzaOff}.
1342 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1354 LilyPond will only insert page breaks at a barline. Unless the unmetered
1355 music ends before the end of the staff line, you will need to insert
1363 to indicate where line breaks can occur.
1366 @node System start delimiters
1367 @subsection System start delimiters
1369 @cindex start of system
1370 @cindex Staff, multiple
1371 @cindex bracket, vertical
1372 @cindex brace, vertical
1375 @cindex staff, choir
1377 Many scores consist of more than one staff. These staves can be
1378 joined in four different ways
1381 @item The group is started with a brace at the left, and bar lines are
1382 connected. This is done with the @internalsref{GrandStaff} context.
1384 @lilypond[verbatim,ragged-right,quote]
1392 @item The group is started with a bracket, and bar lines are connected.
1393 This is done with the
1394 @internalsref{StaffGroup} context
1396 @lilypond[verbatim,ragged-right,quote]
1404 @item The group is started with a bracket, but bar lines are not
1405 connected. This is done with the @internalsref{ChoirStaff} context.
1407 @lilypond[verbatim,ragged-right,quote]
1415 @item The group is started with a vertical line. Bar lines are not
1416 connected. This is the default for the score.
1418 @lilypond[verbatim,ragged-right,quote]
1429 The bar lines at the start of each system are
1430 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1431 @internalsref{SystemStartBracket}. Only one of these types is created
1432 in every context, and that type is determined by the property
1433 @code{systemStartDelimiter}.
1437 @subsection Staff symbol
1439 @cindex adjusting staff symbol
1441 Notes, dynamic signs, etc., are grouped
1442 with a set of horizontal lines, called a staff (plural `staves'). In
1443 LilyPond, these lines are drawn using a separate layout object called
1446 The staff symbol may be tuned in the number, thickness and distance
1447 of lines, using properties. This is demonstrated in the example files
1448 @inputfileref{input/@/test,staff@/-lines@/.ly},
1449 @inputfileref{input/@/test,staff@/-size@/.ly}.
1451 In addition, staves may be started and stopped at will. This is done
1452 with @code{\startStaff} and @code{\stopStaff}.
1454 @lilypond[verbatim,relative=2,fragment]
1456 \override Staff.StaffSymbol #'line-count = 2
1457 \stopStaff \startStaff
1459 \revert Staff.StaffSymbol #'line-count
1460 \stopStaff \startStaff
1464 In combination with Frenched staves, this may be used to typeset ossia
1465 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1470 @lilypondfile{ossia.ly}
1472 @cindex staff lines, setting number of
1473 @cindex staff lines, setting thickness of
1474 @cindex thickness of staff lines, setting
1475 @cindex number of staff lines, setting
1479 Program reference: @internalsref{StaffSymbol}.
1481 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1482 @inputfileref{input/@/test@/,ossia.ly},
1483 @inputfileref{input/@/test,staff@/-size@/.ly}.
1487 @node Connecting notes
1488 @section Connecting notes
1490 This section deals with notation that affects groups of notes.
1496 * Laissez vibrer ties::
1509 A tie connects two adjacent note heads of the same pitch. The tie in
1510 effect extends the length of a note. Ties should not be confused with
1511 slurs, which indicate articulation, or phrasing slurs, which indicate
1512 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1514 @lilypond[quote,ragged-right,fragment,verbatim]
1515 e' ~ e' <c' e' g'> ~ <c' e' g'>
1518 When a tie is applied to a chord, all note heads whose pitches match
1519 are connected. When no note heads match, no ties will be created.
1521 A tie is just a way of extending a note duration, similar to the
1522 augmentation dot. The following example shows two ways of notating
1523 exactly the same concept
1525 @lilypond[quote,fragment,ragged-right]
1526 \time 3/4 c'2. c'2 ~ c'4
1530 Ties are used either when the note crosses a bar line, or when dots
1531 cannot be used to denote the rhythm. When using ties, larger note
1532 values should be aligned to subdivisions of the measure, eg.
1534 @lilypond[fragment,quote,ragged-right]
1536 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1540 If you need to tie a lot of notes over bars, it may be easier to use
1541 automatic note splitting (see @ref{Automatic note splitting}). This
1542 mechanism automatically splits long notes, and ties them across bar
1545 When a second alternative of a repeat starts with a tied note, you
1546 have to repeat the tie. This can be achieved with @code{\repeatTie},
1549 @lilypond[fragment,quote,ragged-right,relative=2]
1553 @cindex repeating ties
1554 @cindex volta brackets and ties
1558 Ties are sometimes used to write out arpeggios. In this case, two tied
1559 notes need not be consecutive. This can be achieved by setting the
1560 @code{tieWaitForNote} property to true. The same feature is also useful,
1561 for example, to tie a tremolo to a chord. For example,
1563 @lilypond[fragment,verbatim,relative=1,ragged-right]
1564 \set tieWaitForNote = ##t
1565 \grace { c16[~ e~ g]~ } <c, e g>2
1566 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1573 @cindex @code{\tieUp}
1575 @cindex @code{\tieDown}
1577 @cindex @code{\tieNeutral}
1579 @cindex @code{\tieDotted}
1581 @cindex @code{\tieDashed}
1583 @cindex @code{\tieSolid}
1589 In this manual: @ref{Automatic note splitting}.
1591 Program reference: @internalsref{Tie}.
1594 @inputfileref{input/@/regression,tie-arpeggio.ly}
1595 @inputfileref{input/@/regression,tie-manual.ly}
1602 Switching staves when a tie is active will not produce a slanted tie.
1610 A slur indicates that notes are to be played bound or
1611 @emph{legato}. They are entered using parentheses
1613 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1614 f( g a) a8 b( a4 g2 f4)
1618 The direction of a slur can be specified with
1619 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1620 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1623 However, there is a convenient shorthand for forcing slur
1624 directions. By adding @code{_} or @code{^} before the opening
1625 parentheses, the direction is also set. For example,
1627 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1631 Only one slur can be printed at once. If you need to print a long
1632 slur over a few small slurs, please see @ref{Phrasing slurs}.
1637 Some composers write two slurs when they want legato chords. This can
1638 be achieved in LilyPond by setting @code{doubleSlurs},
1640 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1641 \set doubleSlurs = ##t
1642 <c e>4 ( <d f> <c e> <d f> )
1648 @cindex @code{\slurUp}
1650 @cindex @code{\slurDown}
1652 @cindex @code{\slurNeutral}
1653 @code{\slurNeutral},
1654 @cindex @code{\slurDashed}
1656 @cindex @code{\slurDotted}
1658 @cindex @code{\slurSolid}
1663 Program reference: @seeinternals{Slur}.
1666 @node Phrasing slurs
1667 @subsection Phrasing slurs
1669 @cindex phrasing slurs
1670 @cindex phrasing marks
1672 A phrasing slur (or phrasing mark) connects notes and is used to
1673 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1676 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1677 \time 6/4 c'\( d( e) f( e) d\)
1680 Typographically, the phrasing slur behaves almost exactly like a
1681 normal slur. However, they are treated as different objects. A
1682 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1683 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1684 @code{\phrasingSlurNeutral}.
1686 You cannot have simultaneous phrasing slurs.
1691 @cindex @code{\phrasingSlurUp}
1692 @code{\phrasingSlurUp},
1693 @cindex @code{\phrasingSlurDown}
1694 @code{\phrasingSlurDown},
1695 @cindex @code{\phrasingSlurNeutral}
1696 @code{\phrasingSlurNeutral}.
1701 Program reference: @internalsref{PhrasingSlur}.
1704 @node Laissez vibrer ties
1705 @subsection Laissez vibrer ties
1706 @cindex Laissez vibrer
1707 @cindex Ties, laissez vibrer
1709 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
1710 end. It is used in notation for piano, harp and other string and
1711 percussion instruments. They can be entered using @code{\laissezVibrer},
1713 @lilypond[fragment,ragged-right,verbatim,relative=1]
1714 <c f g>\laissezVibrer
1720 @internalsref{LaissezVibrerTie}
1721 @internalsref{LaissezVibrerTieColumn}
1724 @inputfileref{input/regression,laissez-vibrer-tie.ly}
1727 @node Automatic beams
1728 @subsection Automatic beams
1730 LilyPond inserts beams automatically
1732 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1733 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1736 When these automatic decisions are not good enough, beaming can be
1737 entered explicitly. It is also possible to define beaming patterns
1738 that differ from the defaults. See @ref{Setting automatic beam behavior}
1741 Individual notes may be marked with @code{\noBeam} to prevent them
1744 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1745 \time 2/4 c8 c\noBeam c c
1751 Program reference: @internalsref{Beam}.
1755 @subsection Manual beams
1757 @cindex beams, manual
1761 In some cases it may be necessary to override the automatic beaming
1762 algorithm. For example, the autobeamer will not put beams over rests
1763 or bar lines. Such beams are specified manually by marking the begin
1764 and end point with @code{[} and @code{]}
1766 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1768 r4 r8[ g' a r8] r8 g[ | a] r8
1775 @cindex @code{stemLeftBeamCount}
1776 @cindex @code{stemRightBeamCount}
1778 Normally, beaming patterns within a beam are determined automatically.
1779 If necessary, the properties @code{stemLeftBeamCount} and
1780 @code{stemRightBeamCount} can be used to override the defaults. If
1781 either property is set, its value will be used only once, and then it
1784 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1789 \set stemLeftBeamCount = #1
1794 The property @code{subdivideBeams} can be set in order to subdivide
1795 all 16th or shorter beams at beat positions, as defined by the
1796 @code{beatLength} property.
1798 @lilypond[fragment,quote,relative=2,verbatim]
1800 \set subdivideBeams = ##t
1802 \set Score.beatLength = #(ly:make-moment 1 8)
1805 @cindex @code{subdivideBeams}
1808 For more information about @code{make-moment}, see
1809 @ref{Time administration}.
1811 Line breaks are normally forbidden when beams cross bar lines. This
1812 behavior can be changed by setting @code{allowBeamBreak}.
1814 @cindex @code{allowBeamBreak}
1815 @cindex beams and line breaks
1816 @cindex beams, kneed
1818 @cindex auto-knee-gap
1823 Kneed beams are inserted automatically when a large gap is detected
1824 between the note heads. This behavior can be tuned through the object.
1826 Automatically kneed cross-staff beams cannot be used together with
1827 hidden staves. See @ref{Hiding staves}.
1829 Beams do not avoid collisions with symbols around the notes, such as
1830 texts and accidentals.
1834 @subsection Grace notes
1836 @cindex @code{\grace}
1839 @cindex appoggiatura
1840 @cindex acciaccatura
1842 Grace notes are ornaments that are written out. The most common ones
1843 are acciaccatura, which should be played as very short. It is denoted
1844 by a slurred small note with a slashed stem. The appoggiatura is a
1845 grace note that takes a fixed fraction of the main note, and is
1846 denoted as a slurred note in small print without a slash. They
1847 are entered with the commands @code{\acciaccatura} and
1848 @code{\appoggiatura}, as demonstrated in the following example
1850 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1851 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1852 \acciaccatura { g16[ f] } e4
1855 Both are special forms of the @code{\grace} command. By prefixing this
1856 keyword to a music expression, a new one is formed, which will be
1857 printed in a smaller font and takes up no logical time in a measure.
1859 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1861 \grace { c16[ d16] } c2 c4
1865 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1866 @code{\grace} command does not start a slur.
1868 Internally, timing for grace notes is done using a second, `grace'
1869 timing. Every point in time consists of two rational numbers: one
1870 denotes the logical time, one denotes the grace timing. The above
1871 example is shown here with timing tuples
1873 @lilypond[quote,ragged-right]
1876 c4 \grace c16 c4 \grace {
1879 \new Lyrics \lyricmode {
1880 \override LyricText #'font-family = #'typewriter
1884 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1885 \markup { (\fraction 1 4 , 0 ) } 4
1887 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1888 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1890 \markup { ( \fraction 2 4 , 0 ) }
1895 The placement of grace notes is synchronized between different staves.
1896 In the following example, there are two sixteenth grace notes for
1897 every eighth grace note
1899 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1900 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1901 \new Staff { c4 \grace { g8[ b] } c4 } >>
1904 @cindex @code{\afterGrace}
1906 If you want to end a note with a grace, use the @code{\afterGrace}
1907 command. It takes two arguments: the main note, and the grace notes
1908 following the main note.
1910 @lilypond[ragged-right, verbatim,relative=2,fragment]
1911 c1 \afterGrace d1 { c16[ d] } c4
1914 This will put the grace notes after a ``space'' lasting 3/4 of the
1915 length of the main note. The fraction 3/4 can be changed by setting
1916 @code{afterGraceFraction}, ie.
1919 afterGraceFraction = #(cons 7 8)
1923 will put the grace note at 7/8 of the main note.
1925 The same effect can be achieved manually by doing
1927 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1930 { s2 \grace { c16[ d] } } >>
1936 By adjusting the duration of the skip note (here it is a half-note),
1937 the space between the main-note and the grace is adjusted.
1939 A @code{\grace} section will introduce special typesetting settings,
1940 for example, to produce smaller type, and set directions. Hence, when
1941 introducing layout tweaks, they should be inside the grace section,
1943 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1955 The overrides should also be reverted inside the grace section.
1957 The layout of grace sections can be changed throughout the music using
1958 the function @code{add-grace-property}. The following example
1959 undefines the Stem direction for this grace, so stems do not always
1964 #(add-grace-property 'Voice 'Stem 'direction '())
1970 Another option is to change the variables @code{startGraceMusic},
1971 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1972 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1973 @code{stopAppoggiaturaMusic}. More information is in the file
1974 @file{ly/@/grace@/-init@/.ly}.
1977 The slash through the stem in acciaccaturas can be obtained
1978 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
1982 Program reference: @internalsref{GraceMusic}.
1987 A score that starts with a @code{\grace} section needs an explicit
1988 @code{\new Voice} declaration, otherwise the main note and the grace
1989 note end up on different staves.
1991 Grace note synchronization can also lead to surprises. Staff notation,
1992 such as key signatures, bar lines, etc., are also synchronized. Take
1993 care when you mix staves with grace notes and staves without, for example,
1995 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1996 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1997 \new Staff { c4 \bar "|:" d4 } >>
2001 This can be remedied by inserting grace skips of the corresponding
2002 durations in the other staves. For the above example
2005 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2008 Grace sections should only be used within sequential music
2009 expressions. Nesting or juxtaposing grace sections is not supported,
2010 and might produce crashes or other errors.
2014 @node Expressive marks
2015 @section Expressive marks
2017 Expressive marks help musicians to bring more to the music than simple
2022 * Fingering instructions::
2032 @subsection Articulations
2034 @cindex Articulations
2038 A variety of symbols can appear above and below notes to indicate
2039 different characteristics of the performance. They are added to a note
2040 by adding a dash and the character signifying the
2041 articulation. They are demonstrated here
2043 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2045 The meanings of these shorthands can be changed. See
2046 @file{ly/@/script@/-init@/.ly} for examples.
2048 The script is automatically placed, but the direction can be forced as
2049 well. Like other pieces of LilyPond code, @code{_} will place them
2050 below the staff, and @code{^} will place them above.
2052 @lilypond[quote,ragged-right,fragment,verbatim]
2056 Other symbols can be added using the syntax
2057 @var{note}@code{\}@var{name}. Again, they
2058 can be forced up or down using @code{^} and @code{_},
2061 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2062 c\fermata c^\fermata c_\fermata
2067 @cindex staccatissimo
2077 @cindex organ pedal marks
2086 @cindex prallmordent
2090 @cindex thumb marking
2095 Here is a chart showing all scripts available,
2097 @lilypondfile[ragged-right,quote]{script-chart.ly}
2102 The vertical ordering of scripts is controlled with the
2103 @code{script-priority} property. The lower this number, the closer it
2104 will be put to the note. In this example, the
2105 @internalsref{TextScript} (the sharp symbol) first has the lowest
2106 priority, so it is put lowest in the first example. In the second, the
2107 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2108 inside. When two objects have the same priority, the order in which
2109 they are entered decides which one comes first.
2111 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2112 \once \override TextScript #'script-priority = #-100
2113 a4^\prall^\markup { \sharp }
2115 \once \override Script #'script-priority = #-100
2116 a4^\prall^\markup { \sharp }
2122 Program reference: @internalsref{Script}.
2127 These signs appear in the printed output but have no effect on the
2128 MIDI rendering of the music.
2131 @node Fingering instructions
2132 @subsection Fingering instructions
2135 @cindex finger change
2137 Fingering instructions can be entered using
2139 @var{note}-@var{digit}
2141 For finger changes, use markup texts
2143 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2145 c^\markup { \finger "2 - 3" }
2148 You can use the thumb-script to indicate that a note should be
2149 played with the thumb (e.g., in cello music)
2150 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2151 <a_\thumb a'-3>8 <b_\thumb b'-3>
2154 Fingerings for chords can also be added to individual notes
2155 of the chord by adding them after the pitches
2156 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2157 < c-1 e-2 g-3 b-5 >4
2163 You may exercise greater control over fingering chords by
2164 setting @code{fingeringOrientations}
2166 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2167 \set fingeringOrientations = #'(left down)
2168 <c-1 es-2 g-4 bes-5 > 4
2169 \set fingeringOrientations = #'(up right down)
2170 <c-1 es-2 g-4 bes-5 > 4
2173 Using this feature, it is also possible to put fingering instructions
2174 very close to note heads in monophonic music,
2176 @lilypond[verbatim,ragged-right,quote,fragment]
2177 \set fingeringOrientations = #'(right)
2184 Program reference: @internalsref{Fingering}.
2186 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2190 @subsection Dynamics
2201 @cindex @code{\ffff}
2210 Absolute dynamic marks are specified using a command after a note
2211 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2212 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2213 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2214 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2216 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2217 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2218 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2225 A crescendo mark is started with @code{\<} and terminated with
2226 @code{\!} or an absolute dynamic. A decrescendo is started with
2227 @code{\>} and is also terminated with @code{\!} or an absolute
2228 dynamic. Because these marks are bound to notes, you must
2229 use spacer notes if multiple marks are needed during one note
2231 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2233 << f1 { s4 s4\< s4\! \> s4\! } >>
2237 A hairpin starts at the left edge of the beginning note and ends on the
2238 right edge of the ending note.
2240 This may give rise to very short hairpins. Use @code{minimum-length}
2241 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2245 \override Staff.Hairpin #'minimum-length = #5
2252 You can also use a text saying @emph{cresc.} instead of hairpins
2254 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2265 You can also supply your own texts
2266 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2267 \set crescendoText = \markup { \italic "cresc. poco" }
2268 \set crescendoSpanner = #'dashed-line
2272 To create new dynamic marks or text that should be aligned
2273 with dynamics, see @ref{New dynamic marks}.
2278 Dynamics that occur at, begin on, or end on, the same note
2279 will be vertically aligned. If you want to ensure that dynamics
2280 are aligned when they do not occur on the same note, you can
2281 increase the @code{staff-padding} property.
2284 \override DynamicLineSpanner #'staff-padding = #4
2287 You may also use this property if the dynamics are colliding
2288 with other notation.
2290 Crescendi and decrescendi that end on the first note of a
2291 new line are not printed. To change this behavior, use
2294 \override Score.Hairpin #'after-line-breaking = ##t
2300 @cindex @code{\dynamicUp}
2302 @cindex @code{\dynamicDown}
2303 @code{\dynamicDown},
2304 @cindex @code{\dynamicNeutral}
2305 @code{\dynamicNeutral}.
2310 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2311 Vertical positioning of these symbols is handled by
2312 @internalsref{DynamicLineSpanner}.
2316 @subsection Breath marks
2318 Breath marks are entered using @code{\breathe}
2320 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2327 The glyph of the breath mark can be tuned by overriding the
2328 @code{text} property of the @code{BreathingSign} layout object with
2329 any markup text. For example,
2330 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2332 \override BreathingSign #'text
2333 = #(make-musicglyph-markup "scripts.rvarcomma")
2340 Program reference: @internalsref{BreathingSign}.
2342 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2348 Short trills are printed like normal articulation; see @ref{Articulations}.
2350 Long running trills are made with @code{\startTrillSpan} and
2351 @code{\stopTrillSpan},
2353 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2355 << { c1 \startTrillSpan }
2356 { s2. \grace { d16[\stopTrillSpan e] } } >>
2360 @cindex Pitched trills
2362 Trills that should be executed on an explicitly specified pitch can be
2363 typeset with the command @code{pitchedTrill},
2365 @lilypond[ragged-right,verbatim,fragment,relative=1]
2366 \pitchedTrill c4\startTrillSpan fis
2370 The first argument is the main note. The pitch of the second
2371 is printed as a stemless note head in parentheses.
2376 @code{\startTrillSpan},
2377 @cindex @code{\startTrillSpan}
2378 @code{\stopTrillSpan}.
2379 @cindex @code{\stopTrillSpan}
2384 Program reference: @internalsref{TrillSpanner}.
2388 @subsection Glissando
2391 @cindex @code{\glissando}
2393 A glissando is a smooth change in pitch. It is denoted by a line or a
2394 wavy line between two notes. It is requested by attaching
2395 @code{\glissando} to a note
2397 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2399 \override Glissando #'style = #'zigzag
2406 Program reference: @internalsref{Glissando}.
2408 Example files: @file{input/@/regression/@/glissando@/.ly}.
2413 Printing text over the line (such as @emph{gliss.}) is not supported.
2417 @subsection Arpeggio
2420 @cindex broken chord
2421 @cindex @code{\arpeggio}
2423 You can specify an arpeggio sign (also known as broken chord) on a
2424 chord by attaching an @code{\arpeggio} to a chord
2426 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2430 A square bracket on the left indicates that the player should not
2431 arpeggiate the chord
2433 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2438 The direction of the arpeggio is sometimes denoted by adding an
2439 arrowhead to the wiggly line
2441 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2453 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2454 in both staves and set
2455 @internalsref{PianoStaff}.@code{connectArpeggios}
2457 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2459 \set PianoStaff.connectArpeggios = ##t
2460 \new Staff { <c' e g c>\arpeggio }
2461 \new Staff { \clef bass <c,, e g>\arpeggio }
2469 @cindex @code{\arpeggioUp}
2471 @cindex @code{\arpeggioDown}
2472 @code{\arpeggioDown},
2473 @cindex @code{\arpeggioNeutral}
2474 @code{\arpeggioNeutral},
2475 @cindex @code{\arpeggioBracket}
2476 @code{\arpeggioBracket}.
2481 Notation manual: @ref{Ties}, for writing out arpeggios.
2483 Program reference: @internalsref{Arpeggio}.
2488 It is not possible to mix connected arpeggios and unconnected
2489 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2496 Polyphony in music refers to having more than one voice occuring in
2497 a piece of music. Polyphony in LilyPond refers to having more than
2498 one voice on the same staff.
2502 * Explicitly instantiating voices::
2503 * Collision Resolution::
2507 @node Basic polyphony
2508 @subsection Basic polyphony
2512 The easiest way to enter fragments with more than one voice on a staff
2513 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2514 them simultaneously, separating the voices with @code{\\}
2518 @lilypond[quote,verbatim,fragment]
2519 \new Staff \relative c' {
2522 { g4 f e | d2 e2 } \\
2523 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2529 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2530 voices are sometimes called ``layers'' in other notation packages}
2532 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2533 each of these contexts, vertical direction of slurs, stems, etc., is set
2536 These voices are all seperate from the voice that contains the notes just
2537 outside the @code{<< \\ >>} construct. This should be noted when making
2538 changes at the voice level. This also means that slurs and ties cannot go
2539 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2540 from separate @code{<< \\ >>} constructs on the same staff are the the
2541 same voice. Here is the same example, with different noteheads for each
2542 voice. Note that the change to the note-head style in the main voice does not affect
2543 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2544 voice in the first @code{<< \\ >>} construct is effective in the second
2545 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2547 @lilypond[quote,verbatim,fragment]
2548 \new Staff \relative c' {
2549 \override NoteHead #'style = #'cross
2553 { \override NoteHead #'style = #'triangle
2558 { c8 b16 a b8 g ~ g2 } \\
2559 { \override NoteHead #'style = #'slash s4 b4 c2 }
2564 Polyphony does not change the relationship of notes within a
2565 @code{\relative @{ @}} block. Each note is calculated relative
2566 to the note immediately preceding it.
2569 \relative @{ noteA << noteB \\ noteC >> noteD @}
2572 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2573 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2576 @node Explicitly instantiating voices
2577 @subsection Explicitly instantiating voices
2579 @internalsref{Voice} contexts can also be instantiated manually
2580 inside a @code{<< >>} block to create polyphonic music, using
2581 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2582 and a horizontal shift for each part.
2586 << \upper \\ \lower >>
2594 \new Voice = "1" @{ \voiceOne \upper @}
2595 \new Voice = "2" @{ \voiceTwo \lower @}
2599 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2600 articulations, text annotations, augmentation dots of dotted
2601 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2602 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2603 make them point downwards.
2604 The command @code{\oneVoice} will revert back to the normal setting.
2606 An expression that appears directly inside a @code{<< >>} belongs to
2607 the main voice. This is useful when extra voices appear while the main
2608 voice is playing. Here is a more correct rendition of the example from
2609 the previous section. The crossed noteheads demonstrate that the main
2610 melody is now in a single voice context.
2612 @lilypond[quote,ragged-right,verbatim]
2613 \new Staff \relative c' {
2614 \override NoteHead #'style = #'cross
2619 \new Voice="1" { \voiceTwo
2620 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2623 \new Voice { \voiceThree
2632 The correct definition of the voices allows the melody to be slurred.
2633 @lilypond[quote,ragged-right,verbatim]
2634 \new Staff \relative c' {
2639 \context Voice="1" { \voiceTwo
2640 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2643 \new Voice { \voiceThree
2652 Avoiding the @code{\\} seperator also allows nesting polyphony
2653 constructs, which in some case might be a more natural way to typeset
2656 @lilypond[quote,ragged-right,verbatim]
2657 \new Staff \relative c' {
2662 \context Voice="1" { \voiceTwo
2665 {c8 b16 a b8 g ~ g2}
2666 \new Voice { \voiceThree
2679 @node Collision Resolution
2680 @subsection Collision Resolution
2682 Normally, note heads with a different number of dots are not merged, but
2683 when the object property @code{merge-differently-dotted} is set in
2684 the @internalsref{NoteCollision} object, they are merged
2685 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
2688 \override Staff.NoteCollision
2689 #'merge-differently-dotted = ##t
2691 } \\ { g8.[ f16] g8.[ f16] } >>
2694 Similarly, you can merge half note heads with eighth notes, by setting
2695 @code{merge-differently-headed}
2696 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2699 \override Staff.NoteCollision
2700 #'merge-differently-headed = ##t
2701 c8 c4. } \\ { c2 c2 } >>
2704 LilyPond also vertically shifts rests that are opposite of a stem,
2707 @lilypond[quote,ragged-right,fragment,verbatim]
2708 \new Voice << c''4 \\ r4 >>
2714 @cindex @code{\oneVoice}
2716 @cindex @code{\voiceOne}
2718 @cindex @code{\voiceTwo}
2720 @cindex @code{\voiceThree}
2722 @cindex @code{\voiceFour}
2725 @cindex @code{\shiftOn}
2727 @cindex @code{\shiftOnn}
2729 @cindex @code{\shiftOnnn}
2731 @cindex @code{\shiftOff}
2732 @code{\shiftOff}: these commands specify in what chords of the current
2733 voice should be shifted. The outer voices (normally: voice one and
2734 two) have @code{\shiftOff}, while the inner voices (three and four)
2735 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2736 further shift levels.
2738 When LilyPond cannot cope, the @code{force-hshift}
2739 property of the @internalsref{NoteColumn} object and pitched rests can
2740 be used to override typesetting decisions.
2742 @lilypond[quote,verbatim,ragged-right]
2749 \once \override NoteColumn #'force-hshift = #1.7
2757 Program reference: the objects responsible for resolving collisions are
2758 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2761 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2762 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2763 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2764 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2765 @inputfileref{input/@/regression,collisions@/.ly}.
2770 When using @code{merge-differently-headed} with an upstem eighth or a
2771 shorter note, and a downstem half note, the eighth note gets the wrong
2774 There is no support for clusters where the same note occurs with
2775 different accidentals in the same chord. In this case, it is
2776 recommended to use enharmonic transcription, or to use special cluster
2777 notation (see @ref{Clusters}).
2784 Repetition is a central concept in music, and multiple notations exist
2790 * Repeats and MIDI::
2791 * Manual repeat commands::
2793 * Tremolo subdivisions::
2799 @subsection Repeat types
2802 @cindex @code{\repeat}
2804 The following types of repetition are supported
2808 Repeated music is fully written (played) out. This is useful when
2809 entering repetitious music. This is the only kind of repeat that
2810 is included in MIDI output.
2813 Repeats are not written out, but alternative endings (volte) are
2814 printed, left to right with brackets. This is the standard notation
2815 for repeats with alternatives. These are not played in MIDI output by default.
2819 Alternative endings are written stacked. This has limited use but may be
2820 used to typeset two lines of lyrics in songs with repeats, see
2821 @inputfileref{input,star-spangled-banner@/.ly}.
2825 Make tremolo beams. These are not played in MIDI output by default.
2828 Make beat or measure repeats. These look like percent signs. These
2829 are not played in MIDI output by default. Percent repeats must be
2830 declared within a Voice context.
2836 @subsection Repeat syntax
2838 LilyPond has one syntactic construct for specifying different types of
2839 repeats. The syntax is
2842 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2845 If you have alternative endings, you may add
2846 @cindex @code{\alternative}
2857 where each @var{alternative} is a music expression. If you do not
2858 give enough alternatives for all of the repeats, the first alternative
2859 is assumed to be played more than once.
2861 Standard repeats are used like this
2862 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2864 \repeat volta 2 { c4 d e f }
2865 \repeat volta 2 { f e d c }
2868 With alternative endings
2869 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2871 \repeat volta 2 {c4 d e f}
2872 \alternative { {d2 d} {f f,} }
2875 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2878 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2879 \alternative { { g4 g g } { a | a a a a | b2. } }
2883 It is possible to shorten volta brackets
2884 by setting @code{voltaSpannerDuration}. In the next example, the
2885 bracket only lasts one measure, which is a duration of 3/4.
2887 @lilypond[verbatim,ragged-right,quote]
2891 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2892 \repeat "volta" 5 { d d d }
2893 \alternative { { e e e f f f }
2903 Brackets for the repeat are normally only printed over the topmost
2904 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2905 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2910 @cindex repeat, ambiguous
2912 A nested repeat like
2921 is ambiguous, since it is is not clear to which @code{\repeat} the
2922 @code{\alternative} belongs. This ambiguity is resolved by always
2923 having the @code{\alternative} belong to the inner @code{\repeat}.
2924 For clarity, it is advisable to use braces in such situations.
2926 Timing information is not remembered at the start of an alternative,
2927 so after a repeat timing information must be reset by hand, for
2928 example by setting @code{Score.measurePosition} or entering
2929 @code{\partial}. Similarly, slurs or ties are also not repeated.
2932 @node Repeats and MIDI
2933 @subsection Repeats and MIDI
2935 @cindex expanding repeats
2936 @cindex @code{\unfoldRepeats}
2938 With a little bit of tweaking, all types of repeats can be present
2939 in the MIDI output. This is achieved by applying the
2940 @code{\unfoldRepeats} music function. This functions changes all
2941 repeats to unfold repeats.
2943 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2945 \repeat tremolo 8 {c'32 e' }
2946 \repeat percent 2 { c''8 d'' }
2947 \repeat volta 2 {c'4 d' e' f'}
2956 When creating a score file using @code{\unfoldRepeats} for midi, then
2957 it is necessary to make two @code{\score} blocks. One for MIDI (with
2958 unfolded repeats) and one for notation (with volta, tremolo, and
2959 percent repeats). For example,
2967 \unfoldRepeats @var{..music..}
2973 @node Manual repeat commands
2974 @subsection Manual repeat commands
2976 @cindex @code{repeatCommands}
2978 The property @code{repeatCommands} can be used to control the layout of
2979 repeats. Its value is a Scheme list of repeat commands.
2982 @item @code{start-repeat}
2983 Print a @code{|:} bar line.
2985 @item @code{end-repeat}
2986 Print a @code{:|} bar line.
2988 @item @code{(volta @var{text})}
2989 Print a volta bracket saying @var{text}: The text can be specified as
2990 a text string or as a markup text, see @ref{Text markup}. Do not
2991 forget to change the font, as the default number font does not contain
2992 alphabetic characters;
2994 @item @code{(volta #f)}
2995 Stop a running volta bracket.
2998 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3000 \set Score.repeatCommands = #'((volta "93") end-repeat)
3002 \set Score.repeatCommands = #'((volta #f))
3009 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
3010 @internalsref{VoltaRepeatedMusic},
3011 @internalsref{UnfoldedRepeatedMusic}, and
3012 @internalsref{FoldedRepeatedMusic}.
3015 @node Tremolo repeats
3016 @subsection Tremolo repeats
3018 @cindex tremolo beams
3020 To place tremolo marks between notes, use @code{\repeat} with tremolo
3022 @lilypond[quote,verbatim,ragged-right]
3023 \new Voice \relative c' {
3024 \repeat "tremolo" 8 { c16 d16 }
3025 \repeat "tremolo" 4 { c16 d16 }
3026 \repeat "tremolo" 2 { c16 d16 }
3030 Tremolo marks can also be put on a single note. In this case, the
3031 note should not be surrounded by braces.
3032 @lilypond[quote,verbatim,ragged-right]
3033 \repeat "tremolo" 4 c'16
3036 Similar output is obtained using the tremolo subdivision, described in
3037 @ref{Tremolo subdivisions}.
3042 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3044 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3046 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3047 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3050 @node Tremolo subdivisions
3051 @subsection Tremolo subdivisions
3053 @cindex tremolo marks
3054 @cindex @code{tremoloFlags}
3056 Tremolo marks can be printed on a single note by adding
3057 `@code{:}[@var{number}]' after the note. The number indicates the
3058 duration of the subdivision, and it must be at least 8. A
3059 @var{length} value of 8 gives one line across the note stem. If the
3060 length is omitted, the last value (stored in @code{tremoloFlags}) is
3063 @lilypond[quote,ragged-right,verbatim,fragment]
3064 c'2:8 c':32 | c': c': |
3070 Tremolos entered in this way do not carry over into the MIDI output.
3075 In this manual: @ref{Tremolo repeats}.
3077 Elsewhere: @internalsref{StemTremolo}.
3080 @node Measure repeats
3081 @subsection Measure repeats
3083 @cindex percent repeats
3084 @cindex measure repeats
3086 In the @code{percent} style, a note pattern can be repeated. It is
3087 printed once, and then the pattern is replaced with a special sign.
3088 Patterns of one and two measures are replaced by percent-like signs,
3089 patterns that divide the measure length are replaced by slashes.
3090 Percent repeats must be declared within a @code{Voice} context.
3092 @lilypond[quote,verbatim,ragged-right]
3093 \new Voice \relative c' {
3094 \repeat "percent" 4 { c4 }
3095 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3099 Measure repeats of more than 2 measures get a counter, if you switch
3100 on the @code{countPercentRepeats} property,
3102 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3103 \set countPercentRepeats = ##t
3105 \repeat "percent" 4 { c1 }
3110 Isolated percents can also be printed. This is done by putting a multi
3111 measure rest with a different print function,
3113 @lilypond[fragment,verbatim]
3114 \override MultiMeasureRest #'stencil
3115 = #ly:multi-measure-rest::percent
3124 Program reference: @internalsref{RepeatSlash},
3125 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3126 @internalsref{DoublePercentRepeatCounter},
3127 @internalsref{PercentRepeatCounter},
3128 @internalsref{PercentRepeatedMusic}, and