1 @c -*- coding: latin-1; 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::
51 @cindex Note specification
52 @cindex entering notes
54 A note is printed by specifying its pitch and then its duration,
56 @lilypond[quote,verbatim,raggedright,fragment]
62 This manual: @ref{Pitches}, @ref{Durations}
71 The most common syntax for pitch entry is used for standard notes and
72 @code{\chordmode} modes. In these modes, pitches may be designated by
73 names. The notes are specified by the letters @code{a} through
74 @code{g}. The octave is formed with notes ranging from @code{c}
75 to @code{b}. The pitch @code{c} is an octave below middle C and the
76 letters span the octave above that C
78 @lilypond[quote,fragment,verbatim,raggedright]
80 a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
86 The optional octave specification takes the form of a series of
87 single quote (`@code{'}') characters or a series of comma
88 (`@code{,}') characters. Each @code{'} raises the pitch by one
89 octave; each @code{,} lowers the pitch by an octave
91 @lilypond[quote,raggedright,fragment,verbatim]
95 @cindex note names, Dutch
97 A sharp is formed by adding @code{-is} to the end of a pitch name and
98 a flat is formed by adding @code{-es}. Double sharps and double flats
99 are obtained by adding @code{-isis} or @code{-eses}. These
100 names are the Dutch note names. In Dutch, @code{aes} is contracted to
101 @code{as}, but both forms are accepted. Similarly, both
102 @code{es} and @code{ees} are accepted
104 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
112 There are predefined sets of note names for various other languages.
113 To use them, include the language specific init file. For
114 example: @code{\include "english.ly"}. The available language files
115 and the note names they define are
120 Note Names sharp flat
121 nederlands.ly c d e f g a bes b -is -es
122 english.ly c d e f g a bf b -s/-sharp -f/-flat
124 deutsch.ly c d e f g a b h -is -es
125 norsk.ly c d e f g a b h -iss/-is -ess/-es
126 svenska.ly c d e f g a b h -iss -ess
127 italiano.ly do re mi fa sol la sib si -d -b
128 catalan.ly do re mi fa sol la sib si -d/-s -b
129 espanol.ly do re mi fa sol la sib si -s -b
135 In accordance with standard typsetting rules, a natural sign is printed
136 before a sharp or flat if a previous accidental needs to be
137 cancelled. To change this behaviour, use
138 @code{\set Staff.extraNatural = ##f}
140 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
142 \set Staff.extraNatural = ##f
149 Program reference: @internalsref{LedgerLineSpanner}, @internalsref{NoteHead}.
152 @node Cautionary accidentals
153 @subsection Cautionary accidentals
155 @cindex reminder accidental
157 @cindex cautionary accidental
158 @cindex parenthesized accidental
161 Normally accidentals are printed automatically, but you may also
162 print them manually. A reminder accidental
163 can be forced by adding an exclamation mark @code{!}
164 after the pitch. A cautionary accidental
165 (i.e., an accidental within parentheses) can be obtained by adding the
166 question mark `@code{?}' after the pitch.
168 @lilypond[quote,raggedright,fragment,verbatim]
169 cis' cis' cis'! cis'?
175 The automatic production of accidentals can be tuned in many
176 ways. For more information, refer to @ref{Automatic accidentals}.
181 @subsection Micro tones
183 @cindex quarter tones
184 @cindex semi-flats, semi-sharps
186 Half-flats and half-sharps are formed by adding @code{-eh} and
187 @code{-ih}; the following is a series of Cs with increasing pitches
189 @lilypond[verbatim,raggedright,quote,relative=2,fragment]
190 \set Staff.extraNatural = ##f
194 Micro tones are also exported to the MIDI file.
199 There are no generally accepted standards for denoting three quarter
200 flats, so LilyPond's symbol does not conform to any standard.
208 A chord is formed by a enclosing a set of pitches in @code{<} and
209 @code{>}. A chord may be followed by a duration, and a set of
210 articulations, just like simple notes
212 @lilypond[verbatim,raggedright,fragment,quote,relative=1]
216 For more information about chords, see @ref{Chord names}.
227 Rests are entered like notes with the note name @code{r}
229 @lilypond[fragment,quote,raggedright,verbatim]
233 Whole bar rests, centered in middle of the bar,
234 must be done with multi-measure rests. They are discussed in
235 @ref{Multi measure rests}.
238 A rest's vertical position may be explicitly specified by entering a
239 note with the @code{\rest} keyword appended, the rest will be placed at
240 the note's place. This makes manual formatting in polyphonic music
241 easier. Automatic rest collision formatting will leave these rests
244 @lilypond[fragment,quote,raggedright,verbatim]
250 Program reference: @internalsref{Rest}.
257 @cindex Invisible rest
262 An invisible rest (also called a `skip') can be entered like a note
263 with note name `@code{s}' or with @code{\skip @var{duration}}
265 @lilypond[fragment,quote,raggedright,verbatim,relative=2]
266 a4 a4 s4 a4 \skip 1 a4
269 The @code{s} syntax is only available in note mode and chord mode. In
270 other situations, for example, when entering lyrics, you should use
271 the @code{\skip} command
273 @lilypond[quote,raggedright,verbatim]
276 \new Lyrics \lyricmode { \skip 2 bla2 }
280 The skip command is merely an empty musical placeholder. It does not
281 produce any output, not even transparent output.
283 The @code{s} skip command does create @internalsref{Staff} and
284 @internalsref{Voice} when necessary, similar to note and rest
285 commands. For example, the following results in an empty staff.
287 @lilypond[quote,raggedright,verbatim]
291 The fragment @code{@{ \skip 4 @} } would produce an empty page.
295 Program reference: @internalsref{SkipMusic}.
299 @subsection Durations
302 @cindex @code{\longa}
303 @cindex @code{\breve}
304 @cindex @code{\maxima}
306 In Note, Chord, and Lyrics mode, durations are designated by numbers and
307 dots: durations are entered as their reciprocal values. For example, a
308 quarter note is entered using a @code{4} (since it is a 1/4 note), while
309 a half note is entered using a @code{2} (since it is a 1/2 note). For
310 notes longer than a whole you must use the variables @code{\longa} and
315 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
317 r1 r2 r4 r8 r16 r32 r64 r64
323 a\breve*1/2 \autoBeamOff
324 a1 a2 a4 a8 a16 a32 a64 a64
327 r\longa*1/4 r\breve *1/2
328 r1 r2 r4 r8 r16 r32 r64 r64
334 \remove "Clef_engraver"
335 \override StaffSymbol #'transparent = ##t
336 \override TimeSignature #'transparent = ##t
337 \override BarLine #'transparent = ##t
338 \consists "Pitch_squash_engraver"
344 If the duration is omitted then it is set to the previously entered
345 duration. The default for the first note is a quarter note.
347 @lilypond[quote,raggedright,verbatim,fragment]
348 { a a a2 a a4 a a1 a }
352 @node Augmentation dots
353 @subsection Augmentation dots
357 To obtain dotted note lenghts, simply add a dot (`@code{.}') to
358 the number. Double-dotted notes are produced in a similar way.
360 @lilypond[quote,raggedright,fragment,verbatim]
361 a'4 b' c''4. b'8 a'4. b'4.. c''8.
366 Dots are normally moved up to avoid staff lines, except in polyphonic
367 situations. The following commands may be used to force a particular
370 @cindex @code{\dotsUp}
372 @cindex @code{\dotsDown}
374 @cindex @code{\dotsNeutral}
379 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
387 @cindex @code{\times}
389 Tuplets are made out of a music expression by multiplying all durations
393 \times @var{fraction} @var{musicexpr}
397 The duration of @var{musicexpr} will be multiplied by the fraction.
398 The fraction's denominator will be printed over the notes, optionally
399 with a bracket. The most common tuplet is the triplet in which 3
400 notes have the length of 2, so the notes are 2/3 of their written
403 @lilypond[quote,raggedright,fragment,verbatim]
404 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
409 @cindex @code{\tupletUp}
411 @cindex @code{\tupletDown}
413 @cindex @code{\tupletNeutral}
414 @code{\tupletNeutral}.
419 @cindex @code{tupletNumberFormatFunction}
420 @cindex tuplet formatting
422 The property @code{tupletSpannerDuration} specifies how long each
423 bracket should last. With this, you can make lots of tuplets while
424 typing @code{\times} only once, thus saving lots of typing. In the next
425 example, there are two triplets shown, while @code{\times} was only
428 @lilypond[quote,fragment,relative=1,raggedright,verbatim]
429 \set tupletSpannerDuration = #(ly:make-moment 1 4)
430 \times 2/3 { c'8 c c c c c }
433 The format of the number is determined by the property
434 @code{tupletNumberFormatFunction}. The default prints only the
435 denominator, but if it is set to the Scheme function
436 @code{fraction-tuplet-formatter}, @var{num}:@var{den} will be printed
442 Program reference: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
447 Nested tuplets are not formatted automatically. In this case, outer
448 tuplet brackets should be moved manually, which is demonstrated in
449 @inputfileref{input/@/regression,tuplet@/-nest@/.ly}.
452 @node Scaling durations
453 @subsection Scaling durations
455 You can alter the length of duration by a fraction @var{N/M}
456 appending `@code{*}@var{N/M}' (or `@code{*}@var{N}' if @var{M=1}). This
457 will not affect the appearance of the notes or rests produced.
459 In the following example, the first three notes take up exactly two
460 beats, but no triplet bracket is printed.
461 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
463 a4*2/3 gis4*2/3 a4*2/3
471 This manual: @ref{Tuplets}
475 @node Alternate music entry
476 @section Alternate music entry
479 This section deals with tricks and features of the input language that
480 were added solely to help entering music and finding and correcting
481 mistakes. There are also external tools that make debugging easier.
482 See @ref{Point and click} for more information.
484 It is also possible to enter and edit music using other programs, such as
485 GUI interfaces or MIDI sequencers. Refer to the LilyPond
486 website for more information.
494 * Skipping corrected music::
495 * Automatic note splitting::
499 @node Relative octaves
500 @subsection Relative octaves
503 @cindex Relative octave specification
504 @cindex @code{\relative}
506 Octaves are specified by adding @code{'} and @code{,} to pitch names.
507 When you copy existing music, it is easy to accidentally put a pitch
508 in the wrong octave and hard to find such an error. The relative
509 octave mode prevents these errors by making the mistakes much
510 larger: a single error puts the rest of the piece off by one octave
513 \relative @var{startpitch} @var{musicexpr}
520 \relative @var{musicexpr}
523 The octave of notes that appear in @var{musicexpr} are calculated as
524 follows: if no octave changing marks are used, the basic interval
525 between this and the last note is always taken to be a fourth or
526 less. This distance is determined without regarding alterations; a
527 @code{fisis} following a @code{ceses} will be put above the
528 @code{ceses}. In other words, a doubly-augmented fourth is considered
529 a smaller interval than a diminshed fifth, even though the fourth is
530 seven semitones while the fifth is only six semitones.
532 The octave changing marks @code{'} and @code{,} can be added to raise
533 or lower the pitch by an extra octave. Upon entering relative mode,
534 an absolute starting pitch can be specified that will act as the
535 predecessor of the first note of @var{musicexpr}. If no starting pitch
536 is specified, then middle C is used as a start.
538 Here is the relative mode shown in action
539 @lilypond[quote,fragment,raggedright,verbatim]
545 Octave changing marks are used for intervals greater than a fourth
546 @lilypond[quote,raggedright,fragment,verbatim]
552 If the preceding item is a chord, the first note of the chord is used
553 to determine the first note of the next chord
555 @lilypond[quote,raggedright,fragment,verbatim]
563 The pitch after the @code{\relative} contains a note name.
565 The relative conversion will not affect @code{\transpose},
566 @code{\chordmode} or @code{\relative} sections in its argument. To use
567 relative within transposed music, an additional @code{\relative} must
568 be placed inside @code{\transpose}.
572 @subsection Octave check
576 Octave checks make octave errors easier to correct: a note may be
577 followed by @code{=}@var{quotes} which indicates what its absolute
578 octave should be. In the following example,
581 \relative c'' @{ c='' b=' d,='' @}
585 the @code{d} will generate a warning, because a @code{d''} is expected
586 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
587 found. In the output, the octave is corrected to be a @code{d''} and
588 the next note is calculated relative to @code{d''} instead of @code{d'}.
590 There is also a syntax that is separate from the notes. The syntax
596 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
597 quotes) in \relative mode. If not, a warning is printed, and the
600 In the example below, the first check passes without incident, since
601 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
602 the second check produces a warning, since the @code{e} is not within
603 a fifth of @code{b'}. The warning message is printed, and the octave
604 is adjusted so that the following notes are in the correct octave
616 The octave of a note following an octave check is determined with
617 respect to the note preceding it. In the next fragment, the last note
618 is an @code{a'}, above middle C. That means that the @code{\octave}
619 check passes successfully, so the check could be deleted without changing
620 the output of the piece.
622 @lilypond[quote,raggedright,verbatim,fragment]
632 @subsection Transpose
635 @cindex transposition of pitches
636 @cindex @code{\transpose}
638 A music expression can be transposed with @code{\transpose}. The
641 \transpose @var{from} @var{to} @var{musicexpr}
644 This means that @var{musicexpr} is transposed by the interval between
645 the pitches @var{from} and @var{to}: any note with pitch @code{from}
646 is changed to @code{to}.
648 For example, consider a piece written in the key of D-major. If
649 this piece is a little too low for its performer, it can be
650 transposed up to E-major with
652 \transpose d e @dots{}
655 Consider a part written for violin (a C instrument). If
656 this part is to be played on the A clarinet, the following
657 transposition will produce the appropriate part
660 \transpose a c @dots{}
663 @code{\transpose} distinguishes between enharmonic pitches: both
664 @code{\transpose c cis} or @code{\transpose c des} will transpose up
665 half a tone. The first version will print sharps and the second
666 version will print flats
668 @lilypond[quote,raggedright,verbatim]
669 mus = { \key d \major cis d fis g }
678 @code{\transpose} may also be used to input written notes for a
679 transposing instrument. Pitches are normally entered into LilyPond
680 in C (or ``concert pitch''), but they may be entered in another
681 key. For example, when entering music for a B-flat trumpet which
682 begins on concert D, one would write
685 \transpose c bes @{ e4 @dots{} @}
688 To print this music in B-flat again (ie producing a trumpet part,
689 instead of a concert pitch conductor's score) you would wrap the
690 existing music with another @code{transpose}
693 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
699 Program reference: @internalsref{TransposedMusic}.
704 If you want to use both @code{\transpose} and @code{\relative},
705 you must put @code{\transpose} outside of @code{\relative}, since
706 @code{\relative} will have no effect music that appears inside a
711 @subsection Bar check
714 @cindex @code{barCheckSynchronize}
717 Bar checks help detect errors in the durations. A bar check is
718 entered using the bar symbol, `@code{|}'. Whenever it is encountered
719 during interpretation, it should fall on a measure boundary. If it
720 does not, a warning is printed. In the next example, the second bar
721 check will signal an error
723 \time 3/4 c2 e4 | g2 |
726 Bar checks can also be used in lyrics, for example
731 Twin -- kle | Twin -- kle
735 Failed bar checks are caused by entering incorrect
736 durations. Incorrect durations often completely garble up the score,
737 especially if the score is polyphonic, so a good place to start correcting
738 input is by scanning for failed bar checks and incorrect durations.
741 @cindex @code{pipeSymbol}
743 It is also possible to redefine the meaning of @code{|}. This is done
744 by assigning a music expression to @code{pipeSymbol},
746 @lilypond[quote,raggedright,verbatim]
747 pipeSymbol = \bar "||"
753 @node Barnumber check
754 @subsection Barnumber check
756 When copying large pieces of music, it can be helpful to check that
757 the LilyPond bar number corresponds to the original that you are
758 entering from. This can be checked with @code{\barNumberCheck}, for
766 will print a warning if the @code{currentBarNumber} is not 123 when it
770 @node Skipping corrected music
771 @subsection Skipping corrected music
774 @cindex @code{skipTypesetting}
775 @cindex @code{showLastLength}
777 When entering or copying music, only the music near the end (where you
778 are adding notes) is interesting to view and correct. To speed up
779 this correction process, it is possible to skip typesetting of all but
780 the last few measures. This is achieved by putting
783 showLastLength = R1*5
788 in your source file. This will render only the last 5 measures
789 (assuming 4/4 time signature) of every @code{\score} in the input
790 file. For longer pieces, rendering only a small part is often an order
791 of magnitude quicker than rendering it completely
793 Skipping parts of a score can be controlled in a more fine-grained
794 fashing with the property @code{Score.skipTypesetting}. When it is
795 set, no typesetting is performed at all.
797 @lilypond[quote,fragment,raggedright,verbatim]
800 \set Score.skipTypesetting = ##t
802 \set Score.skipTypesetting = ##f
806 In polyphonic music, @code{Score.skipTypesetting} will affect all
807 voices and staves, saving even more time.
810 @node Automatic note splitting
811 @subsection Automatic note splitting
813 Long notes can be converted automatically to tied notes. This is done
814 by replacing the @internalsref{Note_heads_engraver} by the
815 @internalsref{Completion_heads_engraver}.
816 In the following examples, notes crossing the bar line are split and tied.
818 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
820 \remove "Note_heads_engraver"
821 \consists "Completion_heads_engraver"
823 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
827 This engraver splits all running notes at the bar line, and inserts
828 ties. One of its uses is to debug complex scores: if the measures are
829 not entirely filled, then the ties exactly show how much each measure
835 Not all durations (especially those containing tuplets) can be
836 represented exactly with normal notes and dots, but the engraver will
839 @code{Completion_heads_engraver} only affects notes; it does not split
845 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
849 Program reference: @internalsref{Completion_heads_engraver}.
854 @section Staff notation
856 @cindex Staff notation
858 This section describes music notation that occurs on staff level,
859 such as key signatures, clefs and time signatures.
868 * System start delimiters::
878 The clef indicates which lines of the staff correspond to which
879 pitches. The clef is set with the @code{\clef} command
881 @lilypond[quote,raggedright,fragment,verbatim]
882 { c''2 \clef alto g'2 }
892 @cindex mezzosoprano clef
893 @cindex baritone clef
894 @cindex varbaritone clef
897 Supported clefs finclude
899 @item treble, violin, G, G2
908 G clef on 1st line, so-called French violin clef
925 By adding @code{_8} or @code{^8} to the clef name, the clef is
926 transposed one octave down or up, respectively, and @code{_15} and
927 @code{^15} transposes by two octaves. The argument @var{clefname}
928 must be enclosed in quotes when it contains underscores or digits. For
931 @cindex choral tenor clef
932 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
939 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
940 @code{clefPosition} (which controls the Y position of the clef),
941 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
942 when any of these properties are changed. The following example shows
943 possibilities when setting properties manually.
945 @lilypond[quote,raggedright,verbatim]
947 \set Staff.clefGlyph = #"clefs.F"
948 \set Staff.clefPosition = #2
950 \set Staff.clefGlyph = #"clefs.G"
952 \set Staff.clefGlyph = #"clefs.C"
954 \set Staff.clefOctavation = #7
956 \set Staff.clefOctavation = #0
957 \set Staff.clefPosition = #0
961 \set Staff.middleCPosition = #4
969 Program reference: @internalsref{Clef}.
973 @subsection Key signature
975 @cindex Key signature
978 The key signature indicates the tonality in which a piece is played. It
979 is denoted by a set of alterations (flats or sharps) at the start of the
982 Setting or changing the key signature is done with the @code{\key}
986 @code{\key} @var{pitch} @var{type}
989 @cindex @code{\minor}
990 @cindex @code{\major}
991 @cindex @code{\minor}
992 @cindex @code{\ionian}
993 @cindex @code{\locrian}
994 @cindex @code{\aeolian}
995 @cindex @code{\mixolydian}
996 @cindex @code{\lydian}
997 @cindex @code{\phrygian}
998 @cindex @code{\dorian}
1001 Here, @var{type} should be @code{\major} or @code{\minor} to get
1002 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1003 use the standard mode names (also called ``church modes''): @code{\ionian},
1004 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1005 @code{\phrygian}, and @code{\dorian}.
1007 This command sets the context property
1008 @code{Staff.keySignature}. Non-standard key signatures
1009 can be specified by setting this property directly.
1011 Accidentals and key signatures often confuse new users, because
1012 unaltered notes get natural signs depending on the key signature. For
1013 more information, see @ref{More about pitches}.
1018 A natural sign is printed to cancel any previous accidentals. This
1019 can be suppressed by setting the @code{Staff.printKeyCancellation}
1022 @lilypond[quote,fragment,raggedright,fragment,verbatim,relative=2]
1027 \set Staff.printKeyCancellation = ##f
1037 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1040 @node Time signature
1041 @subsection Time signature
1043 @cindex Time signature
1045 @cindex @code{\time}
1047 Time signature indicates the metrum of a piece: a regular pattern of
1048 strong and weak beats. It is denoted by a fraction at the start of the
1051 The time signature is set with the @code{\time} command
1053 @lilypond[quote,raggedright,fragment,verbatim]
1054 \time 2/4 c'2 \time 3/4 c'2.
1059 The symbol that is printed can be customized with the @code{style}
1060 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1063 @lilypond[fragment,quote,raggedright,verbatim]
1066 \override Staff.TimeSignature #'style = #'()
1071 There are many more options for its layout. See @ref{Ancient time
1072 signatures} for more examples.
1074 @code{\time} sets the property @code{timeSignatureFraction},
1075 @code{beatLength} and @code{measureLength} in the @code{Timing}
1076 context, which is normally aliased to @internalsref{Score}. The
1077 property @code{measureLength} determines where bar lines should be
1078 inserted, and how automatic beams should be generated. Changing the
1079 value of @code{timeSignatureFraction} also causes the symbol to be
1082 More options are available through the Scheme function
1083 @code{set-time-signature}. In combination with the
1084 @internalsref{Measure_grouping_engraver}, it will create
1085 @internalsref{MeasureGrouping} signs. Such signs ease reading
1086 rhythmically complex modern music. In the following example, the 9/8
1087 measure is subdivided in 2, 2, 2 and 3. This is passed to
1088 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1090 @lilypond[quote,raggedright,verbatim]
1093 #(set-time-signature 9 8 '(2 2 2 3))
1094 g8[ g] d[ d] g[ g] a8[( bes g]) |
1095 #(set-time-signature 5 8 '(3 2))
1101 \consists "Measure_grouping_engraver"
1109 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
1114 Automatic beaming does not use the measure grouping specified with
1115 @code{set-time-signature}.
1118 @node Partial measures
1119 @subsection Partial measures
1123 @cindex partial measure
1124 @cindex measure, partial
1125 @cindex shorten measures
1126 @cindex @code{\partial}
1128 Partial measures, such as an anacrusis or upbeat, are entered using the
1130 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1131 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1134 The syntax for this command is
1137 \partial @var{duration}
1140 This is internally translated into
1143 \set Timing.measurePosition = -@var{length of duration}
1146 The property @code{measurePosition} contains a rational number
1147 indicating how much of the measure has passed at this point.
1152 This command does not take into account grace notes at the start of
1153 the music. When a piece starts with graces notes in the pickup, then
1154 the @code{\partial} should follow the grace notes
1156 @lilypond[verbatim,quote,raggedright,relative,fragment]
1165 @subsection Bar lines
1169 @cindex measure lines
1172 Bar lines delimit measures, but are also used to indicate
1173 repeats. Normally they are inserted automatically. Line
1174 breaks may only happen on bar lines.
1176 Special types of bar lines can be forced with the @code{\bar} command
1178 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1182 The following bar types are available
1184 @lilypondfile[raggedright,quote]{bar-lines.ly}
1186 To allow a line break where there is no visible bar line, use
1193 This will insert an invisible bar line and allow line breaks at this
1196 In scores with many staves, a @code{\bar} command in one staff is
1197 automatically applied to all staves. The resulting bar lines are
1198 connected between different staves of a StaffGroup
1200 @lilypond[quote,raggedright,fragment,verbatim]
1202 \context StaffGroup <<
1208 \new Staff { \clef bass c4 g e g }
1210 \new Staff { \clef bass c2 c2 }
1217 @cindex @code{whichBar}
1218 @cindex @code{repeatCommands}
1219 @cindex @code{defaultBarType}
1221 The command @code{\bar }@var{bartype} is a short cut for doing
1222 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1223 is set to a string, a bar line of that type is created.
1225 A bar line is created whenever the @code{whichBar} property is set.
1226 At the start of a measure it is set to the contents of
1227 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1228 to override default measure bars.
1230 You are encouraged to use @code{\repeat} for repetitions. See
1236 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1238 Program reference: @internalsref{BarLine} (created at
1239 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1241 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1244 @node Unmetered music
1245 @subsection Unmetered music
1248 @cindex @code{\cadenzaOn}
1249 @cindex @code{\cadenzaOff}
1251 Bar lines and bar numbers are calculated automatically. For unmetered
1252 music (cadenzas, for example), this is not desirable. To turn off
1253 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1254 and @code{\cadenzaOff}.
1256 @lilypond[verbatim,quote,raggedright,relative=2,fragment]
1268 LilyPond will only insert page breaks at a barline. Unless the unmetered
1269 music ends before the end of the staff line, you will need to insert
1277 to indicate where line breaks can occur.
1280 @node System start delimiters
1281 @subsection System start delimiters
1283 @cindex start of system
1284 @cindex Staff, multiple
1285 @cindex bracket, vertical
1286 @cindex brace, vertical
1289 @cindex staff, choir
1291 Many scores consist of more than one staff. These staves can be
1292 joined in four different ways
1295 @item The group is started with a brace at the left, and bar lines are
1296 connected. This is done with the @internalsref{GrandStaff} context.
1298 @lilypond[verbatim,raggedright,quote]
1306 @item The group is started with a bracket, and bar lines are connected.
1307 This is done with the
1308 @internalsref{StaffGroup} context
1310 @lilypond[verbatim,raggedright,quote]
1318 @item The group is started with a bracket, but bar lines are not
1319 connected. This is done with the @internalsref{ChoirStaff} context.
1321 @lilypond[verbatim,raggedright,quote]
1329 @item The group is started with a vertical line. Bar lines are not
1330 connected. This is the default for the score.
1332 @lilypond[verbatim,raggedright,quote]
1343 The bar lines at the start of each system are
1344 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1345 @internalsref{SystemStartBracket}. Only one of these types is created
1346 in every context, and that type is determined by the property
1347 @code{systemStartDelimiter}.
1351 @subsection Staff symbol
1353 @cindex adjusting staff symbol
1355 Notes, dynamic signs, etc., are grouped
1356 with a set of horizontal lines, called a staff (plural `staves'). In
1357 LilyPond, these lines are drawn using a separate layout object called
1360 The staff symbol may be tuned in the number, thickness and distance
1361 of lines, using properties. This is demonstrated in the example files
1362 @inputfileref{input/@/test,staff@/-lines@/.ly},
1363 @inputfileref{input/@/test,staff@/-size@/.ly}.
1365 In addition, staves may be started and stopped at will. This is done
1366 with @code{\startStaff} and @code{\stopStaff}.
1368 @lilypond[verbatim,relative=2,fragment]
1370 \override Staff.StaffSymbol #'line-count = 2
1371 \stopStaff \startStaff
1373 \revert Staff.StaffSymbol #'line-count
1374 \stopStaff \startStaff
1378 In combination with Frenched staves, this may be used to typeset ossia
1379 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1384 @lilypondfile{ossia.ly}
1386 @cindex staff lines, setting number of
1387 @cindex staff lines, setting thickness of
1388 @cindex thickness of staff lines, setting
1389 @cindex number of staff lines, setting
1393 Program reference: @internalsref{StaffSymbol}.
1395 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1396 @inputfileref{input/@/test@/,ossia.ly},
1397 @inputfileref{input/@/test,staff@/-size@/.ly}.
1401 @node Connecting notes
1402 @section Connecting notes
1404 This section deals with notation that affects groups of notes.
1422 A tie connects two adjacent note heads of the same pitch. The tie in
1423 effect extends the length of a note. Ties should not be confused with
1424 slurs, which indicate articulation, or phrasing slurs, which indicate
1425 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1427 @lilypond[quote,raggedright,fragment,verbatim]
1428 e' ~ e' <c' e' g'> ~ <c' e' g'>
1431 When a tie is applied to a chord, all note heads whose pitches match
1432 are connected. When no note heads match, no ties will be created.
1434 A tie is just a way of extending a note duration, similar to the
1435 augmentation dot. The following example shows two ways of notating
1436 exactly the same concept
1438 @lilypond[quote,fragment,raggedright]
1439 \time 3/4 c'2. c'2 ~ c'4
1443 Ties are used either when the note crosses a bar line, or when dots
1444 cannot be used to denote the rhythm. When using ties, larger note
1445 values should be aligned to subdivisions of the measure, eg.
1447 @lilypond[fragment,quote,raggedright]
1449 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1453 If you need to tie a lot of notes over bars, it may be easier to use
1454 automatic note splitting (see @ref{Automatic note splitting}). This
1455 mechanism automatically splits long notes, and ties them across bar
1461 Ties are sometimes used to write out arpeggios. In this case, two tied
1462 notes need not be consecutive. This can be achieved by setting the
1463 @code{tieWaitForNote} property to true. For example,
1465 @lilypond[fragment,verbatim,relative=1,raggedright]
1466 \set tieWaitForNote = ##t
1467 \grace { c16[~ e~ g]~ } <c, e g>4
1474 @cindex @code{\tieUp}
1476 @cindex @code{\tieDown}
1478 @cindex @code{\tieNeutral}
1480 @cindex @code{\tieDotted}
1482 @cindex @code{\tieDashed}
1484 @cindex @code{\tieSolid}
1490 In this manual: @ref{Automatic note splitting}.
1492 Program reference: @internalsref{Tie}.
1497 Switching staves when a tie is active will not produce a slanted tie.
1499 Formatting of ties is a difficult subject. The results are often not
1508 A slur indicates that notes are to be played bound or
1509 @emph{legato}. They are entered using parentheses
1511 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1512 f( g a) a8 b( a4 g2 f4)
1516 The direction of a slur can be specified with
1517 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1518 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1521 However, there is a convenient shorthand for forcing slur
1522 directions. By adding @code{_} or @code{^} before the opening
1523 parentheses, the direction is also set. For example,
1525 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
1529 Only one slur can be printed at once. If you need to print a long
1530 slur over a few small slurs, please see @ref{Phrasing slurs}.
1535 Some composers write two slurs when they want legato chords. This can
1536 be achieved in LilyPond by setting @code{doubleSlurs},
1538 @lilypond[verbatim,raggedright,relative,fragment,quote]
1539 \set doubleSlurs = ##t
1540 <c e>4 ( <d f> <c e> <d f> )
1546 @cindex @code{\slurUp}
1548 @cindex @code{\slurDown}
1550 @cindex @code{\slurNeutral}
1551 @code{\slurNeutral},
1552 @cindex @code{\slurDashed}
1554 @cindex @code{\slurDotted}
1556 @cindex @code{\slurSolid}
1561 Program reference: @seeinternals{Slur}.
1564 @node Phrasing slurs
1565 @subsection Phrasing slurs
1567 @cindex phrasing slurs
1568 @cindex phrasing marks
1570 A phrasing slur (or phrasing mark) connects notes and is used to
1571 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1574 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1575 \time 6/4 c'\( d( e) f( e) d\)
1578 Typographically, the phrasing slur behaves almost exactly like a
1579 normal slur. However, they are treated as different objects. A
1580 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1581 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1582 @code{\phrasingSlurNeutral}.
1584 You cannot have simultaneous phrasing slurs.
1589 @cindex @code{\phrasingSlurUp}
1590 @code{\phrasingSlurUp},
1591 @cindex @code{\phrasingSlurDown}
1592 @code{\phrasingSlurDown},
1593 @cindex @code{\phrasingSlurNeutral}
1594 @code{\phrasingSlurNeutral}.
1599 Program reference: @internalsref{PhrasingSlur}.
1602 @node Automatic beams
1603 @subsection Automatic beams
1605 LilyPond inserts beams automatically
1607 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1608 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1611 When these automatic decisions are not good enough, beaming can be
1612 entered explicitly. It is also possible to define beaming patterns
1613 that differ from the defaults. See @ref{Setting automatic beam behavior}
1616 Individual notes may be marked with @code{\noBeam} to prevent them
1619 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1620 \time 2/4 c8 c\noBeam c c
1626 Program reference: @internalsref{Beam}.
1630 @subsection Manual beams
1632 @cindex beams, manual
1636 In some cases it may be necessary to override the automatic beaming
1637 algorithm. For example, the autobeamer will not put beams over rests
1638 or bar lines. Such beams are specified manually by marking the begin
1639 and end point with @code{[} and @code{]}
1641 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1643 r4 r8[ g' a r8] r8 g[ | a] r8
1650 @cindex @code{stemLeftBeamCount}
1651 @cindex @code{stemRightBeamCount}
1653 Normally, beaming patterns within a beam are determined automatically.
1654 If necessary, the properties @code{stemLeftBeamCount} and
1655 @code{stemRightBeamCount} can be used to override the defaults. If
1656 either property is set, its value will be used only once, and then it
1659 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1664 \set stemLeftBeamCount = #1
1669 The property @code{subdivideBeams} can be set in order to subdivide
1670 all 16th or shorter beams at beat positions, as defined by the
1671 @code{beatLength} property.
1673 @lilypond[fragment,quote,relative=2,verbatim]
1675 \set subdivideBeams = ##t
1677 \set Score.beatLength = #(ly:make-moment 1 8)
1680 @cindex @code{subdivideBeams}
1682 Line breaks are normally forbidden when beams cross bar lines. This
1683 behavior can be changed by setting @code{allowBeamBreak}.
1685 @cindex @code{allowBeamBreak}
1686 @cindex beams and line breaks
1687 @cindex beams, kneed
1689 @cindex auto-knee-gap
1694 Kneed beams are inserted automatically when a large gap is detected
1695 between the note heads. This behavior can be tuned through the object.
1697 Automatically kneed cross-staff beams cannot be used together with
1698 hidden staves. See @ref{Hiding staves}.
1700 Beams do not avoid collisions with symbols around the notes, such as
1701 texts and accidentals.
1705 @subsection Grace notes
1707 @cindex @code{\grace}
1710 @cindex appoggiatura
1711 @cindex acciaccatura
1713 Grace notes are ornaments that are written out. The most common ones
1714 are acciaccatura, which should be played as very short. It is denoted
1715 by a slurred small note with a slashed stem. The appoggiatura is a
1716 grace note that takes a fixed fraction of the main note, and is
1717 denoted as a slurred note in small print without a slash. They
1718 are entered with the commands @code{\acciaccatura} and
1719 @code{\appoggiatura}, as demonstrated in the following example
1721 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1722 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1723 \acciaccatura { g16[ f] } e4
1726 Both are special forms of the @code{\grace} command. By prefixing this
1727 keyword to a music expression, a new one is formed, which will be
1728 printed in a smaller font and takes up no logical time in a measure.
1730 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1732 \grace { c16[ d16] } c2 c4
1736 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1737 @code{\grace} command does not start a slur.
1739 Internally, timing for grace notes is done using a second, `grace'
1740 timing. Every point in time consists of two rational numbers: one
1741 denotes the logical time, one denotes the grace timing. The above
1742 example is shown here with timing tuples
1744 @lilypond[quote,raggedright]
1747 c4 \grace c16 c4 \grace {
1750 \new Lyrics \lyricmode {
1751 \override LyricText #'font-family = #'typewriter
1755 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1756 \markup { (\fraction 1 4 , 0 ) } 4
1758 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1759 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1761 \markup { ( \fraction 2 4 , 0 ) }
1766 The placement of grace notes is synchronized between different staves.
1767 In the following example, there are two sixteenth grace notes for
1768 every eighth grace note
1770 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1771 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1772 \new Staff { c4 \grace { g8[ b] } c4 } >>
1775 If you want to end a note with a grace, use the @code{\afterGrace}
1776 command. It takes two arguments: the main note, and the grace notes
1777 following the main note.
1779 @lilypond[raggedright, verbatim,relative=2,fragment]
1780 c1 \afterGrace d1 { c16[ d] } c4
1783 This will put the grace notes after a ``space'' lasting 3/4 of the
1784 length of the main note. The fraction 3/4 can be changed by setting
1785 @code{afterGraceFraction}, ie.
1788 afterGraceFraction = #(cons 7 8)
1792 will put the grace note at 7/8 of the main note.
1794 The same effect can be achieved manually by doing
1796 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1799 { s2 \grace { c16[ d] } } >>
1805 By adjusting the duration of the skip note (here it is a half-note),
1806 the space between the main-note and the grace is adjusted.
1808 A @code{\grace} section will introduce special typesetting settings,
1809 for example, to produce smaller type, and set directions. Hence, when
1810 introducing layout tweaks, they should be inside the grace section,
1812 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1824 The overrides should also be reverted inside the grace section.
1826 The layout of grace sections can be changed throughout the music using
1827 the function @code{add-grace-property}. The following example
1828 undefines the Stem direction for this grace, so stems do not always
1833 #(add-grace-property 'Voice 'Stem 'direction '())
1839 Another option is to change the variables @code{startGraceMusic},
1840 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1841 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1842 @code{stopAppoggiaturaMusic}. More information is in the file
1843 @file{ly/@/grace@/-init@/.ly}.
1848 Program reference: @internalsref{GraceMusic}.
1853 A score that starts with a @code{\grace} section needs an explicit
1854 @code{\context Voice} declaration, otherwise the main note and the grace
1855 note end up on different staves.
1857 Grace note synchronization can also lead to surprises. Staff notation,
1858 such as key signatures, bar lines, etc., are also synchronized. Take
1859 care when you mix staves with grace notes and staves without, for example,
1861 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1862 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1863 \new Staff { c4 \bar "|:" d4 } >>
1867 This can be remedied by inserting grace skips, for the above example
1870 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1873 Grace sections should only be used within sequential music
1874 expressions. Nesting or juxtaposing grace sections is not supported,
1875 and might produce crashes or other errors.
1879 @node Expressive marks
1880 @section Expressive marks
1882 Expressive marks help musicians to bring more to the music than simple
1887 * Fingering instructions::
1897 @subsection Articulations
1899 @cindex Articulations
1903 A variety of symbols can appear above and below notes to indicate
1904 different characteristics of the performance. They are added to a note
1905 by adding a dash and the character signifying the
1906 articulation. They are demonstrated here
1908 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
1910 The meanings of these shorthands can be changed. See
1911 @file{ly/@/script@/-init@/.ly} for examples.
1913 The script is automatically placed, but the direction can be forced as
1914 well. Like other pieces of LilyPond code, @code{_} will place them
1915 below the staff, and @code{^} will place them above.
1917 @lilypond[quote,raggedright,fragment,verbatim]
1921 Other symbols can be added using the syntax
1922 @var{note}@code{\}@var{name}. Again, they
1923 can be forced up or down using @code{^} and @code{_},
1926 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
1927 c\fermata c^\fermata c_\fermata
1932 @cindex staccatissimo
1942 @cindex organ pedal marks
1951 @cindex prallmordent
1955 @cindex thumb marking
1960 Here is a chart showing all scripts available,
1962 @lilypondfile[raggedright,quote]{script-chart.ly}
1967 The vertical ordering of scripts is controlled with the
1968 @code{script-priority} property. The lower this number, the closer it
1969 will be put to the note. In this example, the
1970 @internalsref{TextScript} (the sharp symbol) first has the lowest
1971 priority, so it is put lowest in the first example. In the second, the
1972 prall trill (the @internalsref{Script}) has the lowest, so it is on the
1973 inside. When two objects have the same priority, the order in which
1974 they are entered decides which one comes first.
1976 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
1977 \once \override TextScript #'script-priority = #-100
1978 a4^\prall^\markup { \sharp }
1980 \once \override Script #'script-priority = #-100
1981 a4^\prall^\markup { \sharp }
1987 Program reference: @internalsref{Script}.
1992 These signs appear in the printed output but have no effect on the
1993 MIDI rendering of the music.
1996 @node Fingering instructions
1997 @subsection Fingering instructions
2000 @cindex finger change
2002 Fingering instructions can be entered using
2004 @var{note}-@var{digit}
2006 For finger changes, use markup texts
2008 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2010 c^\markup { \finger "2 - 3" }
2013 You can use the thumb-script to indicate that a note should be
2014 played with the thumb (e.g., in cello music)
2015 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2016 <a_\thumb a'-3>8 <b_\thumb b'-3>
2019 Fingerings for chords can also be added to individual notes
2020 of the chord by adding them after the pitches
2021 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2022 < c-1 e-2 g-3 b-5 >4
2028 You may exercise greater control over fingering chords by
2029 setting @code{fingeringOrientations}
2031 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
2032 \set fingeringOrientations = #'(left down)
2033 <c-1 es-2 g-4 bes-5 > 4
2034 \set fingeringOrientations = #'(up right down)
2035 <c-1 es-2 g-4 bes-5 > 4
2038 Using this feature, it is also possible to put fingering instructions
2039 very close to note heads in monophonic music,
2041 @lilypond[verbatim,raggedright,quote,fragment]
2042 \set fingeringOrientations = #'(right)
2049 Program reference: @internalsref{Fingering}.
2051 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2055 @subsection Dynamics
2066 @cindex @code{\ffff}
2075 Absolute dynamic marks are specified using a command after a note
2076 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2077 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2078 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2079 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2081 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2082 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2083 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2090 A crescendo mark is started with @code{\<} and terminated with
2091 @code{\!} or an absolute dynamic. A decrescendo is started with
2092 @code{\>} and is also terminated with @code{\!} or an absolute
2093 dynamic. Because these marks are bound to notes, you must
2094 use spacer notes if multiple marks are needed during one note
2096 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2098 << f1 { s4 s4\< s4\! \> s4\! } >>
2100 This may give rise to very short hairpins. Use @code{minimum-length}
2101 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2105 \override Staff.Hairpin #'minimum-length = #5
2112 You can also use a text saying @emph{cresc.} instead of hairpins
2114 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2125 You can also supply your own texts
2126 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2127 \set crescendoText = \markup { \italic "cresc. poco" }
2128 \set crescendoSpanner = #'dashed-line
2132 To create new dynamic marks or text that should be aligned
2133 with dynamics, see @ref{New dynamic marks}.
2138 @cindex @code{\dynamicUp}
2140 @cindex @code{\dynamicDown}
2141 @code{\dynamicDown},
2142 @cindex @code{\dynamicNeutral}
2143 @code{\dynamicNeutral}.
2148 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2149 Vertical positioning of these symbols is handled by
2150 @internalsref{DynamicLineSpanner}.
2154 @subsection Breath marks
2156 Breath marks are entered using @code{\breathe}
2158 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2165 The glyph of the breath mark can be tuned by overriding the
2166 @code{text} property of the @code{BreathingSign} layout object with
2167 any markup text. For example,
2168 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2170 \override BreathingSign #'text
2171 = #(make-musicglyph-markup "scripts.rvarcomma")
2178 Program reference: @internalsref{BreathingSign}.
2180 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2183 @node Running trills
2184 @subsection Running trills
2186 Long running trills are made with @code{\startTrillSpan} and
2187 @code{\stopTrillSpan},
2189 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2191 << { c1 \startTrillSpan }
2192 { s2. \grace { d16[\stopTrillSpan e] } } >>
2199 @code{\startTrillSpan},
2200 @cindex @code{\startTrillSpan}
2201 @code{\stopTrillSpan}.
2202 @cindex @code{\stopTrillSpan}
2207 Program reference: @internalsref{TrillSpanner}.
2211 @subsection Glissando
2214 @cindex @code{\glissando}
2216 A glissando is a smooth change in pitch. It is denoted by a line or a
2217 wavy line between two notes. It is requested by attaching
2218 @code{\glissando} to a note
2220 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2222 \override Glissando #'style = #'zigzag
2229 Program reference: @internalsref{Glissando}.
2231 Example files: @file{input/@/regression/@/glissando@/.ly}.
2236 Printing text over the line (such as @emph{gliss.}) is not supported.
2240 @subsection Arpeggio
2243 @cindex broken chord
2244 @cindex @code{\arpeggio}
2246 You can specify an arpeggio sign (also known as broken chord) on a
2247 chord by attaching an @code{\arpeggio} to a chord
2249 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2253 A square bracket on the left indicates that the player should not
2254 arpeggiate the chord
2256 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2261 The direction of the arpeggio is sometimes denoted by adding an
2262 arrowhead to the wiggly line
2264 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2276 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2277 in both staves and set
2278 @internalsref{PianoStaff}.@code{connectArpeggios}
2280 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2281 \context PianoStaff <<
2282 \set PianoStaff.connectArpeggios = ##t
2283 \new Staff { <c' e g c>\arpeggio }
2284 \new Staff { \clef bass <c,, e g>\arpeggio }
2292 @cindex @code{\arpeggioUp}
2294 @cindex @code{\arpeggioDown}
2295 @code{\arpeggioDown},
2296 @cindex @code{\arpeggioNeutral}
2297 @code{\arpeggioNeutral},
2298 @cindex @code{\arpeggioBracket}
2299 @code{\arpeggioBracket}.
2304 Notation manual: @ref{Ties}, for writing out arpeggios.
2306 Program reference: @internalsref{Arpeggio}.
2311 It is not possible to mix connected arpeggios and unconnected
2312 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2319 Polyphony in music refers to having more than one voice occuring in
2320 a piece of music. Polyphony in LilyPond refers to having more than
2321 one voice on the same staff.
2325 * Explicitly instantiating voices::
2326 * Collision Resolution::
2330 @node Basic polyphony
2331 @subsection Basic polyphony
2335 The easiest way to enter fragments with more than one voice on a staff
2336 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2337 them simultaneously, separating the voices with @code{\\}
2341 @lilypond[quote,verbatim,fragment]
2342 \new Staff \relative c' {
2345 { g4 f e | d2 e2 } \\
2346 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2352 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2353 voices are sometimes called ``layers'' in other notation packages}
2355 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2356 each of these contexts, vertical direction of slurs, stems, etc., is set
2359 These voices are all seperate from the voice that contains the notes just
2360 outside the @code{<< \\ >>} construct. This should be noted when making
2361 changes at the voice level. This also means that slurs and ties cannot go
2362 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2363 from separate @code{<< \\ >>} constructs on the same staff are the the
2364 same voice. Here is the same example, with different noteheads for each
2365 voice. Note that the change to the note-head style in the main voice does not affect
2366 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2367 voice in the first @code{<< \\ >>} construct is effective in the second
2368 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2370 @lilypond[quote,verbatim,fragment]
2371 \new Staff \relative c' {
2372 \override NoteHead #'style = #'cross
2376 { \override NoteHead #'style = #'triangle
2381 { c8 b16 a b8 g ~ g2 } \\
2382 { \override NoteHead #'style = #'slash s4 b4 c2 }
2387 Polyphony does not change the relationship of notes within a
2388 @code{\relative @{ @}} block. Each note is calculated relative
2389 to the note immediately preceding it.
2392 \relative @{ noteA << noteB \\ noteC >> noteD @}
2395 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2396 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2399 @node Explicitly instantiating voices
2400 @subsection Explicitly instantiating voices
2402 @internalsref{Voice} contexts can also also be instantiated manually
2403 inside a @code{<< >>} block to create polyphonic music, using
2404 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2405 and a horizontal shift for each part.
2409 << \upper \\ \lower >>
2417 \context Voice = "1" @{ \voiceOne \upper @}
2418 \context Voice = "2" @{ \voiceTwo \lower @}
2422 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2423 articulations, text annotations, augmentation dots of dotted
2424 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2425 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2426 make them point downwards.
2427 The command @code{\oneVoice} will revert back to the normal setting.
2429 An expression that appears directly inside a @code{<< >>} belongs to
2430 the main voice. This is useful when extra voices appear while the main
2431 voice is playing. Here is a more correct rendition of the example from
2432 the previous section. The crossed noteheads demonstrate that the main
2433 melody is now in a single voice context.
2435 @lilypond[quote,raggedright,verbatim]
2436 \new Staff \relative c' {
2437 \override NoteHead #'style = #'cross
2442 \context Voice="1" { \voiceTwo
2443 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2446 \new Voice { \voiceThree
2455 The correct definition of the voices allows the melody to be slurred.
2456 @lilypond[quote,raggedright,verbatim]
2457 \new Staff \relative c' {
2462 \context Voice="1" { \voiceTwo
2463 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2466 \new Voice { \voiceThree
2475 Avoiding the @code{\\} seperator also allows nesting polyphony
2476 constructs, which in some case might be a more natural way to typeset
2479 @lilypond[quote,raggedright,verbatim]
2480 \new Staff \relative c' {
2485 \context Voice="1" { \voiceTwo
2488 {c8 b16 a b8 g ~ g2}
2489 \new Voice { \voiceThree
2502 @node Collision Resolution
2503 @subsection Collision Resolution
2505 Normally, note heads with a different number of dots are not merged, but
2506 when the object property @code{merge-differently-dotted} is set in
2507 the @internalsref{NoteCollision} object, they are merged
2508 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
2511 \override Staff.NoteCollision
2512 #'merge-differently-dotted = ##t
2514 } \\ { g8.[ f16] g8.[ f16] } >>
2517 Similarly, you can merge half note heads with eighth notes, by setting
2518 @code{merge-differently-headed}
2519 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2522 \override Staff.NoteCollision
2523 #'merge-differently-headed = ##t
2524 c8 c4. } \\ { c2 c2 } >>
2527 LilyPond also vertically shifts rests that are opposite of a stem,
2530 @lilypond[quote,raggedright,fragment,verbatim]
2531 \context Voice << c''4 \\ r4 >>
2537 @cindex @code{\oneVoice}
2539 @cindex @code{\voiceOne}
2541 @cindex @code{\voiceTwo}
2543 @cindex @code{\voiceThree}
2545 @cindex @code{\voiceFour}
2548 @cindex @code{\shiftOn}
2550 @cindex @code{\shiftOnn}
2552 @cindex @code{\shiftOnnn}
2554 @cindex @code{\shiftOff}
2555 @code{\shiftOff}: these commands specify in what chords of the current
2556 voice should be shifted. The outer voices (normally: voice one and
2557 two) have @code{\shiftOff}, while the inner voices (three and four)
2558 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2559 further shift levels.
2561 When LilyPond cannot cope, the @code{force-hshift}
2562 property of the @internalsref{NoteColumn} object and pitched rests can
2563 be used to override typesetting decisions.
2565 @lilypond[quote,verbatim,raggedright]
2572 \once \override NoteColumn #'force-hshift = #1.7
2580 Program reference: the objects responsible for resolving collisions are
2581 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2584 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2585 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2586 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2587 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2588 @inputfileref{input/@/regression,collisions@/.ly}.
2593 When using @code{merge-differently-headed} with an upstem eighth or a
2594 shorter note, and a downstem half note, the eighth note gets the wrong
2597 There is no support for clusters where the same note occurs with
2598 different accidentals in the same chord. In this case, it is
2599 recommended to use enharmonic transcription, or to use special cluster
2600 notation (see @ref{Clusters}).
2607 Repetition is a central concept in music, and multiple notations exist
2613 * Repeats and MIDI::
2614 * Manual repeat commands::
2616 * Tremolo subdivisions::
2622 @subsection Repeat types
2625 @cindex @code{\repeat}
2627 The following types of repetition are supported
2631 Repeated music is fully written (played) out. This is useful when
2632 entering repetitious music. This is the only kind of repeat that
2633 is included in MIDI output.
2636 Repeats are not written out, but alternative endings (volte) are
2637 printed, left to right with brackets. This is the standard notation
2638 for repeats with alternatives. These are not played in MIDI output by default.
2642 Alternative endings are written stacked. This has limited use but may be
2643 used to typeset two lines of lyrics in songs with repeats, see
2644 @inputfileref{input,star-spangled-banner@/.ly}.
2648 Make tremolo beams. These are not played in MIDI output by default.
2651 Make beat or measure repeats. These look like percent signs. These
2652 are not played in MIDI output by default. Percent repeats must be
2653 declared within a Voice context.
2659 @subsection Repeat syntax
2661 LilyPond has one syntactic construct for specifying different types of
2662 repeats. The syntax is
2665 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2668 If you have alternative endings, you may add
2669 @cindex @code{\alternative}
2680 where each @var{alternative} is a music expression. If you do not
2681 give enough alternatives for all of the repeats, the first alternative
2682 is assumed to be played more than once.
2684 Standard repeats are used like this
2685 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2687 \repeat volta 2 { c4 d e f }
2688 \repeat volta 2 { f e d c }
2691 With alternative endings
2692 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2694 \repeat volta 2 {c4 d e f}
2695 \alternative { {d2 d} {f f,} }
2698 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2701 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2702 \alternative { { g4 g g } { a | a a a a | b2. } }
2706 It is possible to shorten volta brackets
2707 by setting @code{voltaSpannerDuration}. In the next example, the
2708 bracket only lasts one measure, which is a duration of 3/4.
2710 @lilypond[verbatim,raggedright,quote]
2714 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2715 \repeat "volta" 5 { d d d }
2716 \alternative { { e e e f f f }
2726 Brackets for the repeat are normally only printed over the topmost
2727 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2728 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2733 @cindex repeat, ambiguous
2735 A nested repeat like
2744 is ambiguous, since it is is not clear to which @code{\repeat} the
2745 @code{\alternative} belongs. This ambiguity is resolved by always
2746 having the @code{\alternative} belong to the inner @code{\repeat}.
2747 For clarity, it is advisable to use braces in such situations.
2749 Timing information is not remembered at the start of an alternative,
2750 so after a repeat timing information must be reset by hand, for
2751 example by setting @code{Score.measurePosition} or entering
2752 @code{\partial}. Similarly, slurs or ties are also not repeated.
2755 @node Repeats and MIDI
2756 @subsection Repeats and MIDI
2758 @cindex expanding repeats
2759 @cindex @code{\unfoldRepeats}
2761 With a little bit of tweaking, all types of repeats can be present
2762 in the MIDI output. This is achieved by applying the
2763 @code{\unfoldRepeats} music function. This functions changes all
2764 repeats to unfold repeats.
2766 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2768 \repeat tremolo 8 {c'32 e' }
2769 \repeat percent 2 { c''8 d'' }
2770 \repeat volta 2 {c'4 d' e' f'}
2779 When creating a score file using @code{\unfoldRepeats} for midi, then
2780 it is necessary to make two @code{\score} blocks. One for MIDI (with
2781 unfolded repeats) and one for notation (with volta, tremolo, and
2782 percent repeats). For example,
2790 \unfoldRepeats @var{..music..}
2796 @node Manual repeat commands
2797 @subsection Manual repeat commands
2799 @cindex @code{repeatCommands}
2801 The property @code{repeatCommands} can be used to control the layout of
2802 repeats. Its value is a Scheme list of repeat commands.
2805 @item @code{start-repeat}
2806 Print a @code{|:} bar line.
2808 @item @code{end-repeat}
2809 Print a @code{:|} bar line.
2811 @item @code{(volta @var{text})}
2812 Print a volta bracket saying @var{text}: The text can be specified as
2813 a text string or as a markup text, see @ref{Text markup}. Do not
2814 forget to change the font, as the default number font does not contain
2815 alphabetic characters;
2817 @item @code{(volta #f)}
2818 Stop a running volta bracket.
2821 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2823 \set Score.repeatCommands = #'((volta "93") end-repeat)
2825 \set Score.repeatCommands = #'((volta #f))
2832 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2833 @internalsref{VoltaRepeatedMusic},
2834 @internalsref{UnfoldedRepeatedMusic}, and
2835 @internalsref{FoldedRepeatedMusic}.
2838 @node Tremolo repeats
2839 @subsection Tremolo repeats
2841 @cindex tremolo beams
2843 To place tremolo marks between notes, use @code{\repeat} with tremolo
2845 @lilypond[quote,verbatim,raggedright]
2846 \new Voice \relative c' {
2847 \repeat "tremolo" 8 { c16 d16 }
2848 \repeat "tremolo" 4 { c16 d16 }
2849 \repeat "tremolo" 2 { c16 d16 }
2853 Tremolo marks can also be put on a single note. In this case, the
2854 note should not be surrounded by braces.
2855 @lilypond[quote,verbatim,raggedright]
2856 \repeat "tremolo" 4 c'16
2859 Similar output is obtained using the tremolo subdivision, described in
2860 @ref{Tremolo subdivisions}.
2865 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2867 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
2869 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2870 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2873 @node Tremolo subdivisions
2874 @subsection Tremolo subdivisions
2876 @cindex tremolo marks
2877 @cindex @code{tremoloFlags}
2879 Tremolo marks can be printed on a single note by adding
2880 `@code{:}[@var{number}]' after the note. The number indicates the
2881 duration of the subdivision, and it must be at least 8. A
2882 @var{length} value of 8 gives one line across the note stem. If the
2883 length is omitted, the last value (stored in @code{tremoloFlags}) is
2886 @lilypond[quote,raggedright,verbatim,fragment]
2887 c'2:8 c':32 | c': c': |
2893 Tremolos entered in this way do not carry over into the MIDI output.
2898 In this manual: @ref{Tremolo repeats}.
2900 Elsewhere: @internalsref{StemTremolo}.
2903 @node Measure repeats
2904 @subsection Measure repeats
2906 @cindex percent repeats
2907 @cindex measure repeats
2909 In the @code{percent} style, a note pattern can be repeated. It is
2910 printed once, and then the pattern is replaced with a special sign.
2911 Patterns of one and two measures are replaced by percent-like signs,
2912 patterns that divide the measure length are replaced by slashes.
2913 Percent repeats must be declared within a @code{Voice} context.
2915 @lilypond[quote,verbatim,raggedright]
2916 \new Voice \relative c' {
2917 \repeat "percent" 4 { c4 }
2918 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2925 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2926 @internalsref{PercentRepeatedMusic}, and
2927 @internalsref{DoublePercentRepeat}.