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.
493 * Skipping corrected music::
494 * Automatic note splitting::
498 @node Relative octaves
499 @subsection Relative octaves
502 @cindex Relative octave specification
503 @cindex @code{\relative}
505 Octaves are specified by adding @code{'} and @code{,} to pitch names.
506 When you copy existing music, it is easy to accidentally put a pitch
507 in the wrong octave and hard to find such an error. The relative
508 octave mode prevents these errors by making the mistakes much
509 larger: a single error puts the rest of the piece off by one octave
512 \relative @var{startpitch} @var{musicexpr}
519 \relative @var{musicexpr}
522 The octave of notes that appear in @var{musicexpr} are calculated as
523 follows: if no octave changing marks are used, the basic interval
524 between this and the last note is always taken to be a fourth or
525 less. This distance is determined without regarding alterations; a
526 @code{fisis} following a @code{ceses} will be put above the
527 @code{ceses}. In other words, a doubly-augmented fourth is considered
528 a smaller interval than a diminshed fifth, even though the fourth is
529 seven semitones while the fifth is only six semitones.
531 The octave changing marks @code{'} and @code{,} can be added to raise
532 or lower the pitch by an extra octave. Upon entering relative mode,
533 an absolute starting pitch can be specified that will act as the
534 predecessor of the first note of @var{musicexpr}. If no starting pitch
535 is specified, then middle C is used as a start.
537 Here is the relative mode shown in action
538 @lilypond[quote,fragment,raggedright,verbatim]
544 Octave changing marks are used for intervals greater than a fourth
545 @lilypond[quote,raggedright,fragment,verbatim]
551 If the preceding item is a chord, the first note of the chord is used
552 to determine the first note of the next chord
554 @lilypond[quote,raggedright,fragment,verbatim]
562 The pitch after the @code{\relative} contains a note name.
564 The relative conversion will not affect @code{\transpose},
565 @code{\chordmode} or @code{\relative} sections in its argument. To use
566 relative within transposed music, an additional @code{\relative} must
567 be placed inside @code{\transpose}.
571 @subsection Octave check
575 Octave checks make octave errors easier to correct: a note may be
576 followed by @code{=}@var{quotes} which indicates what its absolute
577 octave should be. In the following example,
580 \relative c'' @{ c='' b=' d,='' @}
584 the @code{d} will generate a warning, because a @code{d''} is expected
585 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
586 found. In the output, the octave is corrected to be a @code{d''} and
587 the next note is calculated relative to @code{d''} instead of @code{d'}.
589 There is also a syntax that is separate from the notes. The syntax
595 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
596 quotes) in \relative mode. If not, a warning is printed, and the
599 In the example below, the first check passes without incident, since
600 the @code{e} (in relative mode) is within a fifth of @code{a'}. However,
601 the second check produces a warning, since the @code{e} is not within
602 a fifth of @code{b'}. The warning message is printed, and the octave
603 is adjusted so that the following notes are in the correct octave
615 The octave of a note following an octave check is determined with
616 respect to the note preceding it. In the next fragment, the last note
617 is an @code{a'}, above middle C. That means that the @code{\octave}
618 check passes successfully, so the check could be deleted without changing
619 the output of the piece.
621 @lilypond[quote,raggedright,verbatim,fragment]
631 @subsection Transpose
634 @cindex transposition of pitches
635 @cindex @code{\transpose}
637 A music expression can be transposed with @code{\transpose}. The
640 \transpose @var{from} @var{to} @var{musicexpr}
643 This means that @var{musicexpr} is transposed by the interval between
644 the pitches @var{from} and @var{to}: any note with pitch @code{from}
645 is changed to @code{to}.
647 For example, consider a piece written in the key of D-major. If
648 this piece is a little too low for its performer, it can be
649 transposed up to E-major with
651 \transpose d e @dots{}
654 Consider a part written for violin (a C instrument). If
655 this part is to be played on the A clarinet, the following
656 transposition will produce the appropriate part
659 \transpose a c @dots{}
662 @code{\transpose} distinguishes between enharmonic pitches: both
663 @code{\transpose c cis} or @code{\transpose c des} will transpose up
664 half a tone. The first version will print sharps and the second
665 version will print flats
667 @lilypond[quote,raggedright,verbatim]
668 mus = { \key d \major cis d fis g }
677 @code{\transpose} may also be used to input written notes for a
678 transposing instrument. Pitches are normally entered into LilyPond
679 in C (or ``concert pitch''), but they may be entered in another
680 key. For example, when entering music for a B-flat trumpet which
681 begins on concert D, one would write
684 \transpose c bes @{ e4 @dots{} @}
687 To print this music in B-flat again (ie producing a trumpet part,
688 instead of a concert pitch conductor's score) you would wrap the
689 existing music with another @code{transpose}
692 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
698 Program reference: @internalsref{TransposedMusic}, and
699 @internalsref{UntransposableMusic}.
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 Skipping corrected music
754 @subsection Skipping corrected music
756 @cindex @code{skipTypesetting}
758 The property @code{Score.skipTypesetting} can be used to switch on and
759 off typesetting completely during the interpretation phase. When
760 typesetting is switched off, the music is processed much more
761 quickly. This can be used to skip over the parts of a score that
762 have already been checked for errors
764 @lilypond[quote,fragment,raggedright,verbatim]
767 \set Score.skipTypesetting = ##t
769 \set Score.skipTypesetting = ##f
773 In polyphonic music, @code{Score.skipTypesetting} will affect all
774 voices and staves, saving even more time.
777 @node Automatic note splitting
778 @subsection Automatic note splitting
780 Long notes can be converted automatically to tied notes. This is done
781 by replacing the @internalsref{Note_heads_engraver} by the
782 @internalsref{Completion_heads_engraver}.
783 In the following examples, notes crossing the bar line are split and tied.
785 @lilypond[quote,fragment,verbatim,relative=1,linewidth=12\cm]
787 \remove "Note_heads_engraver"
788 \consists "Completion_heads_engraver"
790 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
794 This engraver splits all running notes at the bar line, and inserts
795 ties. One of its uses is to debug complex scores: if the measures are
796 not entirely filled, then the ties exactly show how much each measure
802 Not all durations (especially those containing tuplets) can be
803 represented exactly with normal notes and dots, but the engraver will
806 @code{Completion_heads_engraver} only affects notes; it does not split
812 Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
816 Program reference: @internalsref{Completion_heads_engraver}.
821 @section Staff notation
823 @cindex Staff notation
825 This section describes music notation that occurs on staff level,
826 such as key signatures, clefs and time signatures.
835 * System start delimiters::
845 The clef indicates which lines of the staff correspond to which
846 pitches. The clef is set with the @code{\clef} command
848 @lilypond[quote,raggedright,fragment,verbatim]
849 { c''2 \clef alto g'2 }
859 @cindex mezzosoprano clef
860 @cindex baritone clef
861 @cindex varbaritone clef
864 Supported clefs finclude
866 @item treble, violin, G, G2
875 G clef on 1st line, so-called French violin clef
892 By adding @code{_8} or @code{^8} to the clef name, the clef is
893 transposed one octave down or up, respectively, and @code{_15} and
894 @code{^15} transposes by two octaves. The argument @var{clefname}
895 must be enclosed in quotes when it contains underscores or digits. For
898 @cindex choral tenor clef
899 @lilypond[quote,raggedright,verbatim,fragment,relative=1]
906 The command @code{\clef "treble_8"} is equivalent to setting @code{clefGlyph},
907 @code{clefPosition} (which controls the Y position of the clef),
908 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
909 when any of these properties are changed. The following example shows
910 possibilities when setting properties manually.
912 @lilypond[quote,raggedright,verbatim]
914 \set Staff.clefGlyph = #"clefs.F"
915 \set Staff.clefPosition = #2
917 \set Staff.clefGlyph = #"clefs.G"
919 \set Staff.clefGlyph = #"clefs.C"
921 \set Staff.clefOctavation = #7
923 \set Staff.clefOctavation = #0
924 \set Staff.clefPosition = #0
928 \set Staff.middleCPosition = #4
936 Program reference: @internalsref{Clef}.
940 @subsection Key signature
942 @cindex Key signature
945 The key signature indicates the tonality in which a piece is played. It
946 is denoted by a set of alterations (flats or sharps) at the start of the
949 Setting or changing the key signature is done with the @code{\key}
953 @code{\key} @var{pitch} @var{type}
956 @cindex @code{\minor}
957 @cindex @code{\major}
958 @cindex @code{\minor}
959 @cindex @code{\ionian}
960 @cindex @code{\locrian}
961 @cindex @code{\aeolian}
962 @cindex @code{\mixolydian}
963 @cindex @code{\lydian}
964 @cindex @code{\phrygian}
965 @cindex @code{\dorian}
968 Here, @var{type} should be @code{\major} or @code{\minor} to get
969 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
970 use the standard mode names (also called ``church modes''): @code{\ionian},
971 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
972 @code{\phrygian}, and @code{\dorian}.
974 This command sets the context property
975 @code{Staff.keySignature}. Non-standard key signatures
976 can be specified by setting this property directly.
978 Accidentals and key signatures often confuse new users, because
979 unaltered notes get natural signs depending on the key signature. For
980 more information, see @ref{More about pitches}.
985 A natural sign is printed to cancel any previous accidentals. This
986 can be suppressed by setting the @code{Staff.printKeyCancellation}
989 @lilypond[quote,fragment,raggedright,fragment,verbatim,relative=2]
994 \set Staff.printKeyCancellation = ##f
1004 Program reference: @internalsref{KeyCancellation}, @internalsref{KeySignature}.
1007 @node Time signature
1008 @subsection Time signature
1010 @cindex Time signature
1012 @cindex @code{\time}
1014 Time signature indicates the metrum of a piece: a regular pattern of
1015 strong and weak beats. It is denoted by a fraction at the start of the
1018 The time signature is set with the @code{\time} command
1020 @lilypond[quote,raggedright,fragment,verbatim]
1021 \time 2/4 c'2 \time 3/4 c'2.
1026 The symbol that is printed can be customized with the @code{style}
1027 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1030 @lilypond[fragment,quote,raggedright,verbatim]
1033 \override Staff.TimeSignature #'style = #'()
1038 There are many more options for its layout. See @ref{Ancient time
1039 signatures} for more examples.
1041 @code{\time} sets the property @code{timeSignatureFraction},
1042 @code{beatLength} and @code{measureLength} in the @code{Timing}
1043 context, which is normally aliased to @internalsref{Score}. The
1044 property @code{measureLength} determines where bar lines should be
1045 inserted, and how automatic beams should be generated. Changing the
1046 value of @code{timeSignatureFraction} also causes the symbol to be
1049 More options are available through the Scheme function
1050 @code{set-time-signature}. In combination with the
1051 @internalsref{Measure_grouping_engraver}, it will create
1052 @internalsref{MeasureGrouping} signs. Such signs ease reading
1053 rhythmically complex modern music. In the following example, the 9/8
1054 measure is subdivided in 2, 2, 2 and 3. This is passed to
1055 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1057 @lilypond[quote,raggedright,verbatim]
1060 #(set-time-signature 9 8 '(2 2 2 3))
1061 g8[ g] d[ d] g[ g] a8[( bes g]) |
1062 #(set-time-signature 5 8 '(3 2))
1068 \consists "Measure_grouping_engraver"
1076 Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
1081 Automatic beaming does not use the measure grouping specified with
1082 @code{set-time-signature}.
1085 @node Partial measures
1086 @subsection Partial measures
1090 @cindex partial measure
1091 @cindex measure, partial
1092 @cindex shorten measures
1093 @cindex @code{\partial}
1095 Partial measures, such as an anacrusis or upbeat, are entered using the
1097 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1098 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1101 The syntax for this command is
1104 \partial @var{duration}
1107 This is internally translated into
1110 \set Timing.measurePosition = -@var{length of duration}
1113 The property @code{measurePosition} contains a rational number
1114 indicating how much of the measure has passed at this point.
1119 This command does not take into account grace notes at the start of
1120 the music. When a piece starts with graces notes in the pickup, then
1121 the @code{\partial} should follow the grace notes
1123 @lilypond[verbatim,quote,raggedright,relative,fragment]
1132 @subsection Bar lines
1136 @cindex measure lines
1139 Bar lines delimit measures, but are also used to indicate
1140 repeats. Normally they are inserted automatically. Line
1141 breaks may only happen on bar lines.
1143 Special types of bar lines can be forced with the @code{\bar} command
1145 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1149 The following bar types are available
1151 @lilypondfile[raggedright,quote]{bar-lines.ly}
1153 To allow a line break where there is no visible bar line, use
1160 This will insert an invisible bar line and allow line breaks at this
1163 In scores with many staves, a @code{\bar} command in one staff is
1164 automatically applied to all staves. The resulting bar lines are
1165 connected between different staves of a StaffGroup
1167 @lilypond[quote,raggedright,fragment,verbatim]
1169 \context StaffGroup <<
1175 \new Staff { \clef bass c4 g e g }
1177 \new Staff { \clef bass c2 c2 }
1181 @cindex @code{whichBar}
1182 @cindex @code{repeatCommands}
1183 @cindex @code{defaultBarType}
1185 The command @code{\bar }@var{bartype} is a short cut for doing
1186 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1187 is set to a string, a bar line of that type is created.
1189 A bar line is created whenever the @code{whichBar} property is set.
1190 At the start of a measure it is set to the contents of
1191 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are used
1192 to override default measure bars.
1194 You are encouraged to use @code{\repeat} for repetitions. See
1200 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1202 Program reference: @internalsref{BarLine} (created at
1203 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1205 Examples: @inputfileref{input/@/test,bar@/-lines@/.ly},
1208 @node Unmetered music
1209 @subsection Unmetered music
1212 @cindex @code{\cadenzaOn}
1213 @cindex @code{\cadenzaOff}
1215 Bar lines and bar numbers are calculated automatically. For unmetered
1216 music (cadenzas, for example), this is not desirable. To turn off
1217 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1218 and @code{\cadenzaOff}.
1220 @lilypond[verbatim,quote,raggedright,relative=2,fragment]
1232 LilyPond will only insert page breaks at a barline. Unless the unmetered
1233 music ends before the end of the staff line, you will need to insert
1241 to indicate where line breaks can occur.
1244 @node System start delimiters
1245 @subsection System start delimiters
1247 @cindex start of system
1248 @cindex Staff, multiple
1249 @cindex bracket, vertical
1250 @cindex brace, vertical
1253 @cindex staff, choir
1255 Many scores consist of more than one staff. These staves can be
1256 joined in four different ways
1259 @item The group is started with a brace at the left, and bar lines are
1260 connected. This is done with the @internalsref{GrandStaff} context.
1262 @lilypond[verbatim,raggedright,quote]
1270 @item The group is started with a bracket, and bar lines are connected.
1271 This is done with the
1272 @internalsref{StaffGroup} context
1274 @lilypond[verbatim,raggedright,quote]
1282 @item The group is started with a bracket, but bar lines are not
1283 connected. This is done with the @internalsref{ChoirStaff} context.
1285 @lilypond[verbatim,raggedright,quote]
1293 @item The group is started with a vertical line. Bar lines are not
1294 connected. This is the default for the score.
1296 @lilypond[verbatim,raggedright,quote]
1307 The bar lines at the start of each system are
1308 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1309 @internalsref{SystemStartBracket}. Only one of these types is created
1310 in every context, and that type is determined by the property
1311 @code{systemStartDelimiter}.
1315 @subsection Staff symbol
1317 @cindex adjusting staff symbol
1319 Notes, dynamic signs, etc., are grouped
1320 with a set of horizontal lines, called a staff (plural `staves'). In
1321 LilyPond, these lines are drawn using a separate layout object called
1324 The staff symbol may be tuned in the number, thickness and distance
1325 of lines, using properties. This is demonstrated in the example files
1326 @inputfileref{input/@/test,staff@/-lines@/.ly},
1327 @inputfileref{input/@/test,staff@/-size@/.ly}.
1329 In addition, staves may be started and stopped at will. This is done
1330 with @code{\startStaff} and @code{\stopStaff}.
1332 @lilypond[verbatim,relative=2,fragment]
1334 \override Staff.StaffSymbol #'line-count = 2
1335 \stopStaff \startStaff
1337 \revert Staff.StaffSymbol #'line-count
1338 \stopStaff \startStaff
1342 In combination with Frenched staves, this may be used to typeset ossia
1343 sections. An example is in @inputfileref{input/@/test@/,ossia.ly},
1348 @lilypondfile{ossia.ly}
1350 @cindex staff lines, setting number of
1351 @cindex staff lines, setting thickness of
1352 @cindex thickness of staff lines, setting
1353 @cindex number of staff lines, setting
1357 Program reference: @internalsref{StaffSymbol}.
1359 Examples: @inputfileref{input/@/test,staff@/-lines@/.ly},
1360 @inputfileref{input/@/test@/,ossia.ly},
1361 @inputfileref{input/@/test,staff@/-size@/.ly}.
1365 @node Connecting notes
1366 @section Connecting notes
1368 This section deals with notation that affects groups of notes.
1386 A tie connects two adjacent note heads of the same pitch. The tie in
1387 effect extends the length of a note. Ties should not be confused with
1388 slurs, which indicate articulation, or phrasing slurs, which indicate
1389 musical phrasing. A tie is entered using the tilde symbol `@code{~}'
1391 @lilypond[quote,raggedright,fragment,verbatim]
1392 e' ~ e' <c' e' g'> ~ <c' e' g'>
1395 When a tie is applied to a chord, all note heads whose pitches match
1396 are connected. When no note heads match, no ties will be created.
1398 A tie is just a way of extending a note duration, similar to the
1399 augmentation dot. The following example shows two ways of notating
1400 exactly the same concept
1402 @lilypond[quote,fragment,raggedright]
1403 \time 3/4 c'2. c'2 ~ c'4
1407 Ties are used either when the note crosses a bar line, or when dots
1408 cannot be used to denote the rhythm. When using ties, larger note
1409 values should be aligned to subdivisions of the measure, eg.
1411 @lilypond[fragment,quote,raggedright]
1413 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
1417 If you need to tie a lot of notes over bars, it may be easier to use
1418 automatic note splitting (see @ref{Automatic note splitting}). This
1419 mechanism automatically splits long notes, and ties them across bar
1425 Ties are sometimes used to write out arpeggios. In this case, two tied
1426 notes need not be consecutive. This can be achieved by setting the
1427 @code{tieWaitForNote} property to true. For example,
1429 @lilypond[fragment,verbatim,relative=1,raggedright]
1430 \set tieWaitForNote = ##t
1431 \grace { c16[~ e~ g]~ } <c, e g>4
1438 @cindex @code{\tieUp}
1440 @cindex @code{\tieDown}
1442 @cindex @code{\tieNeutral}
1444 @cindex @code{\tieDotted}
1446 @cindex @code{\tieDashed}
1448 @cindex @code{\tieSolid}
1454 In this manual: @ref{Automatic note splitting}.
1456 Program reference: @internalsref{Tie}.
1461 Switching staves when a tie is active will not produce a slanted tie.
1463 Formatting of ties is a difficult subject. The results are often not
1472 A slur indicates that notes are to be played bound or
1473 @emph{legato}. They are entered using parentheses
1475 @lilypond[quote,raggedright,relative=2,fragment,verbatim]
1476 f( g a) a8 b( a4 g2 f4)
1480 The direction of a slur can be specified with
1481 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
1482 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
1485 However, there is a convenient shorthand for forcing slur
1486 directions. By adding @code{_} or @code{^} before the opening
1487 parentheses, the direction is also set. For example,
1489 @lilypond[relative=2,raggedright,quote,verbatim,fragment]
1493 Only one slur can be printed at once. If you need to print a long
1494 slur over a few small slurs, please see @ref{Phrasing slurs}.
1499 Some composers write two slurs when they want legato chords. This can
1500 be achieved in LilyPond by setting @code{doubleSlurs},
1502 @lilypond[verbatim,raggedright,relative,fragment,quote]
1503 \set doubleSlurs = ##t
1504 <c e>4 ( <d f> <c e> <d f> )
1510 @cindex @code{\slurUp}
1512 @cindex @code{\slurDown}
1514 @cindex @code{\slurNeutral}
1515 @code{\slurNeutral},
1516 @cindex @code{\slurDashed}
1518 @cindex @code{\slurDotted}
1520 @cindex @code{\slurSolid}
1525 Program reference: @seeinternals{Slur}.
1528 @node Phrasing slurs
1529 @subsection Phrasing slurs
1531 @cindex phrasing slurs
1532 @cindex phrasing marks
1534 A phrasing slur (or phrasing mark) connects notes and is used to
1535 indicate a musical sentence. It is written using @code{\(} and @code{\)}
1538 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
1539 \time 6/4 c'\( d( e) f( e) d\)
1542 Typographically, the phrasing slur behaves almost exactly like a
1543 normal slur. However, they are treated as different objects. A
1544 @code{\slurUp} will have no effect on a phrasing slur; instead, use
1545 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
1546 @code{\phrasingSlurNeutral}.
1548 You cannot have simultaneous phrasing slurs.
1553 @cindex @code{\phrasingSlurUp}
1554 @code{\phrasingSlurUp},
1555 @cindex @code{\phrasingSlurDown}
1556 @code{\phrasingSlurDown},
1557 @cindex @code{\phrasingSlurNeutral}
1558 @code{\phrasingSlurNeutral}.
1563 Program reference: @internalsref{PhrasingSlur}.
1566 @node Automatic beams
1567 @subsection Automatic beams
1569 LilyPond inserts beams automatically
1571 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1572 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
1575 When these automatic decisions are not good enough, beaming can be
1576 entered explicitly. It is also possible to define beaming patterns
1577 that differ from the defaults. See @ref{Setting automatic beam behavior}
1580 Individual notes may be marked with @code{\noBeam} to prevent them
1583 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1584 \time 2/4 c8 c\noBeam c c
1590 Program reference: @internalsref{Beam}.
1594 @subsection Manual beams
1596 @cindex beams, manual
1600 In some cases it may be necessary to override the automatic beaming
1601 algorithm. For example, the autobeamer will not put beams over rests
1602 or bar lines. Such beams are specified manually by marking the begin
1603 and end point with @code{[} and @code{]}
1605 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1607 r4 r8[ g' a r8] r8 g[ | a] r8
1614 @cindex @code{stemLeftBeamCount}
1615 @cindex @code{stemRightBeamCount}
1617 Normally, beaming patterns within a beam are determined automatically.
1618 If necessary, the properties @code{stemLeftBeamCount} and
1619 @code{stemRightBeamCount} can be used to override the defaults. If
1620 either property is set, its value will be used only once, and then it
1623 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
1628 \set stemLeftBeamCount = #1
1633 The property @code{subdivideBeams} can be set in order to subdivide
1634 all 16th or shorter beams at beat positions, as defined by the
1635 @code{beatLength} property.
1637 @lilypond[fragment,quote,relative=2,verbatim]
1639 \set subdivideBeams = ##t
1641 \set Score.beatLength = #(ly:make-moment 1 8)
1644 @cindex @code{subdivideBeams}
1646 Line breaks are normally forbidden when beams cross bar lines. This
1647 behavior can be changed by setting @code{allowBeamBreak}.
1649 @cindex @code{allowBeamBreak}
1650 @cindex beams and line breaks
1651 @cindex beams, kneed
1653 @cindex auto-knee-gap
1658 Kneed beams are inserted automatically when a large gap is detected
1659 between the note heads. This behavior can be tuned through the object.
1661 Automatically kneed cross-staff beams cannot be used together with
1662 hidden staves. See @ref{Hiding staves}.
1664 Beams do not avoid collisions with symbols around the notes, such as
1665 texts and accidentals.
1669 @subsection Grace notes
1671 @cindex @code{\grace}
1674 @cindex appoggiatura
1675 @cindex acciaccatura
1677 Grace notes are ornaments that are written out. The most common ones
1678 are acciaccatura, which should be played as very short. It is denoted
1679 by a slurred small note with a slashed stem. The appoggiatura is a
1680 grace note that takes a fixed fraction of the main note, and is
1681 denoted as a slurred note in small print without a slash. They
1682 are entered with the commands @code{\acciaccatura} and
1683 @code{\appoggiatura}, as demonstrated in the following example
1685 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1686 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
1687 \acciaccatura { g16[ f] } e4
1690 Both are special forms of the @code{\grace} command. By prefixing this
1691 keyword to a music expression, a new one is formed, which will be
1692 printed in a smaller font and takes up no logical time in a measure.
1694 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1696 \grace { c16[ d16] } c2 c4
1700 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
1701 @code{\grace} command does not start a slur.
1703 Internally, timing for grace notes is done using a second, `grace'
1704 timing. Every point in time consists of two rational numbers: one
1705 denotes the logical time, one denotes the grace timing. The above
1706 example is shown here with timing tuples
1708 @lilypond[quote,raggedright]
1711 c4 \grace c16 c4 \grace {
1714 \new Lyrics \lyricmode {
1715 \override LyricText #'font-family = #'typewriter
1719 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
1720 \markup { (\fraction 1 4 , 0 ) } 4
1722 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
1723 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
1725 \markup { ( \fraction 2 4 , 0 ) }
1730 The placement of grace notes is synchronized between different staves.
1731 In the following example, there are two sixteenth grace notes for
1732 every eighth grace note
1734 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1735 << \new Staff { e4 \grace { c16[ d e f] } e4 }
1736 \new Staff { c4 \grace { g8[ b] } c4 } >>
1739 If you want to end a note with a grace, use the @code{\afterGrace}
1740 command. It takes two arguments: the main note, and the grace notes
1741 following the main note.
1743 @lilypond[raggedright, verbatim,relative=2,fragment]
1744 c1 \afterGrace d1 { c16[ d] } c4
1747 This will put the grace notes after a ``space'' lasting 3/4 of the
1748 length of the main note. The fraction 3/4 can be changed by setting
1749 @code{afterGraceFraction}, ie.
1752 afterGraceFraction = #(cons 7 8)
1756 will put the grace note at 7/8 of the main note.
1758 The same effect can be achieved manually by doing
1760 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1763 { s2 \grace { c16[ d] } } >>
1769 By adjusting the duration of the skip note (here it is a half-note),
1770 the space between the main-note and the grace is adjusted.
1772 A @code{\grace} section will introduce special typesetting settings,
1773 for example, to produce smaller type, and set directions. Hence, when
1774 introducing layout tweaks, they should be inside the grace section,
1776 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
1788 The overrides should also be reverted inside the grace section.
1790 The layout of grace sections can be changed throughout the music using
1791 the function @code{add-grace-property}. The following example
1792 undefines the Stem direction for this grace, so stems do not always
1797 #(add-grace-property 'Voice 'Stem 'direction '())
1803 Another option is to change the variables @code{startGraceMusic},
1804 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
1805 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
1806 @code{stopAppoggiaturaMusic}. More information is in the file
1807 @file{ly/@/grace@/-init@/.ly}.
1812 Program reference: @internalsref{GraceMusic}.
1817 A score that starts with a @code{\grace} section needs an explicit
1818 @code{\context Voice} declaration, otherwise the main note and the grace
1819 note end up on different staves.
1821 Grace note synchronization can also lead to surprises. Staff notation,
1822 such as key signatures, bar lines, etc., are also synchronized. Take
1823 care when you mix staves with grace notes and staves without, for example,
1825 @lilypond[quote,raggedright,relative=2,verbatim,fragment]
1826 << \new Staff { e4 \bar "|:" \grace c16 d4 }
1827 \new Staff { c4 \bar "|:" d4 } >>
1831 This can be remedied by inserting grace skips, for the above example
1834 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
1837 Grace sections should only be used within sequential music
1838 expressions. Nesting or juxtaposing grace sections is not supported,
1839 and might produce crashes or other errors.
1843 @node Expressive marks
1844 @section Expressive marks
1846 Expressive marks help musicians to bring more to the music than simple
1851 * Fingering instructions::
1861 @subsection Articulations
1863 @cindex Articulations
1867 A variety of symbols can appear above and below notes to indicate
1868 different characteristics of the performance. They are added to a note
1869 by adding a dash and the character signifying the
1870 articulation. They are demonstrated here
1872 @lilypondfile[quote,raggedright]{script-abbreviations.ly}
1874 The meanings of these shorthands can be changed. See
1875 @file{ly/@/script@/-init@/.ly} for examples.
1877 The script is automatically placed, but the direction can be forced as
1878 well. Like other pieces of LilyPond code, @code{_} will place them
1879 below the staff, and @code{^} will place them above.
1881 @lilypond[quote,raggedright,fragment,verbatim]
1885 Other symbols can be added using the syntax
1886 @var{note}@code{\}@var{name}. Again, they
1887 can be forced up or down using @code{^} and @code{_},
1890 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
1891 c\fermata c^\fermata c_\fermata
1896 @cindex staccatissimo
1906 @cindex organ pedal marks
1915 @cindex prallmordent
1919 @cindex thumb marking
1924 Here is a chart showing all scripts available,
1926 @lilypondfile[raggedright,quote]{script-chart.ly}
1931 The vertical ordering of scripts is controlled with the
1932 @code{script-priority} property. The lower this number, the closer it
1933 will be put to the note. In this example, the
1934 @internalsref{TextScript} (the sharp symbol) first has the lowest
1935 priority, so it is put lowest in the first example. In the second, the
1936 prall trill (the @internalsref{Script}) has the lowest, so it is on the
1937 inside. When two objects have the same priority, the order in which
1938 they are entered decides which one comes first.
1940 @lilypond[verbatim,relative=3,raggedright,fragment,quote]
1941 \once \override TextScript #'script-priority = #-100
1942 a4^\prall^\markup { \sharp }
1944 \once \override Script #'script-priority = #-100
1945 a4^\prall^\markup { \sharp }
1951 Program reference: @internalsref{Script}.
1956 These signs appear in the printed output but have no effect on the
1957 MIDI rendering of the music.
1960 @node Fingering instructions
1961 @subsection Fingering instructions
1964 @cindex finger change
1966 Fingering instructions can be entered using
1968 @var{note}-@var{digit}
1970 For finger changes, use markup texts
1972 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1974 c^\markup { \finger "2 - 3" }
1977 You can use the thumb-script to indicate that a note should be
1978 played with the thumb (e.g., in cello music)
1979 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1980 <a_\thumb a'-3>8 <b_\thumb b'-3>
1983 Fingerings for chords can also be added to individual notes
1984 of the chord by adding them after the pitches
1985 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
1986 < c-1 e-2 g-3 b-5 >4
1992 You may exercise greater control over fingering chords by
1993 setting @code{fingeringOrientations}
1995 @lilypond[quote,verbatim,raggedright,fragment,relative=1]
1996 \set fingeringOrientations = #'(left down)
1997 <c-1 es-2 g-4 bes-5 > 4
1998 \set fingeringOrientations = #'(up right down)
1999 <c-1 es-2 g-4 bes-5 > 4
2002 Using this feature, it is also possible to put fingering instructions
2003 very close to note heads in monophonic music,
2005 @lilypond[verbatim,raggedright,quote,fragment]
2006 \set fingeringOrientations = #'(right)
2013 Program reference: @internalsref{Fingering}.
2015 Examples: @inputfileref{input/@/regression,finger@/-chords@/.ly}.
2019 @subsection Dynamics
2030 @cindex @code{\ffff}
2039 Absolute dynamic marks are specified using a command after a note
2040 @code{c4\ff}. The available dynamic marks are @code{\ppp},
2041 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2042 @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff},
2043 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2045 @lilypond[quote,verbatim,raggedright,fragment,relative=2]
2046 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2047 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2054 A crescendo mark is started with @code{\<} and terminated with
2055 @code{\!} or an absolute dynamic. A decrescendo is started with
2056 @code{\>} and is also terminated with @code{\!} or an absolute
2057 dynamic. Because these marks are bound to notes, you must
2058 use spacer notes if multiple marks are needed during one note
2060 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2062 << f1 { s4 s4\< s4\! \> s4\! } >>
2064 This may give rise to very short hairpins. Use @code{minimum-length}
2065 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2069 \override Staff.Hairpin #'minimum-length = #5
2076 You can also use a text saying @emph{cresc.} instead of hairpins
2078 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2089 You can also supply your own texts
2090 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2091 \set crescendoText = \markup { \italic "cresc. poco" }
2092 \set crescendoSpanner = #'dashed-line
2096 To create new dynamic marks or text that should be aligned
2097 with dynamics, see @ref{New dynamic marks}.
2102 @cindex @code{\dynamicUp}
2104 @cindex @code{\dynamicDown}
2105 @code{\dynamicDown},
2106 @cindex @code{\dynamicNeutral}
2107 @code{\dynamicNeutral}.
2112 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2113 Vertical positioning of these symbols is handled by
2114 @internalsref{DynamicLineSpanner}.
2118 @subsection Breath marks
2120 Breath marks are entered using @code{\breathe}
2122 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2129 The glyph of the breath mark can be tuned by overriding the
2130 @code{text} property of the @code{BreathingSign} layout object with
2131 any markup text. For example,
2132 @lilypond[quote,raggedright,fragment,verbatim,relative=1]
2134 \override BreathingSign #'text
2135 = #(make-musicglyph-markup "scripts.rvarcomma")
2142 Program reference: @internalsref{BreathingSign}.
2144 Examples: @inputfileref{input/@/regression,breathing@/-sign@/.ly}.
2147 @node Running trills
2148 @subsection Running trills
2150 Long running trills are made with @code{\startTrillSpan} and
2151 @code{\stopTrillSpan},
2153 @lilypond[verbatim,raggedright,relative=2,quote,fragment]
2155 << { c1 \startTrillSpan }
2156 { s2. \grace { d16[\stopTrillSpan e] } } >>
2163 @code{\startTrillSpan},
2164 @cindex @code{\startTrillSpan}
2165 @code{\stopTrillSpan}.
2166 @cindex @code{\stopTrillSpan}
2171 Program reference: @internalsref{TrillSpanner}.
2175 @subsection Glissando
2178 @cindex @code{\glissando}
2180 A glissando is a smooth change in pitch. It is denoted by a line or a
2181 wavy line between two notes. It is requested by attaching
2182 @code{\glissando} to a note
2184 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2186 \override Glissando #'style = #'zigzag
2193 Program reference: @internalsref{Glissando}.
2195 Example files: @file{input/@/regression/@/glissando@/.ly}.
2200 Printing text over the line (such as @emph{gliss.}) is not supported.
2204 @subsection Arpeggio
2207 @cindex broken chord
2208 @cindex @code{\arpeggio}
2210 You can specify an arpeggio sign (also known as broken chord) on a
2211 chord by attaching an @code{\arpeggio} to a chord
2213 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2217 A square bracket on the left indicates that the player should not
2218 arpeggiate the chord
2220 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2225 The direction of the arpeggio is sometimes denoted by adding an
2226 arrowhead to the wiggly line
2228 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2240 When an arpeggio crosses staves, you may attach an arpeggio to the chords
2241 in both staves and set
2242 @internalsref{PianoStaff}.@code{connectArpeggios}
2244 @lilypond[quote,raggedright,fragment,relative=1,verbatim]
2245 \context PianoStaff <<
2246 \set PianoStaff.connectArpeggios = ##t
2247 \new Staff { <c' e g c>\arpeggio }
2248 \new Staff { \clef bass <c,, e g>\arpeggio }
2256 @cindex @code{\arpeggioUp}
2258 @cindex @code{\arpeggioDown}
2259 @code{\arpeggioDown},
2260 @cindex @code{\arpeggioNeutral}
2261 @code{\arpeggioNeutral},
2262 @cindex @code{\arpeggioBracket}
2263 @code{\arpeggioBracket}.
2268 Notation manual: @ref{Ties}, for writing out arpeggios.
2270 Program reference: @internalsref{Arpeggio}.
2275 It is not possible to mix connected arpeggios and unconnected
2276 arpeggios in one @internalsref{PianoStaff} at the same point in time.
2283 Polyphony in music refers to having more than one voice occuring in
2284 a piece of music. Polyphony in LilyPond refers to having more than
2285 one voice on the same staff.
2289 * Explicitly instantiating voices::
2290 * Collision Resolution::
2294 @node Basic polyphony
2295 @subsection Basic polyphony
2299 The easiest way to enter fragments with more than one voice on a staff
2300 is to enter each voice as a sequence (with @code{@{...@}}), and combine
2301 them simultaneously, separating the voices with @code{\\}
2305 @lilypond[quote,verbatim,fragment]
2306 \new Staff \relative c' {
2309 { g4 f e | d2 e2 } \\
2310 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
2316 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
2317 voices are sometimes called ``layers'' in other notation packages}
2319 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
2320 each of these contexts, vertical direction of slurs, stems, etc., is set
2323 These voices are all seperate from the voice that contains the notes just
2324 outside the @code{<< \\ >>} construct. This should be noted when making
2325 changes at the voice level. This also means that slurs and ties cannot go
2326 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
2327 from separate @code{<< \\ >>} constructs on the same staff are the the
2328 same voice. Here is the same example, with different noteheads for each
2329 voice. Note that the change to the note-head style in the main voice does not affect
2330 the inside of the @code{<< \\ >>} constructs. Also, the change to the second
2331 voice in the first @code{<< \\ >>} construct is effective in the second
2332 @code{<< \\ >>}, and the voice is tied accross the two constructs.
2334 @lilypond[quote,verbatim,fragment]
2335 \new Staff \relative c' {
2336 \override NoteHead #'style = #'cross
2340 { \override NoteHead #'style = #'triangle
2345 { c8 b16 a b8 g ~ g2 } \\
2346 { \override NoteHead #'style = #'slash s4 b4 c2 }
2351 Polyphony does not change the relationship of notes within a
2352 @code{\relative @{ @}} block. Each note is calculated relative
2353 to the note immediately preceding it.
2356 \relative @{ noteA << noteB \\ noteC >> noteD @}
2359 @code{noteC} is relative to @code{noteB}, not @code{noteA};
2360 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
2363 @node Explicitly instantiating voices
2364 @subsection Explicitly instantiating voices
2366 @internalsref{Voice} contexts can also also be instantiated manually
2367 inside a @code{<< >>} block to create polyphonic music, using
2368 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
2369 and a horizontal shift for each part.
2373 << \upper \\ \lower >>
2381 \context Voice = "1" @{ \voiceOne \upper @}
2382 \context Voice = "2" @{ \voiceTwo \lower @}
2386 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
2387 articulations, text annotations, augmentation dots of dotted
2388 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
2389 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
2390 make them point downwards.
2391 The command @code{\oneVoice} will revert back to the normal setting.
2393 An expression that appears directly inside a @code{<< >>} belongs to
2394 the main voice. This is useful when extra voices appear while the main
2395 voice is playing. Here is a more correct rendition of the example from
2396 the previous section. The crossed noteheads demonstrate that the main
2397 melody is now in a single voice context.
2399 @lilypond[quote,raggedright,verbatim]
2400 \new Staff \relative c' {
2401 \override NoteHead #'style = #'cross
2406 \context Voice="1" { \voiceTwo
2407 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2410 \new Voice { \voiceThree
2419 The correct definition of the voices allows the melody to be slurred.
2420 @lilypond[quote,raggedright,verbatim]
2421 \new Staff \relative c' {
2426 \context Voice="1" { \voiceTwo
2427 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
2430 \new Voice { \voiceThree
2439 Avoiding the @code{\\} seperator also allows nesting polyphony
2440 constructs, which in some case might be a more natural way to typeset
2443 @lilypond[quote,raggedright,verbatim]
2444 \new Staff \relative c' {
2449 \context Voice="1" { \voiceTwo
2452 {c8 b16 a b8 g ~ g2}
2453 \new Voice { \voiceThree
2466 @node Collision Resolution
2467 @subsection Collision Resolution
2469 Normally, note heads with a different number of dots are not merged, but
2470 when the object property @code{merge-differently-dotted} is set in
2471 the @internalsref{NoteCollision} object, they are merged
2472 @lilypond[quote,verbatim,fragment,raggedright,relative=2]
2475 \override Staff.NoteCollision
2476 #'merge-differently-dotted = ##t
2478 } \\ { g8.[ f16] g8.[ f16] } >>
2481 Similarly, you can merge half note heads with eighth notes, by setting
2482 @code{merge-differently-headed}
2483 @lilypond[quote,raggedright,fragment,relative=2,verbatim]
2486 \override Staff.NoteCollision
2487 #'merge-differently-headed = ##t
2488 c8 c4. } \\ { c2 c2 } >>
2491 LilyPond also vertically shifts rests that are opposite of a stem,
2494 @lilypond[quote,raggedright,fragment,verbatim]
2495 \context Voice << c''4 \\ r4 >>
2501 @cindex @code{\oneVoice}
2503 @cindex @code{\voiceOne}
2505 @cindex @code{\voiceTwo}
2507 @cindex @code{\voiceThree}
2509 @cindex @code{\voiceFour}
2512 @cindex @code{\shiftOn}
2514 @cindex @code{\shiftOnn}
2516 @cindex @code{\shiftOnnn}
2518 @cindex @code{\shiftOff}
2519 @code{\shiftOff}: these commands specify in what chords of the current
2520 voice should be shifted. The outer voices (normally: voice one and
2521 two) have @code{\shiftOff}, while the inner voices (three and four)
2522 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
2523 further shift levels.
2525 When LilyPond cannot cope, the @code{force-hshift}
2526 property of the @internalsref{NoteColumn} object and pitched rests can
2527 be used to override typesetting decisions.
2529 @lilypond[quote,verbatim,raggedright]
2536 \once \override NoteColumn #'force-hshift = #1.7
2544 Program reference: the objects responsible for resolving collisions are
2545 @internalsref{NoteCollision} and @internalsref{RestCollision}.
2548 @inputfileref{input/@/regression,collision@/-dots@/.ly},
2549 @inputfileref{input/@/regression,collision@/-head-chords@/.ly},
2550 @inputfileref{input/@/regression,collision@/-heads@/.ly},
2551 @inputfileref{input/@/regression,collision@/-mesh@/.ly}, and
2552 @inputfileref{input/@/regression,collisions@/.ly}.
2557 When using @code{merge-differently-headed} with an upstem eighth or a
2558 shorter note, and a downstem half note, the eighth note gets the wrong
2561 There is no support for clusters where the same note occurs with
2562 different accidentals in the same chord. In this case, it is
2563 recommended to use enharmonic transcription, or to use special cluster
2564 notation (see @ref{Clusters}).
2571 Repetition is a central concept in music, and multiple notations exist
2577 * Repeats and MIDI::
2578 * Manual repeat commands::
2580 * Tremolo subdivisions::
2586 @subsection Repeat types
2589 @cindex @code{\repeat}
2591 The following types of repetition are supported
2595 Repeated music is fully written (played) out. This is useful when
2596 entering repetitious music. This is the only kind of repeat that
2597 is included in MIDI output.
2600 Repeats are not written out, but alternative endings (volte) are
2601 printed, left to right with brackets. This is the standard notation
2602 for repeats with alternatives. These are not played in MIDI output by default.
2606 Alternative endings are written stacked. This has limited use but may be
2607 used to typeset two lines of lyrics in songs with repeats, see
2608 @inputfileref{input,star-spangled-banner@/.ly}.
2612 Make tremolo beams. These are not played in MIDI output by default.
2615 Make beat or measure repeats. These look like percent signs. These
2616 are not played in MIDI output by default. Percent repeats must be
2617 declared within a Voice context.
2623 @subsection Repeat syntax
2625 LilyPond has one syntactic construct for specifying different types of
2626 repeats. The syntax is
2629 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
2632 If you have alternative endings, you may add
2633 @cindex @code{\alternative}
2644 where each @var{alternative} is a music expression. If you do not
2645 give enough alternatives for all of the repeats, the first alternative
2646 is assumed to be played more than once.
2648 Standard repeats are used like this
2649 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2651 \repeat volta 2 { c4 d e f }
2652 \repeat volta 2 { f e d c }
2655 With alternative endings
2656 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2658 \repeat volta 2 {c4 d e f}
2659 \alternative { {d2 d} {f f,} }
2662 @lilypond[quote,raggedright,fragment,verbatim,relative=2]
2665 \repeat volta 4 { e | c2 d2 | e2 f2 | }
2666 \alternative { { g4 g g } { a | a a a a | b2. } }
2670 It is possible to shorten volta brackets
2671 by setting @code{voltaSpannerDuration}. In the next example, the
2672 bracket only lasts one measure, which is a duration of 3/4.
2674 @lilypond[verbatim,raggedright,quote]
2678 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
2679 \repeat "volta" 5 { d d d }
2680 \alternative { { e e e f f f }
2690 Brackets for the repeat are normally only printed over the topmost
2691 staff. This can be adjusted by setting the @code{voltaOnThisStaff}
2692 property; see @inputfileref{input/@/regression,volta@/-multi@/-staff@/.ly}.
2697 @cindex repeat, ambiguous
2699 A nested repeat like
2708 is ambiguous, since it is is not clear to which @code{\repeat} the
2709 @code{\alternative} belongs. This ambiguity is resolved by always
2710 having the @code{\alternative} belong to the inner @code{\repeat}.
2711 For clarity, it is advisable to use braces in such situations.
2713 Timing information is not remembered at the start of an alternative,
2714 so after a repeat timing information must be reset by hand, for
2715 example by setting @code{Score.measurePosition} or entering
2716 @code{\partial}. Similarly, slurs or ties are also not repeated.
2719 @node Repeats and MIDI
2720 @subsection Repeats and MIDI
2722 @cindex expanding repeats
2723 @cindex @code{\unfoldRepeats}
2725 With a little bit of tweaking, all types of repeats can be present
2726 in the MIDI output. This is achieved by applying the
2727 @code{\unfoldRepeats} music function. This functions changes all
2728 repeats to unfold repeats.
2730 @lilypond[quote,verbatim,fragment,linewidth=8.0\cm]
2732 \repeat tremolo 8 {c'32 e' }
2733 \repeat percent 2 { c''8 d'' }
2734 \repeat volta 2 {c'4 d' e' f'}
2743 When creating a score file using @code{\unfoldRepeats} for midi, then
2744 it is necessary to make two @code{\score} blocks. One for MIDI (with
2745 unfolded repeats) and one for notation (with volta, tremolo, and
2746 percent repeats). For example,
2754 \unfoldRepeats @var{..music..}
2760 @node Manual repeat commands
2761 @subsection Manual repeat commands
2763 @cindex @code{repeatCommands}
2765 The property @code{repeatCommands} can be used to control the layout of
2766 repeats. Its value is a Scheme list of repeat commands.
2769 @item @code{start-repeat}
2770 Print a @code{|:} bar line.
2772 @item @code{end-repeat}
2773 Print a @code{:|} bar line.
2775 @item @code{(volta @var{text})}
2776 Print a volta bracket saying @var{text}: The text can be specified as
2777 a text string or as a markup text, see @ref{Text markup}. Do not
2778 forget to change the font, as the default number font does not contain
2779 alphabetic characters;
2781 @item @code{(volta #f)}
2782 Stop a running volta bracket.
2785 @lilypond[quote,raggedright,verbatim,fragment,relative=2]
2787 \set Score.repeatCommands = #'((volta "93") end-repeat)
2789 \set Score.repeatCommands = #'((volta #f))
2796 Program reference: @internalsref{VoltaBracket}, @internalsref{RepeatedMusic},
2797 @internalsref{VoltaRepeatedMusic},
2798 @internalsref{UnfoldedRepeatedMusic}, and
2799 @internalsref{FoldedRepeatedMusic}.
2802 @node Tremolo repeats
2803 @subsection Tremolo repeats
2805 @cindex tremolo beams
2807 To place tremolo marks between notes, use @code{\repeat} with tremolo
2809 @lilypond[quote,verbatim,raggedright]
2810 \new Voice \relative c' {
2811 \repeat "tremolo" 8 { c16 d16 }
2812 \repeat "tremolo" 4 { c16 d16 }
2813 \repeat "tremolo" 2 { c16 d16 }
2817 Tremolo marks can also be put on a single note. In this case, the
2818 note should not be surrounded by braces.
2819 @lilypond[quote,verbatim,raggedright]
2820 \repeat "tremolo" 4 c'16
2823 Similar output is obtained using the tremolo subdivision, described in
2824 @ref{Tremolo subdivisions}.
2829 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
2831 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
2833 Example files: @inputfileref{input/@/regression,chord@/-tremolo@/.ly},
2834 @inputfileref{input/@/regression,stem@/-tremolo@/.ly}.
2837 @node Tremolo subdivisions
2838 @subsection Tremolo subdivisions
2840 @cindex tremolo marks
2841 @cindex @code{tremoloFlags}
2843 Tremolo marks can be printed on a single note by adding
2844 `@code{:}[@var{number}]' after the note. The number indicates the
2845 duration of the subdivision, and it must be at least 8. A
2846 @var{length} value of 8 gives one line across the note stem. If the
2847 length is omitted, the last value (stored in @code{tremoloFlags}) is
2850 @lilypond[quote,raggedright,verbatim,fragment]
2851 c'2:8 c':32 | c': c': |
2857 Tremolos entered in this way do not carry over into the MIDI output.
2862 In this manual: @ref{Tremolo repeats}.
2864 Elsewhere: @internalsref{StemTremolo}.
2867 @node Measure repeats
2868 @subsection Measure repeats
2870 @cindex percent repeats
2871 @cindex measure repeats
2873 In the @code{percent} style, a note pattern can be repeated. It is
2874 printed once, and then the pattern is replaced with a special sign.
2875 Patterns of one and two measures are replaced by percent-like signs,
2876 patterns that divide the measure length are replaced by slashes.
2877 Percent repeats must be declared within a @code{Voice} context.
2879 @lilypond[quote,verbatim,raggedright]
2880 \new Voice \relative c' {
2881 \repeat "percent" 4 { c4 }
2882 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
2889 Program reference: @internalsref{RepeatSlash}, @internalsref{PercentRepeat},
2890 @internalsref{PercentRepeatedMusic}, and
2891 @internalsref{DoublePercentRepeat}.