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. @code{\cr} and @code{\decr} may be used instead of
2236 @code{\<} and @code{\>}. Because these marks are bound to notes, you must
2237 use spacer notes if multiple marks are needed during one note
2239 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2241 << f1 { s4 s4\< s4\! \> s4\! } >>
2245 A hairpin starts at the left edge of the beginning note and ends on the
2246 right edge of the ending note.
2248 This may give rise to very short hairpins. Use @code{minimum-length}
2249 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2253 \override Staff.Hairpin #'minimum-length = #5
2260 You can also use a text saying @emph{cresc.} instead of hairpins
2262 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2273 You can also supply your own texts
2274 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2275 \set crescendoText = \markup { \italic "cresc. poco" }
2276 \set crescendoSpanner = #'dashed-line
2280 To create new dynamic marks or text that should be aligned
2281 with dynamics, see @ref{New dynamic marks}.
2286 Dynamics that occur at, begin on, or end on, the same note
2287 will be vertically aligned. If you want to ensure that dynamics
2288 are aligned when they do not occur on the same note, you can
2289 increase the @code{staff-padding} property.
2292 \override DynamicLineSpanner #'staff-padding = #4
2295 You may also use this property if the dynamics are colliding
2296 with other notation.
2298 Crescendi and decrescendi that end on the first note of a
2299 new line are not printed. To change this behavior, use
2302 \override Score.Hairpin #'after-line-breaking = ##t
2305 Text style dynamic changes (such as cresc. and dim.) are printed with a
2306 dashed line showing their extent. To surpress printing this line, use
2309 \override DynamicTextSpanner #'dash-period = #-1.0
2315 @cindex @code{\dynamicUp}
2317 @cindex @code{\dynamicDown}
2318 @code{\dynamicDown},
2319 @cindex @code{\dynamicNeutral}
2320 @code{\dynamicNeutral}.
2325 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2326 Vertical positioning of these symbols is handled by
2327 @internalsref{DynamicLineSpanner}.
2331 @subsection Breath marks
2333 Breath marks are entered using @code{\breathe}
2335 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2342 The glyph of the breath mark can be tuned by overriding the
2343 @code{text} property of the @code{BreathingSign} layout object with
2344 any markup text. For example,
2345 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2347 \override BreathingSign #'text
2348 = #(make-musicglyph-markup "scripts.rvarcomma")
2355 Program reference: @internalsref{BreathingSign}.
2357 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2363 Short trills are printed like normal articulation; see @ref{Articulations}.
2365 Long running trills are made with @code{\startTrillSpan} and
2366 @code{\stopTrillSpan},
2368 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2370 << { c1 \startTrillSpan }
2371 { s2. \grace { d16[\stopTrillSpan e] } } >>
2375 @cindex Pitched trills
2377 Trills that should be executed on an explicitly specified pitch can be
2378 typeset with the command @code{pitchedTrill},
2380 @lilypond[ragged-right,verbatim,fragment,relative=1]
2381 \pitchedTrill c4\startTrillSpan fis
2385 The first argument is the main note. The pitch of the second
2386 is printed as a stemless note head in parentheses.
2391 @code{\startTrillSpan},
2392 @cindex @code{\startTrillSpan}
2393 @code{\stopTrillSpan}.
2394 @cindex @code{\stopTrillSpan}
2399 Program reference: @internalsref{TrillSpanner}.
2403 @subsection Glissando
2406 @cindex @code{\glissando}
2408 A glissando is a smooth change in pitch. It is denoted by a line or a
2409 wavy line between two notes. It is requested by attaching
2410 @code{\glissando} to a note
2412 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2414 \override Glissando #'style = #'zigzag
2421 Program reference: @internalsref{Glissando}.
2423 Example files: @file{input/@/regression/@/glissando@/.ly}.
2428 Printing text over the line (such as @emph{gliss.}) is not supported.
2432 @subsection Arpeggio
2435 @cindex broken chord
2436 @cindex @code{\arpeggio}
2438 You can specify an arpeggio sign (also known as broken chord) on a
2439 chord by attaching an @code{\arpeggio} to a chord
2441 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2445 A square bracket on the left indicates that the player should not
2446 arpeggiate the chord
2448 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2453 The direction of the arpeggio is sometimes denoted by adding an
2454 arrowhead to the wiggly line
2456 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2468 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2469 in both staves and set
2470 @internalsref{PianoStaff}.@code{connectArpeggios}
2472 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2474 \set PianoStaff.connectArpeggios = ##t
2475 \new Staff { <c' e g c>\arpeggio }
2476 \new Staff { \clef bass <c,, e g>\arpeggio }
2484 @cindex @code{\arpeggioUp}
2486 @cindex @code{\arpeggioDown}
2487 @code{\arpeggioDown},
2488 @cindex @code{\arpeggioNeutral}
2489 @code{\arpeggioNeutral},
2490 @cindex @code{\arpeggioBracket}
2491 @code{\arpeggioBracket}.
2496 Notation manual: @ref{Ties}, for writing out arpeggios.
2498 Program reference: @internalsref{Arpeggio}.
2503 It is not possible to mix connected arpeggios and unconnected
2504 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2511 Polyphony in music refers to having more than one voice occuring in
2512 a piece of music. Polyphony in LilyPond refers to having more than
2513 one voice on the same staff.
2517 * Explicitly instantiating voices::
2518 * Collision Resolution::
2522 @node Basic polyphony
2523 @subsection Basic polyphony
2527 The easiest way to enter fragments with more than one voice on a staff
2528 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2529 them simultaneously, separating the voices with @code{\\}
2533 @lilypond[quote,verbatim,fragment]
2534 \new Staff \relative c' {
2537 { g4 f e | d2 e2 } \\
2538 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2544 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2545 voices are sometimes called ``layers'' in other notation packages}
2547 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2548 each of these contexts, vertical direction of slurs, stems, etc., is set
2551 These voices are all separate from the voice that contains the notes just
2552 outside the @code{<< \\ >>} construct. This should be noted when making
2553 changes at the voice level. This also means that slurs and ties cannot go
2554 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2555 from separate @code{<< \\ >>} constructs on the same staff are the the
2556 same voice. Here is the same example, with different noteheads for each
2557 voice. Note that the change to the note-head style in the main voice does not affect
2558 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2559 voice in the first @code{<< \\ >>} construct is effective in the second
2560 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2562 @lilypond[quote,verbatim,fragment]
2563 \new Staff \relative c' {
2564 \override NoteHead #'style = #'cross
2568 { \override NoteHead #'style = #'triangle
2573 { c8 b16 a b8 g ~ g2 } \\
2574 { \override NoteHead #'style = #'slash s4 b4 c2 }
2579 Polyphony does not change the relationship of notes within a
2580 @code{\relative @{ @}} block. Each note is calculated relative
2581 to the note immediately preceding it.
2584 \relative @{ noteA << noteB \\ noteC >> noteD @}
2587 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2588 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2591 @node Explicitly instantiating voices
2592 @subsection Explicitly instantiating voices
2594 @internalsref{Voice} contexts can also be instantiated manually
2595 inside a @code{<< >>} block to create polyphonic music, using
2596 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2597 and a horizontal shift for each part.
2601 << \upper \\ \lower >>
2609 \new Voice = "1" @{ \voiceOne \upper @}
2610 \new Voice = "2" @{ \voiceTwo \lower @}
2614 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2615 articulations, text annotations, augmentation dots of dotted
2616 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2617 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2618 make them point downwards.
2619 The command @code{\oneVoice} will revert back to the normal setting.
2621 An expression that appears directly inside a @code{<< >>} belongs to
2622 the main voice. This is useful when extra voices appear while the main
2623 voice is playing. Here is a more correct rendition of the example from
2624 the previous section. The crossed noteheads demonstrate that the main
2625 melody is now in a single voice context.
2627 @lilypond[quote,ragged-right,verbatim]
2628 \new Staff \relative c' {
2629 \override NoteHead #'style = #'cross
2634 \new Voice="1" { \voiceTwo
2635 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2638 \new Voice { \voiceThree
2647 The correct definition of the voices allows the melody to be slurred.
2648 @lilypond[quote,ragged-right,verbatim]
2649 \new Staff \relative c' {
2654 \context Voice="1" { \voiceTwo
2655 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2658 \new Voice { \voiceThree
2667 Avoiding the @code{\\} seperator also allows nesting polyphony
2668 constructs, which in some case might be a more natural way to typeset
2671 @lilypond[quote,ragged-right,verbatim]
2672 \new Staff \relative c' {
2677 \context Voice="1" { \voiceTwo
2680 {c8 b16 a b8 g ~ g2}
2681 \new Voice { \voiceThree
2694 @node Collision Resolution
2695 @subsection Collision Resolution
2697 Normally, note heads with a different number of dots are not merged, but
2698 when the object property @code{merge-differently-dotted} is set in
2699 the @internalsref{NoteCollision} object, they are merged
2700 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
2703 \override Staff.NoteCollision
2704 #'merge-differently-dotted = ##t
2706 } \\ { g8.[ f16] g8.[ f16] } >>
2709 Similarly, you can merge half note heads with eighth notes, by setting
2710 @code{merge-differently-headed}
2711 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2714 \override Staff.NoteCollision
2715 #'merge-differently-headed = ##t
2716 c8 c4. } \\ { c2 c2 } >>
2719 LilyPond also vertically shifts rests that are opposite of a stem,
2722 @lilypond[quote,ragged-right,fragment,verbatim]
2723 \new Voice << c''4 \\ r4 >>
2729 @cindex @code{\oneVoice}
2731 @cindex @code{\voiceOne}
2733 @cindex @code{\voiceTwo}
2735 @cindex @code{\voiceThree}
2737 @cindex @code{\voiceFour}
2740 @cindex @code{\shiftOn}
2742 @cindex @code{\shiftOnn}
2744 @cindex @code{\shiftOnnn}
2746 @cindex @code{\shiftOff}
2747 @code{\shiftOff}: these commands specify in what chords of the current
2748 voice should be shifted. The outer voices (normally: voice one and
2749 two) have @code{\shiftOff}, while the inner voices (three and four)
2750 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2751 further shift levels.
2753 When LilyPond cannot cope, the @code{force-hshift}
2754 property of the @internalsref{NoteColumn} object and pitched rests can
2755 be used to override typesetting decisions.
2757 @lilypond[quote,verbatim,ragged-right]
2764 \once \override NoteColumn #'force-hshift = #1.7
2772 Program reference: the objects responsible for resolving collisions are
2773 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2776 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2777 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2778 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2779 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2780 @inputfileref{input/@/regression,collisions@/.ly}.
2785 When using @code{merge-differently-headed} with an upstem eighth or a
2786 shorter note, and a downstem half note, the eighth note gets the wrong
2789 There is no support for clusters where the same note occurs with
2790 different accidentals in the same chord. In this case, it is
2791 recommended to use enharmonic transcription, or to use special cluster
2792 notation (see @ref{Clusters}).
2799 Repetition is a central concept in music, and multiple notations exist
2805 * Repeats and MIDI::
2806 * Manual repeat commands::
2808 * Tremolo subdivisions::
2814 @subsection Repeat types
2817 @cindex @code{\repeat}
2819 The following types of repetition are supported
2823 Repeated music is fully written (played) out. This is useful when
2824 entering repetitious music. This is the only kind of repeat that
2825 is included in MIDI output.
2828 Repeats are not written out, but alternative endings (volte) are
2829 printed, left to right with brackets. This is the standard notation
2830 for repeats with alternatives. These are not played in MIDI output by default.
2834 Alternative endings are written stacked. This has limited use but may be
2835 used to typeset two lines of lyrics in songs with repeats, see
2836 @inputfileref{input,star-spangled-banner@/.ly}.
2840 Make tremolo beams. These are not played in MIDI output by default.
2843 Make beat or measure repeats. These look like percent signs. These
2844 are not played in MIDI output by default. Percent repeats must be
2845 declared within a Voice context.
2851 @subsection Repeat syntax
2853 LilyPond has one syntactic construct for specifying different types of
2854 repeats. The syntax is
2857 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2860 If you have alternative endings, you may add
2861 @cindex @code{\alternative}
2872 where each @var{alternative} is a music expression. If you do not
2873 give enough alternatives for all of the repeats, the first alternative
2874 is assumed to be played more than once.
2876 Standard repeats are used like this
2877 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2879 \repeat volta 2 { c4 d e f }
2880 \repeat volta 2 { f e d c }
2883 With alternative endings
2884 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2886 \repeat volta 2 {c4 d e f}
2887 \alternative { {d2 d} {f f,} }
2890 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2893 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2894 \alternative { { g4 g g } { a | a a a a | b2. } }
2898 It is possible to shorten volta brackets
2899 by setting @code{voltaSpannerDuration}. In the next example, the
2900 bracket only lasts one measure, which is a duration of 3/4.
2902 @lilypond[verbatim,ragged-right,quote]
2906 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2907 \repeat "volta" 5 { d d d }
2908 \alternative { { e e e f f f }
2918 Brackets for the repeat are normally only printed over the topmost
2919 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2920 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2925 @cindex repeat, ambiguous
2927 A nested repeat like
2936 is ambiguous, since it is is not clear to which @code{\repeat} the
2937 @code{\alternative} belongs. This ambiguity is resolved by always
2938 having the @code{\alternative} belong to the inner @code{\repeat}.
2939 For clarity, it is advisable to use braces in such situations.
2941 Timing information is not remembered at the start of an alternative,
2942 so after a repeat timing information must be reset by hand, for
2943 example by setting @code{Score.measurePosition} or entering
2944 @code{\partial}. Similarly, slurs or ties are also not repeated.
2947 @node Repeats and MIDI
2948 @subsection Repeats and MIDI
2950 @cindex expanding repeats
2951 @cindex @code{\unfoldRepeats}
2953 With a little bit of tweaking, all types of repeats can be present
2954 in the MIDI output. This is achieved by applying the
2955 @code{\unfoldRepeats} music function. This functions changes all
2956 repeats to unfold repeats.
2958 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2960 \repeat tremolo 8 {c'32 e' }
2961 \repeat percent 2 { c''8 d'' }
2962 \repeat volta 2 {c'4 d' e' f'}
2971 When creating a score file using @code{\unfoldRepeats} for midi, then
2972 it is necessary to make two @code{\score} blocks. One for MIDI (with
2973 unfolded repeats) and one for notation (with volta, tremolo, and
2974 percent repeats). For example,
2982 \unfoldRepeats @var{..music..}
2988 @node Manual repeat commands
2989 @subsection Manual repeat commands
2991 @cindex @code{repeatCommands}
2993 The property @code{repeatCommands} can be used to control the layout of
2994 repeats. Its value is a Scheme list of repeat commands.
2997 @item @code{start-repeat}
2998 Print a @code{|:} bar line.
3000 @item @code{end-repeat}
3001 Print a @code{:|} bar line.
3003 @item @code{(volta @var{text})}
3004 Print a volta bracket saying @var{text}: The text can be specified as
3005 a text string or as a markup text, see @ref{Text markup}. Do not
3006 forget to change the font, as the default number font does not contain
3007 alphabetic characters;
3009 @item @code{(volta #f)}
3010 Stop a running volta bracket.
3013 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3015 \set Score.repeatCommands = #'((volta "93") end-repeat)
3017 \set Score.repeatCommands = #'((volta #f))
3024 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
3025 @internalsref{VoltaRepeatedMusic},
3026 @internalsref{UnfoldedRepeatedMusic}, and
3027 @internalsref{FoldedRepeatedMusic}.
3030 @node Tremolo repeats
3031 @subsection Tremolo repeats
3033 @cindex tremolo beams
3035 To place tremolo marks between notes, use @code{\repeat} with tremolo
3037 @lilypond[quote,verbatim,ragged-right]
3038 \new Voice \relative c' {
3039 \repeat "tremolo" 8 { c16 d16 }
3040 \repeat "tremolo" 4 { c16 d16 }
3041 \repeat "tremolo" 2 { c16 d16 }
3045 Tremolo marks can also be put on a single note. In this case, the
3046 note should not be surrounded by braces.
3047 @lilypond[quote,verbatim,ragged-right]
3048 \repeat "tremolo" 4 c'16
3051 Similar output is obtained using the tremolo subdivision, described in
3052 @ref{Tremolo subdivisions}.
3057 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3059 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3061 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
3062 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
3065 @node Tremolo subdivisions
3066 @subsection Tremolo subdivisions
3068 @cindex tremolo marks
3069 @cindex @code{tremoloFlags}
3071 Tremolo marks can be printed on a single note by adding
3072 `@code{:}[@var{number}]' after the note. The number indicates the
3073 duration of the subdivision, and it must be at least 8. A
3074 @var{length} value of 8 gives one line across the note stem. If the
3075 length is omitted, the last value (stored in @code{tremoloFlags}) is
3078 @lilypond[quote,ragged-right,verbatim,fragment]
3079 c'2:8 c':32 | c': c': |
3085 Tremolos entered in this way do not carry over into the MIDI output.
3090 In this manual: @ref{Tremolo repeats}.
3092 Elsewhere: @internalsref{StemTremolo}.
3095 @node Measure repeats
3096 @subsection Measure repeats
3098 @cindex percent repeats
3099 @cindex measure repeats
3101 In the @code{percent} style, a note pattern can be repeated. It is
3102 printed once, and then the pattern is replaced with a special sign.
3103 Patterns of one and two measures are replaced by percent-like signs,
3104 patterns that divide the measure length are replaced by slashes.
3105 Percent repeats must be declared within a @code{Voice} context.
3107 @lilypond[quote,verbatim,ragged-right]
3108 \new Voice \relative c' {
3109 \repeat "percent" 4 { c4 }
3110 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3114 Measure repeats of more than 2 measures get a counter, if you switch
3115 on the @code{countPercentRepeats} property,
3117 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3118 \set countPercentRepeats = ##t
3120 \repeat "percent" 4 { c1 }
3125 Isolated percents can also be printed. This is done by putting a multi
3126 measure rest with a different print function,
3128 @lilypond[fragment,verbatim]
3129 \override MultiMeasureRest #'stencil
3130 = #ly:multi-measure-rest::percent
3139 Program reference: @internalsref{RepeatSlash},
3140 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3141 @internalsref{DoublePercentRepeatCounter},
3142 @internalsref{PercentRepeatCounter},
3143 @internalsref{PercentRepeatedMusic}, and