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}
587 @code{c'} is used as the default if no starting pitch is defined.
589 The octave of notes that appear in @var{musicexpr} are calculated as
590 follows: if no octave changing marks are used, the basic interval
591 between this and the last note is always taken to be a fourth or
592 less. This distance is determined without regarding alterations; a
593 @code{fisis} following a @code{ceses} will be put above the
594 @code{ceses}. In other words, a doubly-augmented fourth is considered
595 a smaller interval than a diminished fifth, even though the
596 doubly-augmented fourth spans seven semitones while the diminished
597 fifth only spans six semitones.
599 The octave changing marks @code{'} and @code{,} can be added to raise
600 or lower the pitch by an extra octave. Upon entering relative mode,
601 an absolute starting pitch can be specified that will act as the
602 predecessor of the first note of @var{musicexpr}. If no starting pitch
603 is specified, then middle C is used as a start.
605 Here is the relative mode shown in action
606 @lilypond[quote,fragment,ragged-right,verbatim]
612 Octave changing marks are used for intervals greater than a fourth
613 @lilypond[quote,ragged-right,fragment,verbatim]
619 If the preceding item is a chord, the first note of the chord is used
620 to determine the first note of the next chord
622 @lilypond[quote,ragged-right,fragment,verbatim]
630 The pitch after the @code{\relative} contains a note name.
632 The relative conversion will not affect @code{\transpose},
633 @code{\chordmode} or @code{\relative} sections in its argument. To use
634 relative within transposed music, an additional @code{\relative} must
635 be placed inside @code{\transpose}.
639 @subsection Octave check
643 Octave checks make octave errors easier to correct: a note may be
644 followed by @code{=}@var{quotes} which indicates what its absolute
645 octave should be. In the following example,
648 \relative c'' @{ c='' b=' d,='' @}
652 the @code{d} will generate a warning, because a @code{d''} is expected
653 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
654 found. In the output, the octave is corrected to be a @code{d''} and
655 the next note is calculated relative to @code{d''} instead of @code{d'}.
657 There is also an octave check that produces no visible output. The syntax
663 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
664 quotes) in \relative mode. If not, a warning is printed, and the
665 octave is corrected. The @var{pitch} is not printed as a note.
667 In the example below, the first check passes without incident, since
668 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
669 the second check produces a warning, since the @code{e} is not within
670 a fifth of @code{b'}. The warning message is printed, and the octave
671 is adjusted so that the following notes are in the correct octave
683 The octave of a note following an octave check is determined with
684 respect to the note preceding it. In the next fragment, the last note
685 is an @code{a'}, above middle C. That means that the @code{\octave}
686 check passes successfully, so the check could be deleted without changing
687 the output of the piece.
689 @lilypond[quote,ragged-right,verbatim,fragment]
699 @subsection Transpose
702 @cindex transposition of pitches
703 @cindex @code{\transpose}
705 A music expression can be transposed with @code{\transpose}. The
708 \transpose @var{from} @var{to} @var{musicexpr}
711 This means that @var{musicexpr} is transposed by the interval between
712 the pitches @var{from} and @var{to}: any note with pitch @code{from}
713 is changed to @code{to}.
715 For example, consider a piece written in the key of D-major. If
716 this piece is a little too low for its performer, it can be
717 transposed up to E-major with
719 \transpose d e @dots{}
722 Consider a part written for violin (a C instrument). If
723 this part is to be played on the A clarinet (for which an
724 A is notated as a C, and which sounds a minor third lower
725 than notated), the following
726 transposition will produce the appropriate part
729 \transpose a c @dots{}
732 @code{\transpose} distinguishes between enharmonic pitches: both
733 @code{\transpose c cis} or @code{\transpose c des} will transpose up
734 half a tone. The first version will print sharps and the second
735 version will print flats
737 @lilypond[quote,ragged-right,verbatim]
738 mus = { \key d \major cis d fis g }
747 @code{\transpose} may also be used to input written notes for a
748 transposing instrument. Pitches are normally entered into LilyPond
749 in C (or ``concert pitch''), but they may be entered in another
750 key. For example, when entering music for a B-flat trumpet which
751 begins on concert D, one would write
754 \transpose c bes @{ e4 @dots{} @}
757 To print this music in B-flat again (ie producing a trumpet part,
758 instead of a concert pitch conductor's score) you would wrap the
759 existing music with another @code{transpose}
762 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
768 Program reference: @internalsref{TransposedMusic}.
773 If you want to use both @code{\transpose} and @code{\relative},
774 you must put @code{\transpose} outside of @code{\relative}, since
775 @code{\relative} will have no effect music that appears inside a
780 @subsection Bar check
783 @cindex @code{barCheckSynchronize}
786 Bar checks help detect errors in the durations. A bar check is
787 entered using the bar symbol, `@code{|}'. Whenever it is encountered
788 during interpretation, it should fall on a measure boundary. If it
789 does not, a warning is printed. In the next example, the second bar
790 check will signal an error
792 \time 3/4 c2 e4 | g2 |
795 Bar checks can also be used in lyrics, for example
800 Twin -- kle | Twin -- kle
804 Failed bar checks are caused by entering incorrect
805 durations. Incorrect durations often completely garble up the score,
806 especially if the score is polyphonic, so a good place to start correcting
807 input is by scanning for failed bar checks and incorrect durations.
810 @cindex @code{pipeSymbol}
812 It is also possible to redefine the meaning of @code{|}. This is done
813 by assigning a music expression to @code{pipeSymbol},
815 @lilypond[quote,ragged-right,verbatim]
816 pipeSymbol = \bar "||"
822 @node Barnumber check
823 @subsection Barnumber check
825 When copying large pieces of music, it can be helpful to check that
826 the LilyPond bar number corresponds to the original that you are
827 entering from. This can be checked with @code{\barNumberCheck}, for
835 will print a warning if the @code{currentBarNumber} is not 123 when it
839 @node Skipping corrected music
840 @subsection Skipping corrected music
843 @cindex @code{skipTypesetting}
844 @cindex @code{showLastLength}
846 When entering or copying music, usually only the music near the end (where you
847 are adding notes) is interesting to view and correct. To speed up
848 this correction process, it is possible to skip typesetting of all but
849 the last few measures. This is achieved by putting
852 showLastLength = R1*5
857 in your source file. This will render only the last 5 measures
858 (assuming 4/4 time signature) of every @code{\score} in the input
859 file. For longer pieces, rendering only a small part is often an order
860 of magnitude quicker than rendering it completely
862 Skipping parts of a score can be controlled in a more fine-grained
863 fashing with the property @code{Score.skipTypesetting}. When it is
864 set, no typesetting is performed at all.
866 This property is also used to control output to the MIDI file. Note that
867 it skips all events, including tempo and instrument changes. You have
870 @lilypond[quote,fragment,ragged-right,verbatim]
873 \set Score.skipTypesetting = ##t
875 \set Score.skipTypesetting = ##f
879 In polyphonic music, @code{Score.skipTypesetting} will affect all
880 voices and staves, saving even more time.
883 @node Automatic note splitting
884 @subsection Automatic note splitting
886 Long notes can be converted automatically to tied notes. This is done
887 by replacing the @internalsref{Note_heads_engraver} by the
888 @internalsref{Completion_heads_engraver}.
889 In the following examples, notes crossing the bar line are split and tied.
891 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
893 \remove "Note_heads_engraver"
894 \consists "Completion_heads_engraver"
896 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
900 This engraver splits all running notes at the bar line, and inserts
901 ties. One of its uses is to debug complex scores: if the measures are
902 not entirely filled, then the ties exactly show how much each measure
908 Not all durations (especially those containing tuplets) can be
909 represented exactly with normal notes and dots, but the engraver will
912 @code{Completion_heads_engraver} only affects notes; it does not split
918 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
922 Program reference: @internalsref{Completion_heads_engraver}.
925 @node Writing music in parallel
926 @subsection Writing music in parallel
927 @cindex Writing music in parallel
928 @cindex Interleaved music
930 Music for multiple parts can be interleaved
932 @lilypond[quote,fragment,verbatim]
933 \parallelMusic #'(voiceA voiceB) {
934 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
936 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
940 \new Staff \new Voice \voiceA
941 \new Staff \new Voice \voiceB
947 @section Staff notation
949 @cindex Staff notation
951 This section describes music notation that occurs on staff level,
952 such as key signatures, clefs and time signatures.
961 * System start delimiters::
971 The clef indicates which lines of the staff correspond to which
972 pitches. The clef is set with the @code{\clef} command
974 @lilypond[quote,ragged-right,fragment,verbatim]
975 { c''2 \clef alto g'2 }
985 @cindex mezzosoprano clef
986 @cindex baritone clef
987 @cindex varbaritone clef
990 Supported clefs finclude
992 @item treble, violin, G, G2
1001 G clef on 1st line, so-called French violin clef
1018 By adding @code{_8} or @code{^8} to the clef name, the clef is
1019 transposed one octave down or up, respectively, and @code{_15} and
1020 @code{^15} transposes by two octaves. The argument @var{clefname}
1021 must be enclosed in quotes when it contains underscores or digits. For
1024 @cindex choral tenor clef
1025 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1032 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
1033 @code{clefPosition} (which controls the Y position of the clef),
1034 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1035 when any of these properties are changed. The following example shows
1036 possibilities when setting properties manually.
1038 @lilypond[quote,ragged-right,verbatim]
1040 \set Staff.clefGlyph = #"clefs.F"
1041 \set Staff.clefPosition = #2
1043 \set Staff.clefGlyph = #"clefs.G"
1045 \set Staff.clefGlyph = #"clefs.C"
1047 \set Staff.clefOctavation = #7
1049 \set Staff.clefOctavation = #0
1050 \set Staff.clefPosition = #0
1054 \set Staff.middleCPosition = #4
1062 Program reference: @internalsref{Clef}.
1066 @subsection Key signature
1068 @cindex Key signature
1071 The key signature indicates the tonality in which a piece is played. It
1072 is denoted by a set of alterations (flats or sharps) at the start of the
1075 Setting or changing the key signature is done with the @code{\key}
1079 @code{\key} @var{pitch} @var{type}
1082 @cindex @code{\minor}
1083 @cindex @code{\major}
1084 @cindex @code{\minor}
1085 @cindex @code{\ionian}
1086 @cindex @code{\locrian}
1087 @cindex @code{\aeolian}
1088 @cindex @code{\mixolydian}
1089 @cindex @code{\lydian}
1090 @cindex @code{\phrygian}
1091 @cindex @code{\dorian}
1092 @cindex church modes
1094 Here, @var{type} should be @code{\major} or @code{\minor} to get
1095 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1096 use the standard mode names (also called ``church modes''): @code{\ionian},
1097 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1098 @code{\phrygian}, and @code{\dorian}.
1100 This command sets the context property
1101 @code{Staff.keySignature}. Non-standard key signatures
1102 can be specified by setting this property directly.
1104 Accidentals and key signatures often confuse new users, because
1105 unaltered notes get natural signs depending on the key signature. For
1106 more information, see @ref{More about pitches}.
1111 A natural sign is printed to cancel any previous accidentals. This
1112 can be suppressed by setting the @code{Staff.printKeyCancellation}
1115 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1120 \set Staff.printKeyCancellation = ##f
1130 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1133 @node Time signature
1134 @subsection Time signature
1136 @cindex Time signature
1138 @cindex @code{\time}
1140 Time signature indicates the metrum of a piece: a regular pattern of
1141 strong and weak beats. It is denoted by a fraction at the start of the
1144 The time signature is set with the @code{\time} command
1146 @lilypond[quote,ragged-right,fragment,verbatim]
1147 \time 2/4 c'2 \time 3/4 c'2.
1152 The symbol that is printed can be customized with the @code{style}
1153 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1156 @lilypond[fragment,quote,ragged-right,verbatim]
1159 \override Staff.TimeSignature #'style = #'()
1164 There are many more options for its layout. See @ref{Ancient time
1165 signatures} for more examples.
1167 @code{\time} sets the property @code{timeSignatureFraction},
1168 @code{beatLength} and @code{measureLength} in the @code{Timing}
1169 context, which is normally aliased to @internalsref{Score}. The
1170 property @code{measureLength} determines where bar lines should be
1171 inserted, and how automatic beams should be generated. Changing the
1172 value of @code{timeSignatureFraction} also causes the symbol to be
1175 More options are available through the Scheme function
1176 @code{set-time-signature}. In combination with the
1177 @internalsref{Measure_grouping_engraver}, it will create
1178 @internalsref{MeasureGrouping} signs. Such signs ease reading
1179 rhythmically complex modern music. In the following example, the 9/8
1180 measure is subdivided in 2, 2, 2 and 3. This is passed to
1181 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1183 @lilypond[quote,ragged-right,verbatim]
1186 #(set-time-signature 9 8 '(2 2 2 3))
1187 g8[ g] d[ d] g[ g] a8[( bes g]) |
1188 #(set-time-signature 5 8 '(3 2))
1194 \consists "Measure_grouping_engraver"
1202 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
1207 Automatic beaming does not use the measure grouping specified with
1208 @code{set-time-signature}.
1211 @node Partial measures
1212 @subsection Partial measures
1216 @cindex partial measure
1217 @cindex measure, partial
1218 @cindex shorten measures
1219 @cindex @code{\partial}
1221 Partial measures, such as an anacrusis or upbeat, are entered using the
1223 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1224 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1227 The syntax for this command is
1230 \partial @var{duration}
1233 This is internally translated into
1236 \set Timing.measurePosition = -@var{length of duration}
1239 The property @code{measurePosition} contains a rational number
1240 indicating how much of the measure has passed at this point.
1245 This command does not take into account grace notes at the start of
1246 the music. When a piece starts with graces notes in the pickup, then
1247 the @code{\partial} should follow the grace notes
1249 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1258 @subsection Bar lines
1262 @cindex measure lines
1265 Bar lines delimit measures, but are also used to indicate
1266 repeats. Normally they are inserted automatically. Line
1267 breaks may only happen on bar lines.
1269 Special types of bar lines can be forced with the @code{\bar} command
1271 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1275 The following bar types are available
1277 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1279 To allow a line break where there is no visible bar line, use
1286 This will insert an invisible bar line and allow line breaks at this
1289 In scores with many staves, a @code{\bar} command in one staff is
1290 automatically applied to all staves. The resulting bar lines are
1291 connected between different staves of a StaffGroup
1293 @lilypond[quote,ragged-right,fragment,verbatim]
1301 \new Staff { \clef bass c4 g e g }
1303 \new Staff { \clef bass c2 c2 }
1310 @cindex @code{whichBar}
1311 @cindex @code{repeatCommands}
1312 @cindex @code{defaultBarType}
1314 The command @code{\bar }@var{bartype} is a short cut for doing
1315 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1316 is set to a string, a bar line of that type is created.
1318 A bar line is created whenever the @code{whichBar} property is set.
1319 At the start of a measure it is set to the contents of
1320 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1321 to override default measure bars.
1323 You are encouraged to use @code{\repeat} for repetitions. See
1329 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1331 Program reference: @internalsref{BarLine} (created at
1332 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1334 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1337 @node Unmetered music
1338 @subsection Unmetered music
1341 @cindex @code{\cadenzaOn}
1342 @cindex @code{\cadenzaOff}
1344 Bar lines and bar numbers are calculated automatically. For unmetered
1345 music (cadenzas, for example), this is not desirable. To turn off
1346 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1347 and @code{\cadenzaOff}.
1349 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1361 LilyPond will only insert page breaks at a barline. Unless the unmetered
1362 music ends before the end of the staff line, you will need to insert
1370 to indicate where line breaks can occur.
1373 @node System start delimiters
1374 @subsection System start delimiters
1376 @cindex start of system
1377 @cindex Staff, multiple
1378 @cindex bracket, vertical
1379 @cindex brace, vertical
1382 @cindex staff, choir
1384 Many scores consist of more than one staff. These staves can be
1385 joined in four different ways
1388 @item The group is started with a brace at the left, and bar lines are
1389 connected. This is done with the @internalsref{GrandStaff} context.
1391 @lilypond[verbatim,ragged-right,quote]
1399 @item The group is started with a bracket, and bar lines are connected.
1400 This is done with the
1401 @internalsref{StaffGroup} context
1403 @lilypond[verbatim,ragged-right,quote]
1411 @item The group is started with a bracket, but bar lines are not
1412 connected. This is done with the @internalsref{ChoirStaff} context.
1414 @lilypond[verbatim,ragged-right,quote]
1422 @item The group is started with a vertical line. Bar lines are not
1423 connected. This is the default for the score.
1425 @lilypond[verbatim,ragged-right,quote]
1436 The bar lines at the start of each system are
1437 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1438 @internalsref{SystemStartBracket}. Only one of these types is created
1439 in every context, and that type is determined by the property
1440 @code{systemStartDelimiter}.
1444 @subsection Staff symbol
1446 @cindex adjusting staff symbol
1448 Notes, dynamic signs, etc., are grouped
1449 with a set of horizontal lines, called a staff (plural `staves'). In
1450 LilyPond, these lines are drawn using a separate layout object called
1453 The staff symbol may be tuned in the number, thickness and distance
1454 of lines, using properties. This is demonstrated in the example files
1455 @inputfileref{input/@/test,staff@/-lines@/.ly},
1456 @inputfileref{input/@/test,staff@/-size@/.ly}.
1458 In addition, staves may be started and stopped at will. This is done
1459 with @code{\startStaff} and @code{\stopStaff}.
1461 @lilypond[verbatim,relative=2,fragment]
1463 \override Staff.StaffSymbol #'line-count = 2
1464 \stopStaff \startStaff
1466 \revert Staff.StaffSymbol #'line-count
1467 \stopStaff \startStaff
1471 In combination with Frenched staves, this may be used to typeset ossia
1472 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1477 @lilypondfile{ossia.ly}
1479 @cindex staff lines, setting number of
1480 @cindex staff lines, setting thickness of
1481 @cindex thickness of staff lines, setting
1482 @cindex number of staff lines, setting
1486 Program reference: @internalsref{StaffSymbol}.
1488 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1489 @inputfileref{input/@/test@/,ossia.ly},
1490 @inputfileref{input/@/test,staff@/-size@/.ly}.
1494 @node Connecting notes
1495 @section Connecting notes
1497 This section deals with notation that affects groups of notes.
1503 * Laissez vibrer ties::
1516 A tie connects two adjacent note heads of the same pitch. The tie in
1517 effect extends the length of a note. Ties should not be confused with
1518 slurs, which indicate articulation, or phrasing slurs, which indicate
1519 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1521 @lilypond[quote,ragged-right,fragment,verbatim]
1522 e' ~ e' <c' e' g'> ~ <c' e' g'>
1525 When a tie is applied to a chord, all note heads whose pitches match
1526 are connected. When no note heads match, no ties will be created.
1528 A tie is just a way of extending a note duration, similar to the
1529 augmentation dot. The following example shows two ways of notating
1530 exactly the same concept
1532 @lilypond[quote,fragment,ragged-right]
1533 \time 3/4 c'2. c'2 ~ c'4
1537 Ties are used either when the note crosses a bar line, or when dots
1538 cannot be used to denote the rhythm. When using ties, larger note
1539 values should be aligned to subdivisions of the measure, eg.
1541 @lilypond[fragment,quote,ragged-right]
1543 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1547 If you need to tie a lot of notes over bars, it may be easier to use
1548 automatic note splitting (see @ref{Automatic note splitting}). This
1549 mechanism automatically splits long notes, and ties them across bar
1552 When a second alternative of a repeat starts with a tied note, you
1553 have to repeat the tie. This can be achieved with @code{\repeatTie},
1556 @lilypond[fragment,quote,ragged-right,relative=2]
1560 @cindex repeating ties
1561 @cindex volta brackets and ties
1565 Ties are sometimes used to write out arpeggios. In this case, two tied
1566 notes need not be consecutive. This can be achieved by setting the
1567 @code{tieWaitForNote} property to true. The same feature is also useful,
1568 for example, to tie a tremolo to a chord. For example,
1570 @lilypond[fragment,verbatim,relative=1,ragged-right]
1571 \set tieWaitForNote = ##t
1572 \grace { c16[~ e~ g]~ } <c, e g>2
1573 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1580 @cindex @code{\tieUp}
1582 @cindex @code{\tieDown}
1584 @cindex @code{\tieNeutral}
1586 @cindex @code{\tieDotted}
1588 @cindex @code{\tieDashed}
1590 @cindex @code{\tieSolid}
1596 In this manual: @ref{Automatic note splitting}.
1598 Program reference: @internalsref{Tie}.
1601 @inputfileref{input/@/regression,tie-arpeggio.ly}
1602 @inputfileref{input/@/regression,tie-manual.ly}
1609 Switching staves when a tie is active will not produce a slanted tie.
1617 A slur indicates that notes are to be played bound or
1618 @emph{legato}. They are entered using parentheses
1620 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1621 f( g a) a8 b( a4 g2 f4)
1625 The direction of a slur can be specified with
1626 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1627 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1630 However, there is a convenient shorthand for forcing slur
1631 directions. By adding @code{_} or @code{^} before the opening
1632 parentheses, the direction is also set. For example,
1634 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1638 Only one slur can be printed at once. If you need to print a long
1639 slur over a few small slurs, please see @ref{Phrasing slurs}.
1644 Some composers write two slurs when they want legato chords. This can
1645 be achieved in LilyPond by setting @code{doubleSlurs},
1647 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1648 \set doubleSlurs = ##t
1649 <c e>4 ( <d f> <c e> <d f> )
1655 @cindex @code{\slurUp}
1657 @cindex @code{\slurDown}
1659 @cindex @code{\slurNeutral}
1660 @code{\slurNeutral},
1661 @cindex @code{\slurDashed}
1663 @cindex @code{\slurDotted}
1665 @cindex @code{\slurSolid}
1670 Program reference: @seeinternals{Slur}.
1673 @node Phrasing slurs
1674 @subsection Phrasing slurs
1676 @cindex phrasing slurs
1677 @cindex phrasing marks
1679 A phrasing slur (or phrasing mark) connects notes and is used to
1680 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1683 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1684 \time 6/4 c'\( d( e) f( e) d\)
1687 Typographically, the phrasing slur behaves almost exactly like a
1688 normal slur. However, they are treated as different objects. A
1689 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1690 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1691 @code{\phrasingSlurNeutral}.
1693 You cannot have simultaneous phrasing slurs.
1698 @cindex @code{\phrasingSlurUp}
1699 @code{\phrasingSlurUp},
1700 @cindex @code{\phrasingSlurDown}
1701 @code{\phrasingSlurDown},
1702 @cindex @code{\phrasingSlurNeutral}
1703 @code{\phrasingSlurNeutral}.
1708 Program reference: @internalsref{PhrasingSlur}.
1711 @node Laissez vibrer ties
1712 @subsection Laissez vibrer ties
1713 @cindex Laissez vibrer
1714 @cindex Ties, laissez vibrer
1716 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
1717 end. It is used in notation for piano, harp and other string and
1718 percussion instruments. They can be entered using @code{\laissezVibrer},
1720 @lilypond[fragment,ragged-right,verbatim,relative=1]
1721 <c f g>\laissezVibrer
1727 @internalsref{LaissezVibrerTie}
1728 @internalsref{LaissezVibrerTieColumn}
1731 @inputfileref{input/regression,laissez-vibrer-tie.ly}
1734 @node Automatic beams
1735 @subsection Automatic beams
1737 LilyPond inserts beams automatically
1739 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1740 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1743 When these automatic decisions are not good enough, beaming can be
1744 entered explicitly. It is also possible to define beaming patterns
1745 that differ from the defaults. See @ref{Setting automatic beam behavior}
1748 Individual notes may be marked with @code{\noBeam} to prevent them
1751 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1752 \time 2/4 c8 c\noBeam c c
1758 Program reference: @internalsref{Beam}.
1762 @subsection Manual beams
1764 @cindex beams, manual
1768 In some cases it may be necessary to override the automatic beaming
1769 algorithm. For example, the autobeamer will not put beams over rests
1770 or bar lines. Such beams are specified manually by marking the begin
1771 and end point with @code{[} and @code{]}
1773 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1775 r4 r8[ g' a r8] r8 g[ | a] r8
1782 @cindex @code{stemLeftBeamCount}
1783 @cindex @code{stemRightBeamCount}
1785 Normally, beaming patterns within a beam are determined automatically.
1786 If necessary, the properties @code{stemLeftBeamCount} and
1787 @code{stemRightBeamCount} can be used to override the defaults. If
1788 either property is set, its value will be used only once, and then it
1791 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1796 \set stemLeftBeamCount = #1
1801 The property @code{subdivideBeams} can be set in order to subdivide
1802 all 16th or shorter beams at beat positions, as defined by the
1803 @code{beatLength} property.
1805 @lilypond[fragment,quote,relative=2,verbatim]
1807 \set subdivideBeams = ##t
1809 \set Score.beatLength = #(ly:make-moment 1 8)
1812 @cindex @code{subdivideBeams}
1815 For more information about @code{make-moment}, see
1816 @ref{Time administration}.
1818 Line breaks are normally forbidden when beams cross bar lines. This
1819 behavior can be changed by setting @code{allowBeamBreak}.
1821 @cindex @code{allowBeamBreak}
1822 @cindex beams and line breaks
1823 @cindex beams, kneed
1825 @cindex auto-knee-gap
1830 Kneed beams are inserted automatically when a large gap is detected
1831 between the note heads. This behavior can be tuned through the object.
1833 Automatically kneed cross-staff beams cannot be used together with
1834 hidden staves. See @ref{Hiding staves}.
1836 Beams do not avoid collisions with symbols around the notes, such as
1837 texts and accidentals.
1841 @subsection Grace notes
1843 @cindex @code{\grace}
1846 @cindex appoggiatura
1847 @cindex acciaccatura
1849 Grace notes are ornaments that are written out. The most common ones
1850 are acciaccatura, which should be played as very short. It is denoted
1851 by a slurred small note with a slashed stem. The appoggiatura is a
1852 grace note that takes a fixed fraction of the main note, and is
1853 denoted as a slurred note in small print without a slash. They
1854 are entered with the commands @code{\acciaccatura} and
1855 @code{\appoggiatura}, as demonstrated in the following example
1857 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1858 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1859 \acciaccatura { g16[ f] } e4
1862 Both are special forms of the @code{\grace} command. By prefixing this
1863 keyword to a music expression, a new one is formed, which will be
1864 printed in a smaller font and takes up no logical time in a measure.
1866 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1868 \grace { c16[ d16] } c2 c4
1872 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1873 @code{\grace} command does not start a slur.
1875 Internally, timing for grace notes is done using a second, `grace'
1876 timing. Every point in time consists of two rational numbers: one
1877 denotes the logical time, one denotes the grace timing. The above
1878 example is shown here with timing tuples
1880 @lilypond[quote,ragged-right]
1883 c4 \grace c16 c4 \grace {
1886 \new Lyrics \lyricmode {
1887 \override LyricText #'font-family = #'typewriter
1891 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1892 \markup { (\fraction 1 4 , 0 ) } 4
1894 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1895 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1897 \markup { ( \fraction 2 4 , 0 ) }
1902 The placement of grace notes is synchronized between different staves.
1903 In the following example, there are two sixteenth grace notes for
1904 every eighth grace note
1906 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1907 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1908 \new Staff { c4 \grace { g8[ b] } c4 } >>
1911 @cindex @code{\afterGrace}
1913 If you want to end a note with a grace, use the @code{\afterGrace}
1914 command. It takes two arguments: the main note, and the grace notes
1915 following the main note.
1917 @lilypond[ragged-right, verbatim,relative=2,fragment]
1918 c1 \afterGrace d1 { c16[ d] } c4
1921 This will put the grace notes after a ``space'' lasting 3/4 of the
1922 length of the main note. The fraction 3/4 can be changed by setting
1923 @code{afterGraceFraction}, ie.
1926 afterGraceFraction = #(cons 7 8)
1930 will put the grace note at 7/8 of the main note.
1932 The same effect can be achieved manually by doing
1934 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1937 { s2 \grace { c16[ d] } } >>
1943 By adjusting the duration of the skip note (here it is a half-note),
1944 the space between the main-note and the grace is adjusted.
1946 A @code{\grace} section will introduce special typesetting settings,
1947 for example, to produce smaller type, and set directions. Hence, when
1948 introducing layout tweaks, they should be inside the grace section,
1950 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1962 The overrides should also be reverted inside the grace section.
1964 The layout of grace sections can be changed throughout the music using
1965 the function @code{add-grace-property}. The following example
1966 undefines the Stem direction for this grace, so stems do not always
1971 #(add-grace-property 'Voice 'Stem 'direction '())
1977 Another option is to change the variables @code{startGraceMusic},
1978 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1979 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1980 @code{stopAppoggiaturaMusic}. More information is in the file
1981 @file{ly/@/grace@/-init@/.ly}.
1984 The slash through the stem in acciaccaturas can be obtained
1985 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
1989 Program reference: @internalsref{GraceMusic}.
1994 A score that starts with a @code{\grace} section needs an explicit
1995 @code{\new Voice} declaration, otherwise the main note and the grace
1996 note end up on different staves.
1998 Grace note synchronization can also lead to surprises. Staff notation,
1999 such as key signatures, bar lines, etc., are also synchronized. Take
2000 care when you mix staves with grace notes and staves without, for example,
2002 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2003 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2004 \new Staff { c4 \bar "|:" d4 } >>
2008 This can be remedied by inserting grace skips of the corresponding
2009 durations in the other staves. For the above example
2012 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2015 Grace sections should only be used within sequential music
2016 expressions. Nesting or juxtaposing grace sections is not supported,
2017 and might produce crashes or other errors.
2021 @node Expressive marks
2022 @section Expressive marks
2024 Expressive marks help musicians to bring more to the music than simple
2029 * Fingering instructions::
2039 @subsection Articulations
2041 @cindex Articulations
2045 A variety of symbols can appear above and below notes to indicate
2046 different characteristics of the performance. They are added to a note
2047 by adding a dash and the character signifying the
2048 articulation. They are demonstrated here
2050 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2052 The meanings of these shorthands can be changed. See
2053 @file{ly/@/script@/-init@/.ly} for examples.
2055 The script is automatically placed, but the direction can be forced as
2056 well. Like other pieces of LilyPond code, @code{_} will place them
2057 below the staff, and @code{^} will place them above.
2059 @lilypond[quote,ragged-right,fragment,verbatim]
2063 Other symbols can be added using the syntax
2064 @var{note}@code{\}@var{name}. Again, they
2065 can be forced up or down using @code{^} and @code{_},
2068 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2069 c\fermata c^\fermata c_\fermata
2074 @cindex staccatissimo
2084 @cindex organ pedal marks
2093 @cindex prallmordent
2097 @cindex thumb marking
2102 Here is a chart showing all scripts available,
2104 @lilypondfile[ragged-right,quote]{script-chart.ly}
2109 The vertical ordering of scripts is controlled with the
2110 @code{script-priority} property. The lower this number, the closer it
2111 will be put to the note. In this example, the
2112 @internalsref{TextScript} (the sharp symbol) first has the lowest
2113 priority, so it is put lowest in the first example. In the second, the
2114 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2115 inside. When two objects have the same priority, the order in which
2116 they are entered decides which one comes first.
2118 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2119 \once \override TextScript #'script-priority = #-100
2120 a4^\prall^\markup { \sharp }
2122 \once \override Script #'script-priority = #-100
2123 a4^\prall^\markup { \sharp }
2129 Program reference: @internalsref{Script}.
2134 These signs appear in the printed output but have no effect on the
2135 MIDI rendering of the music.
2138 @node Fingering instructions
2139 @subsection Fingering instructions
2142 @cindex finger change
2144 Fingering instructions can be entered using
2146 @var{note}-@var{digit}
2148 For finger changes, use markup texts
2150 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2152 c^\markup { \finger "2 - 3" }
2155 You can use the thumb-script to indicate that a note should be
2156 played with the thumb (e.g., in cello music)
2157 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2158 <a_\thumb a'-3>8 <b_\thumb b'-3>
2161 Fingerings for chords can also be added to individual notes
2162 of the chord by adding them after the pitches
2163 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2164 < c-1 e-2 g-3 b-5 >4
2170 You may exercise greater control over fingering chords by
2171 setting @code{fingeringOrientations}
2173 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2174 \set fingeringOrientations = #'(left down)
2175 <c-1 es-2 g-4 bes-5 > 4
2176 \set fingeringOrientations = #'(up right down)
2177 <c-1 es-2 g-4 bes-5 > 4
2180 Using this feature, it is also possible to put fingering instructions
2181 very close to note heads in monophonic music,
2183 @lilypond[verbatim,ragged-right,quote,fragment]
2184 \set fingeringOrientations = #'(right)
2191 Program reference: @internalsref{Fingering}.
2193 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2197 @subsection Dynamics
2208 @cindex @code{\ffff}
2217 Absolute dynamic marks are specified using a command after a note
2218 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2219 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2220 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2221 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2223 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2224 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2225 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2232 A crescendo mark is started with @code{\<} and terminated with
2233 @code{\!} or an absolute dynamic. A decrescendo is started with
2234 @code{\>} and is also terminated with @code{\!} or an absolute
2235 dynamic. Because these marks are bound to notes, you must
2236 use spacer notes if multiple marks are needed during one note
2238 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2240 << f1 { s4 s4\< s4\! \> s4\! } >>
2244 A hairpin starts at the left edge of the beginning note and ends on the
2245 right edge of the ending note.
2247 This may give rise to very short hairpins. Use @code{minimum-length}
2248 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2252 \override Staff.Hairpin #'minimum-length = #5
2259 You can also use a text saying @emph{cresc.} instead of hairpins
2261 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2272 You can also supply your own texts
2273 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2274 \set crescendoText = \markup { \italic "cresc. poco" }
2275 \set crescendoSpanner = #'dashed-line
2279 To create new dynamic marks or text that should be aligned
2280 with dynamics, see @ref{New dynamic marks}.
2285 Dynamics that occur at, begin on, or end on, the same note
2286 will be vertically aligned. If you want to ensure that dynamics
2287 are aligned when they do not occur on the same note, you can
2288 increase the @code{staff-padding} property.
2291 \override DynamicLineSpanner #'staff-padding = #4
2294 You may also use this property if the dynamics are colliding
2295 with other notation.
2297 Crescendi and decrescendi that end on the first note of a
2298 new line are not printed. To change this behavior, use
2301 \override Score.Hairpin #'after-line-breaking = ##t
2307 @cindex @code{\dynamicUp}
2309 @cindex @code{\dynamicDown}
2310 @code{\dynamicDown},
2311 @cindex @code{\dynamicNeutral}
2312 @code{\dynamicNeutral}.
2317 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2318 Vertical positioning of these symbols is handled by
2319 @internalsref{DynamicLineSpanner}.
2323 @subsection Breath marks
2325 Breath marks are entered using @code{\breathe}
2327 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2334 The glyph of the breath mark can be tuned by overriding the
2335 @code{text} property of the @code{BreathingSign} layout object with
2336 any markup text. For example,
2337 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2339 \override BreathingSign #'text
2340 = #(make-musicglyph-markup "scripts.rvarcomma")
2347 Program reference: @internalsref{BreathingSign}.
2349 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2355 Short trills are printed like normal articulation; see @ref{Articulations}.
2357 Long running trills are made with @code{\startTrillSpan} and
2358 @code{\stopTrillSpan},
2360 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2362 << { c1 \startTrillSpan }
2363 { s2. \grace { d16[\stopTrillSpan e] } } >>
2367 @cindex Pitched trills
2369 Trills that should be executed on an explicitly specified pitch can be
2370 typeset with the command @code{pitchedTrill},
2372 @lilypond[ragged-right,verbatim,fragment,relative=1]
2373 \pitchedTrill c4\startTrillSpan fis
2377 The first argument is the main note. The pitch of the second
2378 is printed as a stemless note head in parentheses.
2383 @code{\startTrillSpan},
2384 @cindex @code{\startTrillSpan}
2385 @code{\stopTrillSpan}.
2386 @cindex @code{\stopTrillSpan}
2391 Program reference: @internalsref{TrillSpanner}.
2395 @subsection Glissando
2398 @cindex @code{\glissando}
2400 A glissando is a smooth change in pitch. It is denoted by a line or a
2401 wavy line between two notes. It is requested by attaching
2402 @code{\glissando} to a note
2404 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2406 \override Glissando #'style = #'zigzag
2413 Program reference: @internalsref{Glissando}.
2415 Example files: @file{input/@/regression/@/glissando@/.ly}.
2420 Printing text over the line (such as @emph{gliss.}) is not supported.
2424 @subsection Arpeggio
2427 @cindex broken chord
2428 @cindex @code{\arpeggio}
2430 You can specify an arpeggio sign (also known as broken chord) on a
2431 chord by attaching an @code{\arpeggio} to a chord
2433 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2437 A square bracket on the left indicates that the player should not
2438 arpeggiate the chord
2440 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2445 The direction of the arpeggio is sometimes denoted by adding an
2446 arrowhead to the wiggly line
2448 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2460 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2461 in both staves and set
2462 @internalsref{PianoStaff}.@code{connectArpeggios}
2464 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2466 \set PianoStaff.connectArpeggios = ##t
2467 \new Staff { <c' e g c>\arpeggio }
2468 \new Staff { \clef bass <c,, e g>\arpeggio }
2476 @cindex @code{\arpeggioUp}
2478 @cindex @code{\arpeggioDown}
2479 @code{\arpeggioDown},
2480 @cindex @code{\arpeggioNeutral}
2481 @code{\arpeggioNeutral},
2482 @cindex @code{\arpeggioBracket}
2483 @code{\arpeggioBracket}.
2488 Notation manual: @ref{Ties}, for writing out arpeggios.
2490 Program reference: @internalsref{Arpeggio}.
2495 It is not possible to mix connected arpeggios and unconnected
2496 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2503 Polyphony in music refers to having more than one voice occuring in
2504 a piece of music. Polyphony in LilyPond refers to having more than
2505 one voice on the same staff.
2509 * Explicitly instantiating voices::
2510 * Collision Resolution::
2514 @node Basic polyphony
2515 @subsection Basic polyphony
2519 The easiest way to enter fragments with more than one voice on a staff
2520 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2521 them simultaneously, separating the voices with @code{\\}
2525 @lilypond[quote,verbatim,fragment]
2526 \new Staff \relative c' {
2529 { g4 f e | d2 e2 } \\
2530 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2536 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2537 voices are sometimes called ``layers'' in other notation packages}
2539 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2540 each of these contexts, vertical direction of slurs, stems, etc., is set
2543 These voices are all separate from the voice that contains the notes just
2544 outside the @code{<< \\ >>} construct. This should be noted when making
2545 changes at the voice level. This also means that slurs and ties cannot go
2546 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2547 from separate @code{<< \\ >>} constructs on the same staff are the the
2548 same voice. Here is the same example, with different noteheads for each
2549 voice. Note that the change to the note-head style in the main voice does not affect
2550 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2551 voice in the first @code{<< \\ >>} construct is effective in the second
2552 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2554 @lilypond[quote,verbatim,fragment]
2555 \new Staff \relative c' {
2556 \override NoteHead #'style = #'cross
2560 { \override NoteHead #'style = #'triangle
2565 { c8 b16 a b8 g ~ g2 } \\
2566 { \override NoteHead #'style = #'slash s4 b4 c2 }
2571 Polyphony does not change the relationship of notes within a
2572 @code{\relative @{ @}} block. Each note is calculated relative
2573 to the note immediately preceding it.
2576 \relative @{ noteA << noteB \\ noteC >> noteD @}
2579 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2580 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2583 @node Explicitly instantiating voices
2584 @subsection Explicitly instantiating voices
2586 @internalsref{Voice} contexts can also be instantiated manually
2587 inside a @code{<< >>} block to create polyphonic music, using
2588 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2589 and a horizontal shift for each part.
2593 << \upper \\ \lower >>
2601 \new Voice = "1" @{ \voiceOne \upper @}
2602 \new Voice = "2" @{ \voiceTwo \lower @}
2606 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2607 articulations, text annotations, augmentation dots of dotted
2608 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2609 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2610 make them point downwards.
2611 The command @code{\oneVoice} will revert back to the normal setting.
2613 An expression that appears directly inside a @code{<< >>} belongs to
2614 the main voice. This is useful when extra voices appear while the main
2615 voice is playing. Here is a more correct rendition of the example from
2616 the previous section. The crossed noteheads demonstrate that the main
2617 melody is now in a single voice context.
2619 @lilypond[quote,ragged-right,verbatim]
2620 \new Staff \relative c' {
2621 \override NoteHead #'style = #'cross
2626 \new Voice="1" { \voiceTwo
2627 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2630 \new Voice { \voiceThree
2639 The correct definition of the voices allows the melody to be slurred.
2640 @lilypond[quote,ragged-right,verbatim]
2641 \new Staff \relative c' {
2646 \context Voice="1" { \voiceTwo
2647 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2650 \new Voice { \voiceThree
2659 Avoiding the @code{\\} seperator also allows nesting polyphony
2660 constructs, which in some case might be a more natural way to typeset
2663 @lilypond[quote,ragged-right,verbatim]
2664 \new Staff \relative c' {
2669 \context Voice="1" { \voiceTwo
2672 {c8 b16 a b8 g ~ g2}
2673 \new Voice { \voiceThree
2686 @node Collision Resolution
2687 @subsection Collision Resolution
2689 Normally, note heads with a different number of dots are not merged, but
2690 when the object property @code{merge-differently-dotted} is set in
2691 the @internalsref{NoteCollision} object, they are merged
2692 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
2695 \override Staff.NoteCollision
2696 #'merge-differently-dotted = ##t
2698 } \\ { g8.[ f16] g8.[ f16] } >>
2701 Similarly, you can merge half note heads with eighth notes, by setting
2702 @code{merge-differently-headed}
2703 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2706 \override Staff.NoteCollision
2707 #'merge-differently-headed = ##t
2708 c8 c4. } \\ { c2 c2 } >>
2711 LilyPond also vertically shifts rests that are opposite of a stem,
2714 @lilypond[quote,ragged-right,fragment,verbatim]
2715 \new Voice << c''4 \\ r4 >>
2721 @cindex @code{\oneVoice}
2723 @cindex @code{\voiceOne}
2725 @cindex @code{\voiceTwo}
2727 @cindex @code{\voiceThree}
2729 @cindex @code{\voiceFour}
2732 @cindex @code{\shiftOn}
2734 @cindex @code{\shiftOnn}
2736 @cindex @code{\shiftOnnn}
2738 @cindex @code{\shiftOff}
2739 @code{\shiftOff}: these commands specify in what chords of the current
2740 voice should be shifted. The outer voices (normally: voice one and
2741 two) have @code{\shiftOff}, while the inner voices (three and four)
2742 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2743 further shift levels.
2745 When LilyPond cannot cope, the @code{force-hshift}
2746 property of the @internalsref{NoteColumn} object and pitched rests can
2747 be used to override typesetting decisions.
2749 @lilypond[quote,verbatim,ragged-right]
2756 \once \override NoteColumn #'force-hshift = #1.7
2764 Program reference: the objects responsible for resolving collisions are
2765 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2768 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2769 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2770 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2771 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2772 @inputfileref{input/@/regression,collisions@/.ly}.
2777 When using @code{merge-differently-headed} with an upstem eighth or a
2778 shorter note, and a downstem half note, the eighth note gets the wrong
2781 There is no support for clusters where the same note occurs with
2782 different accidentals in the same chord. In this case, it is
2783 recommended to use enharmonic transcription, or to use special cluster
2784 notation (see @ref{Clusters}).
2791 Repetition is a central concept in music, and multiple notations exist
2797 * Repeats and MIDI::
2798 * Manual repeat commands::
2800 * Tremolo subdivisions::
2806 @subsection Repeat types
2809 @cindex @code{\repeat}
2811 The following types of repetition are supported
2815 Repeated music is fully written (played) out. This is useful when
2816 entering repetitious music. This is the only kind of repeat that
2817 is included in MIDI output.
2820 Repeats are not written out, but alternative endings (volte) are
2821 printed, left to right with brackets. This is the standard notation
2822 for repeats with alternatives. These are not played in MIDI output by default.
2826 Alternative endings are written stacked. This has limited use but may be
2827 used to typeset two lines of lyrics in songs with repeats, see
2828 @inputfileref{input,star-spangled-banner@/.ly}.
2832 Make tremolo beams. These are not played in MIDI output by default.
2835 Make beat or measure repeats. These look like percent signs. These
2836 are not played in MIDI output by default. Percent repeats must be
2837 declared within a Voice context.
2843 @subsection Repeat syntax
2845 LilyPond has one syntactic construct for specifying different types of
2846 repeats. The syntax is
2849 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2852 If you have alternative endings, you may add
2853 @cindex @code{\alternative}
2864 where each @var{alternative} is a music expression. If you do not
2865 give enough alternatives for all of the repeats, the first alternative
2866 is assumed to be played more than once.
2868 Standard repeats are used like this
2869 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2871 \repeat volta 2 { c4 d e f }
2872 \repeat volta 2 { f e d c }
2875 With alternative endings
2876 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2878 \repeat volta 2 {c4 d e f}
2879 \alternative { {d2 d} {f f,} }
2882 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2885 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2886 \alternative { { g4 g g } { a | a a a a | b2. } }
2890 It is possible to shorten volta brackets
2891 by setting @code{voltaSpannerDuration}. In the next example, the
2892 bracket only lasts one measure, which is a duration of 3/4.
2894 @lilypond[verbatim,ragged-right,quote]
2898 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2899 \repeat "volta" 5 { d d d }
2900 \alternative { { e e e f f f }
2910 Brackets for the repeat are normally only printed over the topmost
2911 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2912 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2917 @cindex repeat, ambiguous
2919 A nested repeat like
2928 is ambiguous, since it is is not clear to which @code{\repeat} the
2929 @code{\alternative} belongs. This ambiguity is resolved by always
2930 having the @code{\alternative} belong to the inner @code{\repeat}.
2931 For clarity, it is advisable to use braces in such situations.
2933 Timing information is not remembered at the start of an alternative,
2934 so after a repeat timing information must be reset by hand, for
2935 example by setting @code{Score.measurePosition} or entering
2936 @code{\partial}. Similarly, slurs or ties are also not repeated.
2939 @node Repeats and MIDI
2940 @subsection Repeats and MIDI
2942 @cindex expanding repeats
2943 @cindex @code{\unfoldRepeats}
2945 With a little bit of tweaking, all types of repeats can be present
2946 in the MIDI output. This is achieved by applying the
2947 @code{\unfoldRepeats} music function. This functions changes all
2948 repeats to unfold repeats.
2950 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2952 \repeat tremolo 8 {c'32 e' }
2953 \repeat percent 2 { c''8 d'' }
2954 \repeat volta 2 {c'4 d' e' f'}
2963 When creating a score file using @code{\unfoldRepeats} for midi, then
2964 it is necessary to make two @code{\score} blocks. One for MIDI (with
2965 unfolded repeats) and one for notation (with volta, tremolo, and
2966 percent repeats). For example,
2974 \unfoldRepeats @var{..music..}
2980 @node Manual repeat commands
2981 @subsection Manual repeat commands
2983 @cindex @code{repeatCommands}
2985 The property @code{repeatCommands} can be used to control the layout of
2986 repeats. Its value is a Scheme list of repeat commands.
2989 @item @code{start-repeat}
2990 Print a @code{|:} bar line.
2992 @item @code{end-repeat}
2993 Print a @code{:|} bar line.
2995 @item @code{(volta @var{text})}
2996 Print a volta bracket saying @var{text}: The text can be specified as
2997 a text string or as a markup text, see @ref{Text markup}. Do not
2998 forget to change the font, as the default number font does not contain
2999 alphabetic characters;
3001 @item @code{(volta #f)}
3002 Stop a running volta bracket.
3005 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3007 \set Score.repeatCommands = #'((volta "93") end-repeat)
3009 \set Score.repeatCommands = #'((volta #f))
3016 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
3017 @internalsref{VoltaRepeatedMusic},
3018 @internalsref{UnfoldedRepeatedMusic}, and
3019 @internalsref{FoldedRepeatedMusic}.
3022 @node Tremolo repeats
3023 @subsection Tremolo repeats
3025 @cindex tremolo beams
3027 To place tremolo marks between notes, use @code{\repeat} with tremolo
3029 @lilypond[quote,verbatim,ragged-right]
3030 \new Voice \relative c' {
3031 \repeat "tremolo" 8 { c16 d16 }
3032 \repeat "tremolo" 4 { c16 d16 }
3033 \repeat "tremolo" 2 { c16 d16 }
3037 Tremolo marks can also be put on a single note. In this case, the
3038 note should not be surrounded by braces.
3039 @lilypond[quote,verbatim,ragged-right]
3040 \repeat "tremolo" 4 c'16
3043 Similar output is obtained using the tremolo subdivision, described in
3044 @ref{Tremolo subdivisions}.
3049 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3051 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3053 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3054 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3057 @node Tremolo subdivisions
3058 @subsection Tremolo subdivisions
3060 @cindex tremolo marks
3061 @cindex @code{tremoloFlags}
3063 Tremolo marks can be printed on a single note by adding
3064 `@code{:}[@var{number}]' after the note. The number indicates the
3065 duration of the subdivision, and it must be at least 8. A
3066 @var{length} value of 8 gives one line across the note stem. If the
3067 length is omitted, the last value (stored in @code{tremoloFlags}) is
3070 @lilypond[quote,ragged-right,verbatim,fragment]
3071 c'2:8 c':32 | c': c': |
3077 Tremolos entered in this way do not carry over into the MIDI output.
3082 In this manual: @ref{Tremolo repeats}.
3084 Elsewhere: @internalsref{StemTremolo}.
3087 @node Measure repeats
3088 @subsection Measure repeats
3090 @cindex percent repeats
3091 @cindex measure repeats
3093 In the @code{percent} style, a note pattern can be repeated. It is
3094 printed once, and then the pattern is replaced with a special sign.
3095 Patterns of one and two measures are replaced by percent-like signs,
3096 patterns that divide the measure length are replaced by slashes.
3097 Percent repeats must be declared within a @code{Voice} context.
3099 @lilypond[quote,verbatim,ragged-right]
3100 \new Voice \relative c' {
3101 \repeat "percent" 4 { c4 }
3102 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3106 Measure repeats of more than 2 measures get a counter, if you switch
3107 on the @code{countPercentRepeats} property,
3109 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3110 \set countPercentRepeats = ##t
3112 \repeat "percent" 4 { c1 }
3117 Isolated percents can also be printed. This is done by putting a multi
3118 measure rest with a different print function,
3120 @lilypond[fragment,verbatim]
3121 \override MultiMeasureRest #'stencil
3122 = #ly:multi-measure-rest::percent
3131 Program reference: @internalsref{RepeatSlash},
3132 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3133 @internalsref{DoublePercentRepeatCounter},
3134 @internalsref{PercentRepeatCounter},
3135 @internalsref{PercentRepeatedMusic}, and