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]
113 There are predefined sets of note names for various other languages.
114 To use them, include the language specific init file. For
115 example: @code{\include "english.ly"}. The available language files
116 and the note names they define are
121 Note Names sharp flat
122 nederlands.ly c d e f g a bes b -is -es
123 english.ly c d e f g a bf b -s/-sharp -f/-flat
125 deutsch.ly c d e f g a b h -is -es
126 norsk.ly c d e f g a b h -iss/-is -ess/-es
127 svenska.ly c d e f g a b h -iss -ess
128 italiano.ly do re mi fa sol la sib si -d -b
129 catalan.ly do re mi fa sol la sib si -d/-s -b
130 espanol.ly do re mi fa sol la sib si -s -b
136 In accordance with standard typsetting rules, a natural sign is printed
137 before a sharp or flat if a previous accidental needs to be
138 cancelled. To change this behaviour, use
139 @code{\set Staff.extraNatural = ##f}
141 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
143 \set Staff.extraNatural = ##f
150 Program reference: @internalsref{LedgerLineSpanner}, @internalsref{NoteHead}.
153 @node Cautionary accidentals
154 @subsection Cautionary accidentals
156 @cindex reminder accidental
158 @cindex cautionary accidental
159 @cindex parenthesized accidental
162 Normally accidentals are printed automatically, but you may also
163 print them manually. A reminder accidental
164 can be forced by adding an exclamation mark @code{!}
165 after the pitch. A cautionary accidental
166 (i.e., an accidental within parentheses) can be obtained by adding the
167 question mark `@code{?}' after the pitch. These extra accidentals
168 can be used to produce natural signs, too.
170 @lilypond[quote,ragged-right,fragment,verbatim]
171 cis' cis' cis'! cis'? c c? c! c
177 The automatic production of accidentals can be tuned in many
178 ways. For more information, refer to @ref{Automatic accidentals}.
183 @subsection Micro tones
185 @cindex quarter tones
186 @cindex semi-flats, semi-sharps
188 Half-flats and half-sharps are formed by adding @code{-eh} and
189 @code{-ih}; the following is a series of Cs with increasing pitches
191 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
192 \set Staff.extraNatural = ##f
196 Micro tones are also exported to the MIDI file.
201 There are no generally accepted standards for denoting three quarter
202 flats, so LilyPond's symbol does not conform to any standard.
210 A chord is formed by a enclosing a set of pitches in @code{<} and
211 @code{>}. A chord may be followed by a duration, and a set of
212 articulations, just like simple notes
214 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
218 For more information about chords, see @ref{Chord names}.
229 Rests are entered like notes with the note name @code{r}
231 @lilypond[fragment,quote,ragged-right,verbatim]
235 Whole bar rests, centered in middle of the bar,
236 must be done with multi-measure rests. They can be used for a
237 single bar as well as many bars, and are discussed in
238 @ref{Multi measure rests}.
241 A rest's vertical position may be explicitly specified by entering a
242 note with the @code{\rest} keyword appended, the rest will be placed at
243 the note's place. This makes manual formatting in polyphonic music
244 easier. Automatic rest collision formatting will leave these rests
247 @lilypond[fragment,quote,ragged-right,verbatim]
253 Program reference: @internalsref{Rest}.
260 @cindex Invisible rest
265 An invisible rest (also called a `skip') can be entered like a note
266 with note name `@code{s}' or with @code{\skip @var{duration}}
268 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
269 a4 a4 s4 a4 \skip 1 a4
272 The @code{s} syntax is only available in note mode and chord mode. In
273 other situations, for example, when entering lyrics, you should use
274 the @code{\skip} command
276 @lilypond[quote,ragged-right,verbatim]
279 \new Lyrics \lyricmode { \skip 2 bla2 }
283 The skip command is merely an empty musical placeholder. It does not
284 produce any output, not even transparent output.
286 The @code{s} skip command does create @internalsref{Staff} and
287 @internalsref{Voice} when necessary, similar to note and rest
288 commands. For example, the following results in an empty staff.
290 @lilypond[quote,ragged-right,verbatim]
294 The fragment @code{@{ \skip 4 @} } would produce an empty page.
298 Program reference: @internalsref{SkipMusic}.
302 @subsection Durations
305 @cindex @code{\longa}
306 @cindex @code{\breve}
307 @cindex @code{\maxima}
309 In Note, Chord, and Lyrics mode, durations are designated by numbers and
310 dots: durations are entered as their reciprocal values. For example, a
311 quarter note is entered using a @code{4} (since it is a 1/4 note), while
312 a half note is entered using a @code{2} (since it is a 1/2 note). For
313 notes longer than a whole you must use the variables @code{\longa} and
318 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
320 r1 r2 r4 r8 r16 r32 r64 r64
326 a\breve*1/2 \autoBeamOff
327 a1 a2 a4 a8 a16 a32 a64 a64
330 r\longa*1/4 r\breve *1/2
331 r1 r2 r4 r8 r16 r32 r64 r64
337 \remove "Clef_engraver"
338 \override StaffSymbol #'transparent = ##t
339 \override TimeSignature #'transparent = ##t
340 \override BarLine #'transparent = ##t
341 \consists "Pitch_squash_engraver"
347 If the duration is omitted then it is set to the previously entered
348 duration. The default for the first note is a quarter note.
350 @lilypond[quote,ragged-right,verbatim,fragment]
351 { a a a2 a a4 a a1 a }
355 @node Augmentation dots
356 @subsection Augmentation dots
360 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
361 the number. Double-dotted notes are produced in a similar way.
363 @lilypond[quote,ragged-right,fragment,verbatim]
364 a'4 b' c''4. b'8 a'4. b'4.. c''8.
369 Dots are normally moved up to avoid staff lines, except in polyphonic
370 situations. The following commands may be used to force a particular
373 @cindex @code{\dotsUp}
375 @cindex @code{\dotsDown}
377 @cindex @code{\dotsNeutral}
382 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
390 @cindex @code{\times}
392 Tuplets are made out of a music expression by multiplying all durations
396 \times @var{fraction} @var{musicexpr}
400 The duration of @var{musicexpr} will be multiplied by the fraction.
401 The fraction's denominator will be printed over the notes, optionally
402 with a bracket. The most common tuplet is the triplet in which 3
403 notes have the length of 2, so the notes are 2/3 of their written
406 @lilypond[quote,ragged-right,fragment,verbatim]
407 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
410 Tuplets may be nested, for example,
412 @lilypond[fragment,ragged-right,verbatim,relative=2]
413 \set tupletNumberFormatFunction = #fraction-tuplet-formatter
416 \times 3/5 { a a a a a }
422 @cindex @code{\tupletUp}
424 @cindex @code{\tupletDown}
426 @cindex @code{\tupletNeutral}
427 @code{\tupletNeutral}.
432 @cindex @code{tupletNumberFormatFunction}
433 @cindex tuplet formatting
435 The property @code{tupletSpannerDuration} specifies how long each
436 bracket should last. With this, you can make lots of tuplets while
437 typing @code{\times} only once, thus saving lots of typing. In the next
438 example, there are two triplets shown, while @code{\times} was only
441 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
442 \set tupletSpannerDuration = #(ly:make-moment 1 4)
443 \times 2/3 { c8 c c c c c }
446 The format of the number is determined by the property
447 @code{tupletNumberFormatFunction}. The default prints only the
448 denominator, but if it is set to the Scheme function
449 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
452 To avoid printing tuplet numbers, use
454 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
455 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
456 \override TupletNumber #'transparent = ##t
457 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
463 Program reference: @internalsref{TupletBracket},
464 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
466 Examples: @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
470 @node Scaling durations
471 @subsection Scaling durations
473 You can alter the length of duration by a fraction @var{N/M}
474 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
475 will not affect the appearance of the notes or rests produced.
477 In the following example, the first three notes take up exactly two
478 beats, but no triplet bracket is printed.
479 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
481 a4*2/3 gis4*2/3 a4*2/3
489 This manual: @ref{Tuplets}
495 Whenever a note is found, a @internalsref{Stem} object is created
496 automatically. For whole notes and rests, they are also created but
501 @cindex @code{\stemUp}
503 @cindex @code{\stemDown}
505 @cindex @code{\stemNeutral}
511 To change the direction of stems in the middle of the staff, use
513 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
515 \override Stem #'neutral-direction = #up
517 \override Stem #'neutral-direction = #down
522 @node Alternate music entry
523 @section Alternate music entry
526 This section deals with tricks and features of the input language that
527 were added solely to help entering music and finding and correcting
528 mistakes. There are also external tools that make debugging easier.
529 See @ref{Point and click} for more information.
531 It is also possible to enter and edit music using other programs, such as
532 GUI interfaces or MIDI sequencers. Refer to the LilyPond
533 website for more information.
541 * Skipping corrected music::
542 * Automatic note splitting::
546 @node Relative octaves
547 @subsection Relative octaves
550 @cindex Relative octave specification
551 @cindex @code{\relative}
553 Octaves are specified by adding @code{'} and @code{,} to pitch names.
554 When you copy existing music, it is easy to accidentally put a pitch
555 in the wrong octave and hard to find such an error. The relative
556 octave mode prevents these errors by making the mistakes much
557 larger: a single error puts the rest of the piece off by one octave
560 \relative @var{startpitch} @var{musicexpr}
567 \relative @var{musicexpr}
570 The octave of notes that appear in @var{musicexpr} are calculated as
571 follows: if no octave changing marks are used, the basic interval
572 between this and the last note is always taken to be a fourth or
573 less. This distance is determined without regarding alterations; a
574 @code{fisis} following a @code{ceses} will be put above the
575 @code{ceses}. In other words, a doubly-augmented fourth is considered
576 a smaller interval than a diminished fifth, even though the
577 doubly-augmented fourth spans seven semitones while the diminished
578 fifth only spans six semitones.
580 The octave changing marks @code{'} and @code{,} can be added to raise
581 or lower the pitch by an extra octave. Upon entering relative mode,
582 an absolute starting pitch can be specified that will act as the
583 predecessor of the first note of @var{musicexpr}. If no starting pitch
584 is specified, then middle C is used as a start.
586 Here is the relative mode shown in action
587 @lilypond[quote,fragment,ragged-right,verbatim]
593 Octave changing marks are used for intervals greater than a fourth
594 @lilypond[quote,ragged-right,fragment,verbatim]
600 If the preceding item is a chord, the first note of the chord is used
601 to determine the first note of the next chord
603 @lilypond[quote,ragged-right,fragment,verbatim]
611 The pitch after the @code{\relative} contains a note name.
613 The relative conversion will not affect @code{\transpose},
614 @code{\chordmode} or @code{\relative} sections in its argument. To use
615 relative within transposed music, an additional @code{\relative} must
616 be placed inside @code{\transpose}.
620 @subsection Octave check
624 Octave checks make octave errors easier to correct: a note may be
625 followed by @code{=}@var{quotes} which indicates what its absolute
626 octave should be. In the following example,
629 \relative c'' @{ c='' b=' d,='' @}
633 the @code{d} will generate a warning, because a @code{d''} is expected
634 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
635 found. In the output, the octave is corrected to be a @code{d''} and
636 the next note is calculated relative to @code{d''} instead of @code{d'}.
638 There is also a syntax that is separate from the notes. The syntax
644 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
645 quotes) in \relative mode. If not, a warning is printed, and the
648 In the example below, the first check passes without incident, since
649 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
650 the second check produces a warning, since the @code{e} is not within
651 a fifth of @code{b'}. The warning message is printed, and the octave
652 is adjusted so that the following notes are in the correct octave
664 The octave of a note following an octave check is determined with
665 respect to the note preceding it. In the next fragment, the last note
666 is an @code{a'}, above middle C. That means that the @code{\octave}
667 check passes successfully, so the check could be deleted without changing
668 the output of the piece.
670 @lilypond[quote,ragged-right,verbatim,fragment]
680 @subsection Transpose
683 @cindex transposition of pitches
684 @cindex @code{\transpose}
686 A music expression can be transposed with @code{\transpose}. The
689 \transpose @var{from} @var{to} @var{musicexpr}
692 This means that @var{musicexpr} is transposed by the interval between
693 the pitches @var{from} and @var{to}: any note with pitch @code{from}
694 is changed to @code{to}.
696 For example, consider a piece written in the key of D-major. If
697 this piece is a little too low for its performer, it can be
698 transposed up to E-major with
700 \transpose d e @dots{}
703 Consider a part written for violin (a C instrument). If
704 this part is to be played on the A clarinet, the following
705 transposition will produce the appropriate part
708 \transpose a c @dots{}
711 @code{\transpose} distinguishes between enharmonic pitches: both
712 @code{\transpose c cis} or @code{\transpose c des} will transpose up
713 half a tone. The first version will print sharps and the second
714 version will print flats
716 @lilypond[quote,ragged-right,verbatim]
717 mus = { \key d \major cis d fis g }
726 @code{\transpose} may also be used to input written notes for a
727 transposing instrument. Pitches are normally entered into LilyPond
728 in C (or ``concert pitch''), but they may be entered in another
729 key. For example, when entering music for a B-flat trumpet which
730 begins on concert D, one would write
733 \transpose c bes @{ e4 @dots{} @}
736 To print this music in B-flat again (ie producing a trumpet part,
737 instead of a concert pitch conductor's score) you would wrap the
738 existing music with another @code{transpose}
741 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
747 Program reference: @internalsref{TransposedMusic}.
752 If you want to use both @code{\transpose} and @code{\relative},
753 you must put @code{\transpose} outside of @code{\relative}, since
754 @code{\relative} will have no effect music that appears inside a
759 @subsection Bar check
762 @cindex @code{barCheckSynchronize}
765 Bar checks help detect errors in the durations. A bar check is
766 entered using the bar symbol, `@code{|}'. Whenever it is encountered
767 during interpretation, it should fall on a measure boundary. If it
768 does not, a warning is printed. In the next example, the second bar
769 check will signal an error
771 \time 3/4 c2 e4 | g2 |
774 Bar checks can also be used in lyrics, for example
779 Twin -- kle | Twin -- kle
783 Failed bar checks are caused by entering incorrect
784 durations. Incorrect durations often completely garble up the score,
785 especially if the score is polyphonic, so a good place to start correcting
786 input is by scanning for failed bar checks and incorrect durations.
789 @cindex @code{pipeSymbol}
791 It is also possible to redefine the meaning of @code{|}. This is done
792 by assigning a music expression to @code{pipeSymbol},
794 @lilypond[quote,ragged-right,verbatim]
795 pipeSymbol = \bar "||"
801 @node Barnumber check
802 @subsection Barnumber check
804 When copying large pieces of music, it can be helpful to check that
805 the LilyPond bar number corresponds to the original that you are
806 entering from. This can be checked with @code{\barNumberCheck}, for
814 will print a warning if the @code{currentBarNumber} is not 123 when it
818 @node Skipping corrected music
819 @subsection Skipping corrected music
822 @cindex @code{skipTypesetting}
823 @cindex @code{showLastLength}
825 When entering or copying music, only the music near the end (where you
826 are adding notes) is interesting to view and correct. To speed up
827 this correction process, it is possible to skip typesetting of all but
828 the last few measures. This is achieved by putting
831 showLastLength = R1*5
836 in your source file. This will render only the last 5 measures
837 (assuming 4/4 time signature) of every @code{\score} in the input
838 file. For longer pieces, rendering only a small part is often an order
839 of magnitude quicker than rendering it completely
841 Skipping parts of a score can be controlled in a more fine-grained
842 fashing with the property @code{Score.skipTypesetting}. When it is
843 set, no typesetting is performed at all.
845 @lilypond[quote,fragment,ragged-right,verbatim]
848 \set Score.skipTypesetting = ##t
850 \set Score.skipTypesetting = ##f
854 In polyphonic music, @code{Score.skipTypesetting} will affect all
855 voices and staves, saving even more time.
858 @node Automatic note splitting
859 @subsection Automatic note splitting
861 Long notes can be converted automatically to tied notes. This is done
862 by replacing the @internalsref{Note_heads_engraver} by the
863 @internalsref{Completion_heads_engraver}.
864 In the following examples, notes crossing the bar line are split and tied.
866 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
868 \remove "Note_heads_engraver"
869 \consists "Completion_heads_engraver"
871 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
875 This engraver splits all running notes at the bar line, and inserts
876 ties. One of its uses is to debug complex scores: if the measures are
877 not entirely filled, then the ties exactly show how much each measure
883 Not all durations (especially those containing tuplets) can be
884 represented exactly with normal notes and dots, but the engraver will
887 @code{Completion_heads_engraver} only affects notes; it does not split
893 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
897 Program reference: @internalsref{Completion_heads_engraver}.
902 @section Staff notation
904 @cindex Staff notation
906 This section describes music notation that occurs on staff level,
907 such as key signatures, clefs and time signatures.
916 * System start delimiters::
926 The clef indicates which lines of the staff correspond to which
927 pitches. The clef is set with the @code{\clef} command
929 @lilypond[quote,ragged-right,fragment,verbatim]
930 { c''2 \clef alto g'2 }
940 @cindex mezzosoprano clef
941 @cindex baritone clef
942 @cindex varbaritone clef
945 Supported clefs finclude
947 @item treble, violin, G, G2
956 G clef on 1st line, so-called French violin clef
973 By adding @code{_8} or @code{^8} to the clef name, the clef is
974 transposed one octave down or up, respectively, and @code{_15} and
975 @code{^15} transposes by two octaves. The argument @var{clefname}
976 must be enclosed in quotes when it contains underscores or digits. For
979 @cindex choral tenor clef
980 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
987 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
988 @code{clefPosition} (which controls the Y position of the clef),
989 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
990 when any of these properties are changed. The following example shows
991 possibilities when setting properties manually.
993 @lilypond[quote,ragged-right,verbatim]
995 \set Staff.clefGlyph = #"clefs.F"
996 \set Staff.clefPosition = #2
998 \set Staff.clefGlyph = #"clefs.G"
1000 \set Staff.clefGlyph = #"clefs.C"
1002 \set Staff.clefOctavation = #7
1004 \set Staff.clefOctavation = #0
1005 \set Staff.clefPosition = #0
1009 \set Staff.middleCPosition = #4
1017 Program reference: @internalsref{Clef}.
1021 @subsection Key signature
1023 @cindex Key signature
1026 The key signature indicates the tonality in which a piece is played. It
1027 is denoted by a set of alterations (flats or sharps) at the start of the
1030 Setting or changing the key signature is done with the @code{\key}
1034 @code{\key} @var{pitch} @var{type}
1037 @cindex @code{\minor}
1038 @cindex @code{\major}
1039 @cindex @code{\minor}
1040 @cindex @code{\ionian}
1041 @cindex @code{\locrian}
1042 @cindex @code{\aeolian}
1043 @cindex @code{\mixolydian}
1044 @cindex @code{\lydian}
1045 @cindex @code{\phrygian}
1046 @cindex @code{\dorian}
1047 @cindex church modes
1049 Here, @var{type} should be @code{\major} or @code{\minor} to get
1050 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1051 use the standard mode names (also called ``church modes''): @code{\ionian},
1052 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1053 @code{\phrygian}, and @code{\dorian}.
1055 This command sets the context property
1056 @code{Staff.keySignature}. Non-standard key signatures
1057 can be specified by setting this property directly.
1059 Accidentals and key signatures often confuse new users, because
1060 unaltered notes get natural signs depending on the key signature. For
1061 more information, see @ref{More about pitches}.
1066 A natural sign is printed to cancel any previous accidentals. This
1067 can be suppressed by setting the @code{Staff.printKeyCancellation}
1070 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1075 \set Staff.printKeyCancellation = ##f
1085 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1088 @node Time signature
1089 @subsection Time signature
1091 @cindex Time signature
1093 @cindex @code{\time}
1095 Time signature indicates the metrum of a piece: a regular pattern of
1096 strong and weak beats. It is denoted by a fraction at the start of the
1099 The time signature is set with the @code{\time} command
1101 @lilypond[quote,ragged-right,fragment,verbatim]
1102 \time 2/4 c'2 \time 3/4 c'2.
1107 The symbol that is printed can be customized with the @code{style}
1108 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1111 @lilypond[fragment,quote,ragged-right,verbatim]
1114 \override Staff.TimeSignature #'style = #'()
1119 There are many more options for its layout. See @ref{Ancient time
1120 signatures} for more examples.
1122 @code{\time} sets the property @code{timeSignatureFraction},
1123 @code{beatLength} and @code{measureLength} in the @code{Timing}
1124 context, which is normally aliased to @internalsref{Score}. The
1125 property @code{measureLength} determines where bar lines should be
1126 inserted, and how automatic beams should be generated. Changing the
1127 value of @code{timeSignatureFraction} also causes the symbol to be
1130 More options are available through the Scheme function
1131 @code{set-time-signature}. In combination with the
1132 @internalsref{Measure_grouping_engraver}, it will create
1133 @internalsref{MeasureGrouping} signs. Such signs ease reading
1134 rhythmically complex modern music. In the following example, the 9/8
1135 measure is subdivided in 2, 2, 2 and 3. This is passed to
1136 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1138 @lilypond[quote,ragged-right,verbatim]
1141 #(set-time-signature 9 8 '(2 2 2 3))
1142 g8[ g] d[ d] g[ g] a8[( bes g]) |
1143 #(set-time-signature 5 8 '(3 2))
1149 \consists "Measure_grouping_engraver"
1157 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
1162 Automatic beaming does not use the measure grouping specified with
1163 @code{set-time-signature}.
1166 @node Partial measures
1167 @subsection Partial measures
1171 @cindex partial measure
1172 @cindex measure, partial
1173 @cindex shorten measures
1174 @cindex @code{\partial}
1176 Partial measures, such as an anacrusis or upbeat, are entered using the
1178 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1179 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1182 The syntax for this command is
1185 \partial @var{duration}
1188 This is internally translated into
1191 \set Timing.measurePosition = -@var{length of duration}
1194 The property @code{measurePosition} contains a rational number
1195 indicating how much of the measure has passed at this point.
1200 This command does not take into account grace notes at the start of
1201 the music. When a piece starts with graces notes in the pickup, then
1202 the @code{\partial} should follow the grace notes
1204 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1213 @subsection Bar lines
1217 @cindex measure lines
1220 Bar lines delimit measures, but are also used to indicate
1221 repeats. Normally they are inserted automatically. Line
1222 breaks may only happen on bar lines.
1224 Special types of bar lines can be forced with the @code{\bar} command
1226 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1230 The following bar types are available
1232 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1234 To allow a line break where there is no visible bar line, use
1241 This will insert an invisible bar line and allow line breaks at this
1244 In scores with many staves, a @code{\bar} command in one staff is
1245 automatically applied to all staves. The resulting bar lines are
1246 connected between different staves of a StaffGroup
1248 @lilypond[quote,ragged-right,fragment,verbatim]
1250 \context StaffGroup <<
1256 \new Staff { \clef bass c4 g e g }
1258 \new Staff { \clef bass c2 c2 }
1265 @cindex @code{whichBar}
1266 @cindex @code{repeatCommands}
1267 @cindex @code{defaultBarType}
1269 The command @code{\bar }@var{bartype} is a short cut for doing
1270 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1271 is set to a string, a bar line of that type is created.
1273 A bar line is created whenever the @code{whichBar} property is set.
1274 At the start of a measure it is set to the contents of
1275 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1276 to override default measure bars.
1278 You are encouraged to use @code{\repeat} for repetitions. See
1284 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1286 Program reference: @internalsref{BarLine} (created at
1287 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1289 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1292 @node Unmetered music
1293 @subsection Unmetered music
1296 @cindex @code{\cadenzaOn}
1297 @cindex @code{\cadenzaOff}
1299 Bar lines and bar numbers are calculated automatically. For unmetered
1300 music (cadenzas, for example), this is not desirable. To turn off
1301 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1302 and @code{\cadenzaOff}.
1304 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1316 LilyPond will only insert page breaks at a barline. Unless the unmetered
1317 music ends before the end of the staff line, you will need to insert
1325 to indicate where line breaks can occur.
1328 @node System start delimiters
1329 @subsection System start delimiters
1331 @cindex start of system
1332 @cindex Staff, multiple
1333 @cindex bracket, vertical
1334 @cindex brace, vertical
1337 @cindex staff, choir
1339 Many scores consist of more than one staff. These staves can be
1340 joined in four different ways
1343 @item The group is started with a brace at the left, and bar lines are
1344 connected. This is done with the @internalsref{GrandStaff} context.
1346 @lilypond[verbatim,ragged-right,quote]
1354 @item The group is started with a bracket, and bar lines are connected.
1355 This is done with the
1356 @internalsref{StaffGroup} context
1358 @lilypond[verbatim,ragged-right,quote]
1366 @item The group is started with a bracket, but bar lines are not
1367 connected. This is done with the @internalsref{ChoirStaff} context.
1369 @lilypond[verbatim,ragged-right,quote]
1377 @item The group is started with a vertical line. Bar lines are not
1378 connected. This is the default for the score.
1380 @lilypond[verbatim,ragged-right,quote]
1391 The bar lines at the start of each system are
1392 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1393 @internalsref{SystemStartBracket}. Only one of these types is created
1394 in every context, and that type is determined by the property
1395 @code{systemStartDelimiter}.
1399 @subsection Staff symbol
1401 @cindex adjusting staff symbol
1403 Notes, dynamic signs, etc., are grouped
1404 with a set of horizontal lines, called a staff (plural `staves'). In
1405 LilyPond, these lines are drawn using a separate layout object called
1408 The staff symbol may be tuned in the number, thickness and distance
1409 of lines, using properties. This is demonstrated in the example files
1410 @inputfileref{input/@/test,staff@/-lines@/.ly},
1411 @inputfileref{input/@/test,staff@/-size@/.ly}.
1413 In addition, staves may be started and stopped at will. This is done
1414 with @code{\startStaff} and @code{\stopStaff}.
1416 @lilypond[verbatim,relative=2,fragment]
1418 \override Staff.StaffSymbol #'line-count = 2
1419 \stopStaff \startStaff
1421 \revert Staff.StaffSymbol #'line-count
1422 \stopStaff \startStaff
1426 In combination with Frenched staves, this may be used to typeset ossia
1427 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1432 @lilypondfile{ossia.ly}
1434 @cindex staff lines, setting number of
1435 @cindex staff lines, setting thickness of
1436 @cindex thickness of staff lines, setting
1437 @cindex number of staff lines, setting
1441 Program reference: @internalsref{StaffSymbol}.
1443 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1444 @inputfileref{input/@/test@/,ossia.ly},
1445 @inputfileref{input/@/test,staff@/-size@/.ly}.
1449 @node Connecting notes
1450 @section Connecting notes
1452 This section deals with notation that affects groups of notes.
1470 A tie connects two adjacent note heads of the same pitch. The tie in
1471 effect extends the length of a note. Ties should not be confused with
1472 slurs, which indicate articulation, or phrasing slurs, which indicate
1473 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1475 @lilypond[quote,ragged-right,fragment,verbatim]
1476 e' ~ e' <c' e' g'> ~ <c' e' g'>
1479 When a tie is applied to a chord, all note heads whose pitches match
1480 are connected. When no note heads match, no ties will be created.
1482 A tie is just a way of extending a note duration, similar to the
1483 augmentation dot. The following example shows two ways of notating
1484 exactly the same concept
1486 @lilypond[quote,fragment,ragged-right]
1487 \time 3/4 c'2. c'2 ~ c'4
1491 Ties are used either when the note crosses a bar line, or when dots
1492 cannot be used to denote the rhythm. When using ties, larger note
1493 values should be aligned to subdivisions of the measure, eg.
1495 @lilypond[fragment,quote,ragged-right]
1497 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1501 If you need to tie a lot of notes over bars, it may be easier to use
1502 automatic note splitting (see @ref{Automatic note splitting}). This
1503 mechanism automatically splits long notes, and ties them across bar
1509 Ties are sometimes used to write out arpeggios. In this case, two tied
1510 notes need not be consecutive. This can be achieved by setting the
1511 @code{tieWaitForNote} property to true. The same feature is also useful,
1512 for example, to tie a tremolo to a chord. For example,
1514 @lilypond[fragment,verbatim,relative=1,ragged-right]
1515 \set tieWaitForNote = ##t
1516 \grace { c16[~ e~ g]~ } <c, e g>2
1517 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
1524 @cindex @code{\tieUp}
1526 @cindex @code{\tieDown}
1528 @cindex @code{\tieNeutral}
1530 @cindex @code{\tieDotted}
1532 @cindex @code{\tieDashed}
1534 @cindex @code{\tieSolid}
1540 In this manual: @ref{Automatic note splitting}.
1542 Program reference: @internalsref{Tie}.
1545 @inputfileref{input/@/regression,tie-arpeggio.ly}
1546 @inputfileref{input/@/regression,tie-manual.ly}
1553 Switching staves when a tie is active will not produce a slanted tie.
1561 A slur indicates that notes are to be played bound or
1562 @emph{legato}. They are entered using parentheses
1564 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1565 f( g a) a8 b( a4 g2 f4)
1569 The direction of a slur can be specified with
1570 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1571 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1574 However, there is a convenient shorthand for forcing slur
1575 directions. By adding @code{_} or @code{^} before the opening
1576 parentheses, the direction is also set. For example,
1578 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
1582 Only one slur can be printed at once. If you need to print a long
1583 slur over a few small slurs, please see @ref{Phrasing slurs}.
1588 Some composers write two slurs when they want legato chords. This can
1589 be achieved in LilyPond by setting @code{doubleSlurs},
1591 @lilypond[verbatim,ragged-right,relative,fragment,quote]
1592 \set doubleSlurs = ##t
1593 <c e>4 ( <d f> <c e> <d f> )
1599 @cindex @code{\slurUp}
1601 @cindex @code{\slurDown}
1603 @cindex @code{\slurNeutral}
1604 @code{\slurNeutral},
1605 @cindex @code{\slurDashed}
1607 @cindex @code{\slurDotted}
1609 @cindex @code{\slurSolid}
1614 Program reference: @seeinternals{Slur}.
1617 @node Phrasing slurs
1618 @subsection Phrasing slurs
1620 @cindex phrasing slurs
1621 @cindex phrasing marks
1623 A phrasing slur (or phrasing mark) connects notes and is used to
1624 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1627 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
1628 \time 6/4 c'\( d( e) f( e) d\)
1631 Typographically, the phrasing slur behaves almost exactly like a
1632 normal slur. However, they are treated as different objects. A
1633 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1634 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1635 @code{\phrasingSlurNeutral}.
1637 You cannot have simultaneous phrasing slurs.
1642 @cindex @code{\phrasingSlurUp}
1643 @code{\phrasingSlurUp},
1644 @cindex @code{\phrasingSlurDown}
1645 @code{\phrasingSlurDown},
1646 @cindex @code{\phrasingSlurNeutral}
1647 @code{\phrasingSlurNeutral}.
1652 Program reference: @internalsref{PhrasingSlur}.
1655 @node Automatic beams
1656 @subsection Automatic beams
1658 LilyPond inserts beams automatically
1660 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1661 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1664 When these automatic decisions are not good enough, beaming can be
1665 entered explicitly. It is also possible to define beaming patterns
1666 that differ from the defaults. See @ref{Setting automatic beam behavior}
1669 Individual notes may be marked with @code{\noBeam} to prevent them
1672 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1673 \time 2/4 c8 c\noBeam c c
1679 Program reference: @internalsref{Beam}.
1683 @subsection Manual beams
1685 @cindex beams, manual
1689 In some cases it may be necessary to override the automatic beaming
1690 algorithm. For example, the autobeamer will not put beams over rests
1691 or bar lines. Such beams are specified manually by marking the begin
1692 and end point with @code{[} and @code{]}
1694 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1696 r4 r8[ g' a r8] r8 g[ | a] r8
1703 @cindex @code{stemLeftBeamCount}
1704 @cindex @code{stemRightBeamCount}
1706 Normally, beaming patterns within a beam are determined automatically.
1707 If necessary, the properties @code{stemLeftBeamCount} and
1708 @code{stemRightBeamCount} can be used to override the defaults. If
1709 either property is set, its value will be used only once, and then it
1712 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
1717 \set stemLeftBeamCount = #1
1722 The property @code{subdivideBeams} can be set in order to subdivide
1723 all 16th or shorter beams at beat positions, as defined by the
1724 @code{beatLength} property.
1726 @lilypond[fragment,quote,relative=2,verbatim]
1728 \set subdivideBeams = ##t
1730 \set Score.beatLength = #(ly:make-moment 1 8)
1733 @cindex @code{subdivideBeams}
1735 Line breaks are normally forbidden when beams cross bar lines. This
1736 behavior can be changed by setting @code{allowBeamBreak}.
1738 @cindex @code{allowBeamBreak}
1739 @cindex beams and line breaks
1740 @cindex beams, kneed
1742 @cindex auto-knee-gap
1747 Kneed beams are inserted automatically when a large gap is detected
1748 between the note heads. This behavior can be tuned through the object.
1750 Automatically kneed cross-staff beams cannot be used together with
1751 hidden staves. See @ref{Hiding staves}.
1753 Beams do not avoid collisions with symbols around the notes, such as
1754 texts and accidentals.
1758 @subsection Grace notes
1760 @cindex @code{\grace}
1763 @cindex appoggiatura
1764 @cindex acciaccatura
1766 Grace notes are ornaments that are written out. The most common ones
1767 are acciaccatura, which should be played as very short. It is denoted
1768 by a slurred small note with a slashed stem. The appoggiatura is a
1769 grace note that takes a fixed fraction of the main note, and is
1770 denoted as a slurred note in small print without a slash. They
1771 are entered with the commands @code{\acciaccatura} and
1772 @code{\appoggiatura}, as demonstrated in the following example
1774 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1775 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1776 \acciaccatura { g16[ f] } e4
1779 Both are special forms of the @code{\grace} command. By prefixing this
1780 keyword to a music expression, a new one is formed, which will be
1781 printed in a smaller font and takes up no logical time in a measure.
1783 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1785 \grace { c16[ d16] } c2 c4
1789 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1790 @code{\grace} command does not start a slur.
1792 Internally, timing for grace notes is done using a second, `grace'
1793 timing. Every point in time consists of two rational numbers: one
1794 denotes the logical time, one denotes the grace timing. The above
1795 example is shown here with timing tuples
1797 @lilypond[quote,ragged-right]
1800 c4 \grace c16 c4 \grace {
1803 \new Lyrics \lyricmode {
1804 \override LyricText #'font-family = #'typewriter
1808 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1809 \markup { (\fraction 1 4 , 0 ) } 4
1811 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1812 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1814 \markup { ( \fraction 2 4 , 0 ) }
1819 The placement of grace notes is synchronized between different staves.
1820 In the following example, there are two sixteenth grace notes for
1821 every eighth grace note
1823 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1824 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1825 \new Staff { c4 \grace { g8[ b] } c4 } >>
1828 @cindex @code{\afterGrace}
1830 If you want to end a note with a grace, use the @code{\afterGrace}
1831 command. It takes two arguments: the main note, and the grace notes
1832 following the main note.
1834 @lilypond[ragged-right, verbatim,relative=2,fragment]
1835 c1 \afterGrace d1 { c16[ d] } c4
1838 This will put the grace notes after a ``space'' lasting 3/4 of the
1839 length of the main note. The fraction 3/4 can be changed by setting
1840 @code{afterGraceFraction}, ie.
1843 afterGraceFraction = #(cons 7 8)
1847 will put the grace note at 7/8 of the main note.
1849 The same effect can be achieved manually by doing
1851 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1854 { s2 \grace { c16[ d] } } >>
1860 By adjusting the duration of the skip note (here it is a half-note),
1861 the space between the main-note and the grace is adjusted.
1863 A @code{\grace} section will introduce special typesetting settings,
1864 for example, to produce smaller type, and set directions. Hence, when
1865 introducing layout tweaks, they should be inside the grace section,
1867 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1879 The overrides should also be reverted inside the grace section.
1881 The layout of grace sections can be changed throughout the music using
1882 the function @code{add-grace-property}. The following example
1883 undefines the Stem direction for this grace, so stems do not always
1888 #(add-grace-property 'Voice 'Stem 'direction '())
1894 Another option is to change the variables @code{startGraceMusic},
1895 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1896 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1897 @code{stopAppoggiaturaMusic}. More information is in the file
1898 @file{ly/@/grace@/-init@/.ly}.
1901 The slash through the stem in acciaccaturas can be obtained
1902 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
1906 Program reference: @internalsref{GraceMusic}.
1911 A score that starts with a @code{\grace} section needs an explicit
1912 @code{\context Voice} declaration, otherwise the main note and the grace
1913 note end up on different staves.
1915 Grace note synchronization can also lead to surprises. Staff notation,
1916 such as key signatures, bar lines, etc., are also synchronized. Take
1917 care when you mix staves with grace notes and staves without, for example,
1919 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
1920 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1921 \new Staff { c4 \bar "|:" d4 } >>
1925 This can be remedied by inserting grace skips of the corresponding
1926 durations in the other staves. For the above example
1929 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1932 Grace sections should only be used within sequential music
1933 expressions. Nesting or juxtaposing grace sections is not supported,
1934 and might produce crashes or other errors.
1938 @node Expressive marks
1939 @section Expressive marks
1941 Expressive marks help musicians to bring more to the music than simple
1946 * Fingering instructions::
1956 @subsection Articulations
1958 @cindex Articulations
1962 A variety of symbols can appear above and below notes to indicate
1963 different characteristics of the performance. They are added to a note
1964 by adding a dash and the character signifying the
1965 articulation. They are demonstrated here
1967 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
1969 The meanings of these shorthands can be changed. See
1970 @file{ly/@/script@/-init@/.ly} for examples.
1972 The script is automatically placed, but the direction can be forced as
1973 well. Like other pieces of LilyPond code, @code{_} will place them
1974 below the staff, and @code{^} will place them above.
1976 @lilypond[quote,ragged-right,fragment,verbatim]
1980 Other symbols can be added using the syntax
1981 @var{note}@code{\}@var{name}. Again, they
1982 can be forced up or down using @code{^} and @code{_},
1985 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
1986 c\fermata c^\fermata c_\fermata
1991 @cindex staccatissimo
2001 @cindex organ pedal marks
2010 @cindex prallmordent
2014 @cindex thumb marking
2019 Here is a chart showing all scripts available,
2021 @lilypondfile[ragged-right,quote]{script-chart.ly}
2026 The vertical ordering of scripts is controlled with the
2027 @code{script-priority} property. The lower this number, the closer it
2028 will be put to the note. In this example, the
2029 @internalsref{TextScript} (the sharp symbol) first has the lowest
2030 priority, so it is put lowest in the first example. In the second, the
2031 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2032 inside. When two objects have the same priority, the order in which
2033 they are entered decides which one comes first.
2035 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2036 \once \override TextScript #'script-priority = #-100
2037 a4^\prall^\markup { \sharp }
2039 \once \override Script #'script-priority = #-100
2040 a4^\prall^\markup { \sharp }
2046 Program reference: @internalsref{Script}.
2051 These signs appear in the printed output but have no effect on the
2052 MIDI rendering of the music.
2055 @node Fingering instructions
2056 @subsection Fingering instructions
2059 @cindex finger change
2061 Fingering instructions can be entered using
2063 @var{note}-@var{digit}
2065 For finger changes, use markup texts
2067 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2069 c^\markup { \finger "2 - 3" }
2072 You can use the thumb-script to indicate that a note should be
2073 played with the thumb (e.g., in cello music)
2074 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2075 <a_\thumb a'-3>8 <b_\thumb b'-3>
2078 Fingerings for chords can also be added to individual notes
2079 of the chord by adding them after the pitches
2080 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2081 < c-1 e-2 g-3 b-5 >4
2087 You may exercise greater control over fingering chords by
2088 setting @code{fingeringOrientations}
2090 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2091 \set fingeringOrientations = #'(left down)
2092 <c-1 es-2 g-4 bes-5 > 4
2093 \set fingeringOrientations = #'(up right down)
2094 <c-1 es-2 g-4 bes-5 > 4
2097 Using this feature, it is also possible to put fingering instructions
2098 very close to note heads in monophonic music,
2100 @lilypond[verbatim,ragged-right,quote,fragment]
2101 \set fingeringOrientations = #'(right)
2108 Program reference: @internalsref{Fingering}.
2110 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2114 @subsection Dynamics
2125 @cindex @code{\ffff}
2134 Absolute dynamic marks are specified using a command after a note
2135 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2136 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2137 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2138 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2140 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2141 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2142 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2149 A crescendo mark is started with @code{\<} and terminated with
2150 @code{\!} or an absolute dynamic. A decrescendo is started with
2151 @code{\>} and is also terminated with @code{\!} or an absolute
2152 dynamic. Because these marks are bound to notes, you must
2153 use spacer notes if multiple marks are needed during one note
2155 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2157 << f1 { s4 s4\< s4\! \> s4\! } >>
2161 A hairpin starts at the left edge of the beginning note and ends on the
2162 right edge of the ending note.
2164 This may give rise to very short hairpins. Use @code{minimum-length}
2165 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2169 \override Staff.Hairpin #'minimum-length = #5
2176 You can also use a text saying @emph{cresc.} instead of hairpins
2178 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2189 You can also supply your own texts
2190 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2191 \set crescendoText = \markup { \italic "cresc. poco" }
2192 \set crescendoSpanner = #'dashed-line
2196 To create new dynamic marks or text that should be aligned
2197 with dynamics, see @ref{New dynamic marks}.
2202 Dynamics that occur at, begin on, or end on, the same note
2203 will be vertically aligned. If you want to ensure that dynamics
2204 are aligned when they do not occur on the same note, you can
2205 increase the @code{staff-padding} property.
2208 \override DynamicLineSpanner #'staff-padding = #4
2211 You may also use this property if the dynamics are colliding
2212 with other notation.
2214 Crescendi and decrescendi that end on the first note of a
2215 new line are not printed. To change this behavior, use
2218 \override Score.Hairpin #'after-line-breaking = ##t
2224 @cindex @code{\dynamicUp}
2226 @cindex @code{\dynamicDown}
2227 @code{\dynamicDown},
2228 @cindex @code{\dynamicNeutral}
2229 @code{\dynamicNeutral}.
2234 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2235 Vertical positioning of these symbols is handled by
2236 @internalsref{DynamicLineSpanner}.
2240 @subsection Breath marks
2242 Breath marks are entered using @code{\breathe}
2244 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2251 The glyph of the breath mark can be tuned by overriding the
2252 @code{text} property of the @code{BreathingSign} layout object with
2253 any markup text. For example,
2254 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2256 \override BreathingSign #'text
2257 = #(make-musicglyph-markup "scripts.rvarcomma")
2264 Program reference: @internalsref{BreathingSign}.
2266 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2269 @node Running trills
2270 @subsection Running trills
2272 Long running trills are made with @code{\startTrillSpan} and
2273 @code{\stopTrillSpan},
2275 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2277 << { c1 \startTrillSpan }
2278 { s2. \grace { d16[\stopTrillSpan e] } } >>
2285 @code{\startTrillSpan},
2286 @cindex @code{\startTrillSpan}
2287 @code{\stopTrillSpan}.
2288 @cindex @code{\stopTrillSpan}
2293 This manual: @ref{Pitched trills}.
2295 Program reference: @internalsref{TrillSpanner}.
2299 @subsection Glissando
2302 @cindex @code{\glissando}
2304 A glissando is a smooth change in pitch. It is denoted by a line or a
2305 wavy line between two notes. It is requested by attaching
2306 @code{\glissando} to a note
2308 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2310 \override Glissando #'style = #'zigzag
2317 Program reference: @internalsref{Glissando}.
2319 Example files: @file{input/@/regression/@/glissando@/.ly}.
2324 Printing text over the line (such as @emph{gliss.}) is not supported.
2328 @subsection Arpeggio
2331 @cindex broken chord
2332 @cindex @code{\arpeggio}
2334 You can specify an arpeggio sign (also known as broken chord) on a
2335 chord by attaching an @code{\arpeggio} to a chord
2337 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2341 A square bracket on the left indicates that the player should not
2342 arpeggiate the chord
2344 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2349 The direction of the arpeggio is sometimes denoted by adding an
2350 arrowhead to the wiggly line
2352 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2364 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2365 in both staves and set
2366 @internalsref{PianoStaff}.@code{connectArpeggios}
2368 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2369 \context PianoStaff <<
2370 \set PianoStaff.connectArpeggios = ##t
2371 \new Staff { <c' e g c>\arpeggio }
2372 \new Staff { \clef bass <c,, e g>\arpeggio }
2380 @cindex @code{\arpeggioUp}
2382 @cindex @code{\arpeggioDown}
2383 @code{\arpeggioDown},
2384 @cindex @code{\arpeggioNeutral}
2385 @code{\arpeggioNeutral},
2386 @cindex @code{\arpeggioBracket}
2387 @code{\arpeggioBracket}.
2392 Notation manual: @ref{Ties}, for writing out arpeggios.
2394 Program reference: @internalsref{Arpeggio}.
2399 It is not possible to mix connected arpeggios and unconnected
2400 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2407 Polyphony in music refers to having more than one voice occuring in
2408 a piece of music. Polyphony in LilyPond refers to having more than
2409 one voice on the same staff.
2413 * Explicitly instantiating voices::
2414 * Collision Resolution::
2418 @node Basic polyphony
2419 @subsection Basic polyphony
2423 The easiest way to enter fragments with more than one voice on a staff
2424 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2425 them simultaneously, separating the voices with @code{\\}
2429 @lilypond[quote,verbatim,fragment]
2430 \new Staff \relative c' {
2433 { g4 f e | d2 e2 } \\
2434 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2440 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2441 voices are sometimes called ``layers'' in other notation packages}
2443 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2444 each of these contexts, vertical direction of slurs, stems, etc., is set
2447 These voices are all seperate from the voice that contains the notes just
2448 outside the @code{<< \\ >>} construct. This should be noted when making
2449 changes at the voice level. This also means that slurs and ties cannot go
2450 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2451 from separate @code{<< \\ >>} constructs on the same staff are the the
2452 same voice. Here is the same example, with different noteheads for each
2453 voice. Note that the change to the note-head style in the main voice does not affect
2454 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2455 voice in the first @code{<< \\ >>} construct is effective in the second
2456 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2458 @lilypond[quote,verbatim,fragment]
2459 \new Staff \relative c' {
2460 \override NoteHead #'style = #'cross
2464 { \override NoteHead #'style = #'triangle
2469 { c8 b16 a b8 g ~ g2 } \\
2470 { \override NoteHead #'style = #'slash s4 b4 c2 }
2475 Polyphony does not change the relationship of notes within a
2476 @code{\relative @{ @}} block. Each note is calculated relative
2477 to the note immediately preceding it.
2480 \relative @{ noteA << noteB \\ noteC >> noteD @}
2483 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2484 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2487 @node Explicitly instantiating voices
2488 @subsection Explicitly instantiating voices
2490 @internalsref{Voice} contexts can also be instantiated manually
2491 inside a @code{<< >>} block to create polyphonic music, using
2492 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2493 and a horizontal shift for each part.
2497 << \upper \\ \lower >>
2505 \context Voice = "1" @{ \voiceOne \upper @}
2506 \context Voice = "2" @{ \voiceTwo \lower @}
2510 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2511 articulations, text annotations, augmentation dots of dotted
2512 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2513 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2514 make them point downwards.
2515 The command @code{\oneVoice} will revert back to the normal setting.
2517 An expression that appears directly inside a @code{<< >>} belongs to
2518 the main voice. This is useful when extra voices appear while the main
2519 voice is playing. Here is a more correct rendition of the example from
2520 the previous section. The crossed noteheads demonstrate that the main
2521 melody is now in a single voice context.
2523 @lilypond[quote,ragged-right,verbatim]
2524 \new Staff \relative c' {
2525 \override NoteHead #'style = #'cross
2530 \context Voice="1" { \voiceTwo
2531 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2534 \new Voice { \voiceThree
2543 The correct definition of the voices allows the melody to be slurred.
2544 @lilypond[quote,ragged-right,verbatim]
2545 \new Staff \relative c' {
2550 \context Voice="1" { \voiceTwo
2551 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2554 \new Voice { \voiceThree
2563 Avoiding the @code{\\} seperator also allows nesting polyphony
2564 constructs, which in some case might be a more natural way to typeset
2567 @lilypond[quote,ragged-right,verbatim]
2568 \new Staff \relative c' {
2573 \context Voice="1" { \voiceTwo
2576 {c8 b16 a b8 g ~ g2}
2577 \new Voice { \voiceThree
2590 @node Collision Resolution
2591 @subsection Collision Resolution
2593 Normally, note heads with a different number of dots are not merged, but
2594 when the object property @code{merge-differently-dotted} is set in
2595 the @internalsref{NoteCollision} object, they are merged
2596 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
2599 \override Staff.NoteCollision
2600 #'merge-differently-dotted = ##t
2602 } \\ { g8.[ f16] g8.[ f16] } >>
2605 Similarly, you can merge half note heads with eighth notes, by setting
2606 @code{merge-differently-headed}
2607 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2610 \override Staff.NoteCollision
2611 #'merge-differently-headed = ##t
2612 c8 c4. } \\ { c2 c2 } >>
2615 LilyPond also vertically shifts rests that are opposite of a stem,
2618 @lilypond[quote,ragged-right,fragment,verbatim]
2619 \context Voice << c''4 \\ r4 >>
2625 @cindex @code{\oneVoice}
2627 @cindex @code{\voiceOne}
2629 @cindex @code{\voiceTwo}
2631 @cindex @code{\voiceThree}
2633 @cindex @code{\voiceFour}
2636 @cindex @code{\shiftOn}
2638 @cindex @code{\shiftOnn}
2640 @cindex @code{\shiftOnnn}
2642 @cindex @code{\shiftOff}
2643 @code{\shiftOff}: these commands specify in what chords of the current
2644 voice should be shifted. The outer voices (normally: voice one and
2645 two) have @code{\shiftOff}, while the inner voices (three and four)
2646 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2647 further shift levels.
2649 When LilyPond cannot cope, the @code{force-hshift}
2650 property of the @internalsref{NoteColumn} object and pitched rests can
2651 be used to override typesetting decisions.
2653 @lilypond[quote,verbatim,ragged-right]
2660 \once \override NoteColumn #'force-hshift = #1.7
2668 Program reference: the objects responsible for resolving collisions are
2669 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2672 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2673 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2674 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2675 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2676 @inputfileref{input/@/regression,collisions@/.ly}.
2681 When using @code{merge-differently-headed} with an upstem eighth or a
2682 shorter note, and a downstem half note, the eighth note gets the wrong
2685 There is no support for clusters where the same note occurs with
2686 different accidentals in the same chord. In this case, it is
2687 recommended to use enharmonic transcription, or to use special cluster
2688 notation (see @ref{Clusters}).
2695 Repetition is a central concept in music, and multiple notations exist
2701 * Repeats and MIDI::
2702 * Manual repeat commands::
2704 * Tremolo subdivisions::
2710 @subsection Repeat types
2713 @cindex @code{\repeat}
2715 The following types of repetition are supported
2719 Repeated music is fully written (played) out. This is useful when
2720 entering repetitious music. This is the only kind of repeat that
2721 is included in MIDI output.
2724 Repeats are not written out, but alternative endings (volte) are
2725 printed, left to right with brackets. This is the standard notation
2726 for repeats with alternatives. These are not played in MIDI output by default.
2730 Alternative endings are written stacked. This has limited use but may be
2731 used to typeset two lines of lyrics in songs with repeats, see
2732 @inputfileref{input,star-spangled-banner@/.ly}.
2736 Make tremolo beams. These are not played in MIDI output by default.
2739 Make beat or measure repeats. These look like percent signs. These
2740 are not played in MIDI output by default. Percent repeats must be
2741 declared within a Voice context.
2747 @subsection Repeat syntax
2749 LilyPond has one syntactic construct for specifying different types of
2750 repeats. The syntax is
2753 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2756 If you have alternative endings, you may add
2757 @cindex @code{\alternative}
2768 where each @var{alternative} is a music expression. If you do not
2769 give enough alternatives for all of the repeats, the first alternative
2770 is assumed to be played more than once.
2772 Standard repeats are used like this
2773 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2775 \repeat volta 2 { c4 d e f }
2776 \repeat volta 2 { f e d c }
2779 With alternative endings
2780 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2782 \repeat volta 2 {c4 d e f}
2783 \alternative { {d2 d} {f f,} }
2786 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2789 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2790 \alternative { { g4 g g } { a | a a a a | b2. } }
2794 It is possible to shorten volta brackets
2795 by setting @code{voltaSpannerDuration}. In the next example, the
2796 bracket only lasts one measure, which is a duration of 3/4.
2798 @lilypond[verbatim,ragged-right,quote]
2802 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2803 \repeat "volta" 5 { d d d }
2804 \alternative { { e e e f f f }
2814 Brackets for the repeat are normally only printed over the topmost
2815 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2816 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2821 @cindex repeat, ambiguous
2823 A nested repeat like
2832 is ambiguous, since it is is not clear to which @code{\repeat} the
2833 @code{\alternative} belongs. This ambiguity is resolved by always
2834 having the @code{\alternative} belong to the inner @code{\repeat}.
2835 For clarity, it is advisable to use braces in such situations.
2837 Timing information is not remembered at the start of an alternative,
2838 so after a repeat timing information must be reset by hand, for
2839 example by setting @code{Score.measurePosition} or entering
2840 @code{\partial}. Similarly, slurs or ties are also not repeated.
2843 @node Repeats and MIDI
2844 @subsection Repeats and MIDI
2846 @cindex expanding repeats
2847 @cindex @code{\unfoldRepeats}
2849 With a little bit of tweaking, all types of repeats can be present
2850 in the MIDI output. This is achieved by applying the
2851 @code{\unfoldRepeats} music function. This functions changes all
2852 repeats to unfold repeats.
2854 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
2856 \repeat tremolo 8 {c'32 e' }
2857 \repeat percent 2 { c''8 d'' }
2858 \repeat volta 2 {c'4 d' e' f'}
2867 When creating a score file using @code{\unfoldRepeats} for midi, then
2868 it is necessary to make two @code{\score} blocks. One for MIDI (with
2869 unfolded repeats) and one for notation (with volta, tremolo, and
2870 percent repeats). For example,
2878 \unfoldRepeats @var{..music..}
2884 @node Manual repeat commands
2885 @subsection Manual repeat commands
2887 @cindex @code{repeatCommands}
2889 The property @code{repeatCommands} can be used to control the layout of
2890 repeats. Its value is a Scheme list of repeat commands.
2893 @item @code{start-repeat}
2894 Print a @code{|:} bar line.
2896 @item @code{end-repeat}
2897 Print a @code{:|} bar line.
2899 @item @code{(volta @var{text})}
2900 Print a volta bracket saying @var{text}: The text can be specified as
2901 a text string or as a markup text, see @ref{Text markup}. Do not
2902 forget to change the font, as the default number font does not contain
2903 alphabetic characters;
2905 @item @code{(volta #f)}
2906 Stop a running volta bracket.
2909 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2911 \set Score.repeatCommands = #'((volta "93") end-repeat)
2913 \set Score.repeatCommands = #'((volta #f))
2920 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2921 @internalsref{VoltaRepeatedMusic},
2922 @internalsref{UnfoldedRepeatedMusic}, and
2923 @internalsref{FoldedRepeatedMusic}.
2926 @node Tremolo repeats
2927 @subsection Tremolo repeats
2929 @cindex tremolo beams
2931 To place tremolo marks between notes, use @code{\repeat} with tremolo
2933 @lilypond[quote,verbatim,ragged-right]
2934 \new Voice \relative c' {
2935 \repeat "tremolo" 8 { c16 d16 }
2936 \repeat "tremolo" 4 { c16 d16 }
2937 \repeat "tremolo" 2 { c16 d16 }
2941 Tremolo marks can also be put on a single note. In this case, the
2942 note should not be surrounded by braces.
2943 @lilypond[quote,verbatim,ragged-right]
2944 \repeat "tremolo" 4 c'16
2947 Similar output is obtained using the tremolo subdivision, described in
2948 @ref{Tremolo subdivisions}.
2953 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2955 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
2957 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2958 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2961 @node Tremolo subdivisions
2962 @subsection Tremolo subdivisions
2964 @cindex tremolo marks
2965 @cindex @code{tremoloFlags}
2967 Tremolo marks can be printed on a single note by adding
2968 `@code{:}[@var{number}]' after the note. The number indicates the
2969 duration of the subdivision, and it must be at least 8. A
2970 @var{length} value of 8 gives one line across the note stem. If the
2971 length is omitted, the last value (stored in @code{tremoloFlags}) is
2974 @lilypond[quote,ragged-right,verbatim,fragment]
2975 c'2:8 c':32 | c': c': |
2981 Tremolos entered in this way do not carry over into the MIDI output.
2986 In this manual: @ref{Tremolo repeats}.
2988 Elsewhere: @internalsref{StemTremolo}.
2991 @node Measure repeats
2992 @subsection Measure repeats
2994 @cindex percent repeats
2995 @cindex measure repeats
2997 In the @code{percent} style, a note pattern can be repeated. It is
2998 printed once, and then the pattern is replaced with a special sign.
2999 Patterns of one and two measures are replaced by percent-like signs,
3000 patterns that divide the measure length are replaced by slashes.
3001 Percent repeats must be declared within a @code{Voice} context.
3003 @lilypond[quote,verbatim,ragged-right]
3004 \new Voice \relative c' {
3005 \repeat "percent" 4 { c4 }
3006 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3010 Measure repeats of more than 2 measures get a counter, if you switch
3011 on the @code{countPercentRepeats} property,
3013 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3014 \set countPercentRepeats = ##t
3016 \repeat "percent" 4 { c1 }
3021 Isolated percents can also be printed. This is done by putting a multi
3022 measure rest with a different print function,
3024 @lilypond[fragment,verbatim]
3025 \override MultiMeasureRest #'stencil
3026 = #ly:multi-measure-rest::percent
3035 Program reference: @internalsref{RepeatSlash},
3036 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3037 @internalsref{DoublePercentRepeatCounter},
3038 @internalsref{PercentRepeatCounter},
3039 @internalsref{PercentRepeatedMusic}, and