1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
4 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6 When revising a translation, copy the HEAD committish of the
7 version that you are working on. See TRANSLATION for details.
11 @c A menu is needed before every deeper *section nesting of @node's; run
12 @c M-x texinfo-all-menus-update
13 @c to automatically fill in these menus before saving changes
16 @chapter Basic notation
18 This chapter explains how to use basic notation features.
35 This section discusses how to specify the pitch of notes.
40 * Cautionary accidentals::
42 * Note names in other languages::
52 @subsection Normal pitches
57 A pitch name is specified using lowercase letters @code{a} through @code{g}.
58 An ascending C-major scale is engraved with
60 @lilypond[quote,fragment,verbatim,ragged-right]
65 The note name @code{c} is engraved one octave below middle C.
67 @lilypond[quote,fragment,verbatim,ragged-right]
77 The optional octave specification takes the form of a series of
78 single quote (@samp{'}) characters or a series of comma
79 (@samp{,}) characters. Each @samp{'} raises the pitch by one
80 octave; each @samp{,} lowers the pitch by an octave.
82 @lilypond[quote,ragged-right,fragment,verbatim]
84 c' c'' e' g d'' d' d c
86 c, c,, e, g d,, d, d c
89 An alternate method may be used to declare which octave to
90 engrave a pitch; this method does not require as many
91 octave specifications (@code{'} and @code{,}). See
92 @ref{Relative octaves}.
96 @subsection Accidentals
98 @cindex note names, Dutch
99 @cindex note names, default
101 A sharp is formed by adding @code{-is} to the end of a pitch name and
102 a flat is formed by adding @code{-es}. Double sharps and double flats
103 are obtained by adding @code{-isis} or @code{-eses} to a note name.
105 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
111 These are the Dutch note names. In Dutch, @code{aes} is contracted to
112 @code{as}, but both forms are accepted. Similarly, both
113 @code{es} and @code{ees} are accepted
115 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
119 A natural will cancel the effect of an accidental or key signature.
120 However, naturals are not encoded into the note name syntax with a
121 suffix; a natural pitch is shown as a simple note name
123 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
127 The input @code{d e f} is interpreted as @q{print a D-natural,
128 E-natural, and an F-natural,} regardless of the key
129 signature. For more information about the distinction between
130 musical content and the presentation of that content, see
131 @ref{Accidentals and key signatures}.
133 @lilypond[fragment,quote,ragged-right,verbatim,relative]
142 In accordance with standard typesetting rules, a natural sign is printed
143 before a sharp or flat if a previous accidental needs to be
144 cancelled. To change this behavior, use
145 @code{\set Staff.extraNatural = ##f}
147 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
149 \set Staff.extraNatural = ##f
156 Program reference: @internalsref{LedgerLineSpanner},
157 @internalsref{NoteHead}.
160 @node Cautionary accidentals
161 @subsection Cautionary accidentals
163 @cindex accidental, reminder
164 @cindex accidental, cautionary
165 @cindex accidental, parenthesized
166 @cindex reminder accidental
168 @cindex cautionary accidental
169 @cindex parenthesized accidental
172 Normally accidentals are printed automatically, but you may also
173 print them manually. A reminder accidental
174 can be forced by adding an exclamation mark @code{!}
175 after the pitch. A cautionary accidental
176 (i.e., an accidental within parentheses) can be obtained by adding the
177 question mark @samp{?} after the pitch. These extra accidentals
178 can be used to produce natural signs, too.
180 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
181 cis cis cis! cis? c c? c! c
187 The automatic production of accidentals can be tuned in many
188 ways. For more information, see @ref{Automatic accidentals}.
192 @subsection Micro tones
194 @cindex quarter tones
195 @cindex semi-flats, semi-sharps
197 Half-flats and half-sharps are formed by adding @code{-eh} and
198 @code{-ih}; the following is a series of Cs with increasing pitches
200 @lilypond[verbatim,ragged-right,quote,relative=2,fragment]
201 \set Staff.extraNatural = ##f
205 Micro tones are also exported to the MIDI file.
210 There are no generally accepted standards for denoting
211 three-quarter flats, so LilyPond's symbol does not conform to any
215 @node Note names in other languages
216 @subsection Note names in other languages
218 There are predefined sets of note names for various other languages.
219 To use them, include the language specific init file. For
220 example, add @code{\include "english.ly"} to the top of the input
221 file. The available language files
222 and the note names they define are
224 @c Should this be made into a multitable?
225 @cindex note names, other languages
227 Note Names sharp flat double double
230 nederlands.ly c d e f g a bes b -is -es -isis -eses
231 english.ly c d e f g a bf b -s/-sharp -f/-flat -ss/-x/ -ff/
232 -sharpsharp -flatflat
233 deutsch.ly c d e f g a b h -is -es -isis -eses
234 norsk.ly c d e f g a b h -iss/-is -ess/-es -ississ/-isis -essess/-eses
235 svenska.ly c d e f g a b h -iss -ess -ississ -essess
236 italiano.ly do re mi fa sol la sib si -d -b -dd -bb
237 catalan.ly do re mi fa sol la sib si -d/-s -b -dd/-ss -bb
238 espanol.ly do re mi fa sol la sib si -s -b -ss -bb
242 Note that in Dutch, German, Norwegian, and Swedish, the flat
243 alterations of @samp{a} like for example @code{aes} and @code{aeses}
244 are usually contracted to @code{as} and @code{ases} (or more commonly
245 @code{asas}). Sometimes only these contracted names are defined in the
246 corresponding language files (this also applies to the suffixes for
250 Some music uses microtones whose alterations are fractions of a
251 @q{regular} sharp or flat. The note names for quartertones defined in
252 the various language files are listed in the following table. Here the
253 prefixes @q{semi-} and @q{sesqui-} mean @q{half} and @q{one and a
254 half}, respectively. For Norwegian, Swedish, Catalan and Spanish no
255 special names have been defined yet.
256 @c What about Turkish Maquam music and similar microtonal systems?
258 @c Note that the term "three-quarter-sharp/-flat" used in lilypond's source code
259 @c is actually misleading since the alteration is in fact one and a half
260 @c of a regular sharp/flat. Whence the naming "sesqui-sharp/-flat" used below.
263 Note Names semi- semi- sesqui- sesqui-
264 sharp flat sharp flat
266 nederlands.ly c d e f g a bes b -ih -eh -isih -eseh
267 english.ly c d e f g a bf b -qs -qf -tqs -tqf
268 deutsch.ly c d e f g a b h -ih -eh -isih -eseh
269 norsk.ly c d e f g a b h
270 svenska.ly c d e f g a b h
271 italiano.ly do re mi fa sol la sib si -sd -sb -dsd -bsb
272 catalan.ly do re mi fa sol la sib si
273 espanol.ly do re mi fa sol la sib si
278 @node Relative octaves
279 @subsection Relative octaves
282 @cindex Relative octave specification
285 Octaves are specified by adding @code{'} and @code{,} to pitch names.
286 When you copy existing music, it is easy to accidentally put a pitch
287 in the wrong octave and hard to find such an error. The relative
288 octave mode prevents these errors by making the mistakes much
289 larger: a single error puts the rest of the piece off by one octave
292 \relative @var{startpitch} @var{musicexpr}
299 \relative @var{musicexpr}
303 @code{c'} is used as the default if no starting pitch is defined.
305 The octave of notes that appear in @var{musicexpr} are calculated as
306 follows: if no octave changing marks are used, the basic interval
307 between this and the last note is always taken to be a fourth or
308 less. This distance is determined without regarding alterations; a
309 @code{fisis} following a @code{ceses} will be put above the
310 @code{ceses}. In other words, a doubly-augmented fourth is considered
311 a smaller interval than a diminished fifth, even though the
312 doubly-augmented fourth spans seven semitones while the diminished
313 fifth only spans six semitones.
315 The octave changing marks @code{'} and @code{,} can be added to raise
316 or lower the pitch by an extra octave. Upon entering relative mode,
317 an absolute starting pitch can be specified that will act as the
318 predecessor of the first note of @var{musicexpr}. If no starting pitch
319 is specified, then middle C is used as a start.
321 Here is the relative mode shown in action
322 @lilypond[quote,fragment,ragged-right,verbatim]
328 Octave changing marks are used for intervals greater than a fourth
330 @lilypond[quote,ragged-right,fragment,verbatim]
336 If the preceding item is a chord, the first note of the chord is used
337 to determine the first note of the next chord
339 @lilypond[quote,ragged-right,fragment,verbatim]
347 The pitch after @code{\relative} contains a note name.
349 The relative conversion will not affect @code{\transpose},
350 @code{\chordmode} or @code{\relative} sections in its argument. To use
351 relative within transposed music, an additional @code{\relative} must
352 be placed inside @code{\transpose}.
356 @subsection Octave check
360 Octave checks make octave errors easier to correct: a note may be
361 followed by @code{=}@var{quotes} which indicates what its absolute
362 octave should be. In the following example,
365 \relative c'' @{ c='' b=' d,='' @}
369 the @code{d} will generate a warning, because a @code{d''} is expected
370 (because @code{b'} to @code{d''} is only a third), but a @code{d'} is
371 found. In the output, the octave is corrected to be a @code{d''} and
372 the next note is calculated relative to @code{d''} instead of @code{d'}.
374 There is also an octave check that produces no visible output. The syntax
380 This checks that @var{pitch} (without quotes) yields @var{pitch} (with
381 quotes) in @code{\relative} mode compared to the note given in the
382 @code{\relative} command. If not, a warning is printed, and the
383 octave is corrected. The @var{pitch} is not printed as a note.
385 In the example below, the first check passes without incident, since
386 the @code{e} (in @code{relative} mode) is within a fifth of
388 the second check produces a warning, since the @code{e} is not within
389 a fifth of @code{b'}. The warning message is printed, and the octave
390 is adjusted so that the following notes are in the correct octave
402 The octave of a note following an octave check is determined with
403 respect to the note preceding it. In the next fragment, the last note
404 is an @code{a'}, above middle C. That means that the @code{\octave}
405 check passes successfully, so the check could be deleted without changing
406 the output of the piece.
408 @lilypond[quote,ragged-right,verbatim,fragment]
418 @subsection Transpose
421 @cindex Transposition of pitches
424 A music expression can be transposed with @code{\transpose}. The
427 \transpose @var{from} @var{to} @var{musicexpr}
430 This means that @var{musicexpr} is transposed by the interval between
431 the pitches @var{from} and @var{to}: any note with pitch @code{from}
432 is changed to @code{to}.
434 For example, consider a piece written in the key of D-major. If
435 this piece is a little too low for its performer, it can be
436 transposed up to E-major with
438 \transpose d e @dots{}
441 Consider a part written for violin (a C instrument). If
442 this part is to be played on the A clarinet (for which an
443 A is notated as a C, and which sounds a minor third lower
444 than notated), the following
445 transposition will produce the appropriate part
448 \transpose a c @dots{}
451 @code{\transpose} distinguishes between enharmonic pitches: both
452 @code{\transpose c cis} or @code{\transpose c des} will transpose up
453 half a tone. The first version will print sharps and the second
454 version will print flats
456 @lilypond[quote,ragged-right,verbatim]
457 mus = { \key d \major cis d fis g }
466 @code{\transpose} may also be used to input written notes for a
467 transposing instrument. Pitches are normally entered into LilyPond
468 in C (or @q{concert pitch}), but they may be entered in another
469 key. For example, when entering music for a B-flat trumpet which
470 begins on concert D, one would write
473 \transpose c bes @{ e4 @dots{} @}
476 To print this music in B-flat again (i.e., producing a trumpet part,
477 instead of a concert pitch conductor's score) you would wrap the
478 existing music with another @code{transpose}
481 \transpose bes c @{ \transpose c bes @{ e4 @dots{} @} @}
487 Program reference: @internalsref{TransposedMusic}.
489 Example: @lsr{scheme,transpose-pitches-with-minimum-accidentals.ly}.
494 If you want to use both @code{\transpose} and @code{\relative},
495 you must put @code{\transpose} outside of @code{\relative}, since
496 @code{\relative} will have no effect on music that appears inside a
507 Rests are entered like notes with the note name @code{r}
509 @lilypond[fragment,quote,ragged-right,verbatim]
513 Whole bar rests, centered in middle of the bar,
514 must be done with multi-measure rests. They can be used for a
515 single bar as well as many bars, and are discussed in
516 @ref{Multi measure rests}.
518 To explicitly specify a rest's vertical position, write a note
519 followed by @code{\rest}. A rest will be placed in the position
520 where the note would appear,
522 @lilypond[fragment,quote,ragged-right,verbatim]
527 This makes manual formatting of
528 polyphonic music much easier, since the automatic rest collision
529 formatter will leave these rests alone.
533 Program reference: @internalsref{Rest}.
540 @cindex Invisible rest
545 An invisible rest (also called a @q{skip}) can be entered like a note
546 with note name @samp{s} or with @code{\skip @var{duration}}
548 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
549 a4 a4 s4 a4 \skip 1 a4
552 The @code{s} syntax is only available in note mode and chord mode. In
553 other situations, for example, when entering lyrics, you should use
554 the @code{\skip} command
556 @lilypond[quote,ragged-right,verbatim]
559 \new Lyrics \lyricmode { \skip 2 bla2 }
563 The skip command is merely an empty musical placeholder. It does not
564 produce any output, not even transparent output.
566 The @code{s} skip command does create @internalsref{Staff} and
567 @internalsref{Voice} when necessary, similar to note and rest
568 commands. For example, the following results in an empty staff.
570 @lilypond[quote,ragged-right,verbatim]
574 The fragment @code{@{ \skip 4 @} } would produce an empty page.
578 Program reference: @internalsref{SkipMusic}.
585 This section discusses rhythms, durations, and bars.
589 * Augmentation dots::
591 * Scaling durations::
594 * Automatic note splitting::
599 @subsection Durations
606 In Note, Chord, and Lyrics mode, durations are designated by numbers and
607 dots: durations are entered as their reciprocal values. For example, a
608 quarter note is entered using a @code{4} (since it is a 1/4 note), while
609 a half note is entered using a @code{2} (since it is a 1/2 note). For
610 notes longer than a whole you must use the @code{\longa} and
611 @code{\breve} commands
615 c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64
617 r1 r2 r4 r8 r16 r32 r64 r64
623 a\breve*1/2 \autoBeamOff
624 a1 a2 a4 a8 a16 a32 a64 a64
627 r\longa*1/4 r\breve *1/2
628 r1 r2 r4 r8 r16 r32 r64 r64
635 \remove "Bar_number_engraver"
639 \remove "Clef_engraver"
640 \override StaffSymbol #'transparent = ##t
641 \override TimeSignature #'transparent = ##t
642 \override BarLine #'transparent = ##t
643 \consists "Pitch_squash_engraver"
649 If the duration is omitted then it is set to the previously entered
650 duration. The default for the first note is a quarter note.
652 @lilypond[quote,ragged-right,verbatim,fragment]
653 { a a a2 a a4 a a1 a }
657 @node Augmentation dots
658 @subsection Augmentation dots
662 To obtain dotted note lengths, simply add a dot (@samp{.}) to
663 the number. Double-dotted notes are produced in a similar way.
665 @lilypond[quote,ragged-right,fragment,verbatim]
666 a'4 b' c''4. b'8 a'4. b'4.. c''8.
671 Dots are normally moved up to avoid staff lines, except in polyphonic
672 situations. The following commands may be used to force a particular
679 @funindex \dotsNeutral
684 Program reference: @internalsref{Dots}, and @internalsref{DotColumn}.
694 Tuplets are made out of a music expression by multiplying all durations
698 \times @var{fraction} @var{musicexpr}
702 The duration of @var{musicexpr} will be multiplied by the fraction.
703 The fraction's denominator will be printed over the notes, optionally
704 with a bracket. The most common tuplet is the triplet in which 3
705 notes have the length of 2, so the notes are 2/3 of their written
708 @lilypond[quote,ragged-right,fragment,verbatim]
709 g'4 \times 2/3 {c'4 c' c'} d'4 d'4
712 Tuplets may be nested, for example,
714 @lilypond[fragment,ragged-right,verbatim,relative=2]
715 \override TupletNumber #'text = #tuplet-number::calc-fraction-text
718 \times 3/5 { a a a a a }
726 @funindex \tupletDown
728 @funindex \tupletNeutral
729 @code{\tupletNeutral}.
734 @funindex tupletNumberFormatFunction
735 @cindex tuplet formatting
737 The property @code{tupletSpannerDuration} specifies how long each
738 bracket should last. With this, you can make lots of tuplets while
739 typing @code{\times} only once, thus saving lots of typing. In the next
740 example, there are two triplets shown, while @code{\times} was only
743 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
744 \set tupletSpannerDuration = #(ly:make-moment 1 4)
745 \times 2/3 { c8 c c c c c }
749 For more information about @code{make-moment}, see
750 @ref{Time administration}.
752 The format of the number is determined by the property @code{text} in
753 @code{TupletNumber}. The default prints only the denominator, but if
754 it is set to the function @code{tuplet-number::calc-fraction-text},
755 @var{num}:@var{den} will be printed instead.
757 To avoid printing tuplet numbers, use
759 @lilypond[quote,fragment,relative=2,ragged-right,verbatim]
760 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
761 \override TupletNumber #'transparent = ##t
762 \times 2/3 { c8 c c } \times 2/3 { c8 c c }
765 Use the @code{\tweak} function to override nested tuplets beginning at the
766 same music moment. In this example, @code{\tweak} specifies fraction
768 outer @code{TupletNumber} and denominator text for the @code{TupletNumber}
769 of the first of the three inner tuplets.
771 @lilypond[quote,ragged-right,verbatim]
773 \tweak #'text #tuplet-number::calc-fraction-text
775 \tweak #'text #tuplet-number::calc-denominator-text
776 \times 2/3 { c'8[ c'8 c'8] }
777 \times 2/3 { c'8[ c'8 c'8] }
778 \times 2/3 { c'8[ c'8 c'8] }
783 Here @code{\tweak} and @code{\override} work together to specify
784 @code{TupletBracket} direction. The first @code{\tweak} positions
785 the @code{TupletBracket} of the outer
786 tuplet above the staff. The second @code{\tweak} positions the
787 @code{TupletBracket} of the first of the three inner tuplets below the
788 staff. Note that this pair of @code{\tweak} functions affects only
789 the outer tuplet and the first of the three inner tuplets because only
790 those two tuplets begin at the same music moment. We use @code{\override}
791 in the usual way to position the @code{TupletBrackets} of
792 the second and third of the inner tuplets below the staff.
794 @lilypond[quote,ragged-right,verbatim]
796 \tweak #'text #tuplet-number::calc-fraction-text
797 \tweak #'direction #up
799 \tweak #'direction #down
800 \times 2/3 { c'8[ c'8 c'8] }
801 \override TupletBracket #'direction = #down
802 \times 2/3 { c'8[ c'8 c'8] }
803 \times 2/3 { c'8[ c'8 c'8] }
808 Tuplet brackets can be made to run to prefatory matter or
811 @lilypond[ragged-right]
813 \set tupletFullLength = ##t
818 \set tupletFullLengthNote = ##t
831 Program reference: @internalsref{TupletBracket},
832 @internalsref{TupletNumber}, and @internalsref{TimeScaledMusic}.
836 @node Scaling durations
837 @subsection Scaling durations
839 You can alter the length of duration by a fraction @var{N/M}
840 appending @samp{*@var{N/M}} (or @samp{*@var{N}} if @var{M=1}). This
841 will not affect the appearance of the notes or rests produced. These
842 may be combined such as @samp{*M*N}.
844 In the following example, the first three notes take up exactly two
845 beats, but no triplet bracket is printed.
847 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
849 a4*2/3 gis4*2/3 a4*2/3
857 This manual: @ref{Tuplets}.
861 @subsection Bar check
864 @funindex barCheckSynchronize
867 Bar checks help detect errors in the durations. A bar check is
868 entered using the bar symbol, @samp{|}. Whenever it is encountered
869 during interpretation, it should fall on a measure boundary. If it
870 does not, a warning is printed. In the next example, the second bar
871 check will signal an error
873 \time 3/4 c2 e4 | g2 |
876 Bar checks can also be used in lyrics, for example
881 Twin -- kle | Twin -- kle
885 Failed bar checks are caused by entering incorrect
886 durations. Incorrect durations often completely garble up the score,
887 especially if the score is polyphonic, so a good place to start correcting
888 input is by scanning for failed bar checks and incorrect durations.
893 It is also possible to redefine the meaning of @code{|}. This is done
894 by assigning a music expression to @code{pipeSymbol},
896 @lilypond[quote,ragged-right,verbatim]
897 pipeSymbol = \bar "||"
903 @node Barnumber check
904 @subsection Barnumber check
906 When copying large pieces of music, it can be helpful to check that
907 the LilyPond bar number corresponds to the original that you are
908 entering from. This can be checked with @code{\barNumberCheck}, for
916 will print a warning if the @code{currentBarNumber} is not 123 when it
920 @node Automatic note splitting
921 @subsection Automatic note splitting
923 Long notes can be converted automatically to tied notes. This is done
924 by replacing the @internalsref{Note_heads_engraver} by the
925 @internalsref{Completion_heads_engraver}.
926 In the following examples, notes crossing the bar line are split and tied.
928 @lilypond[quote,fragment,verbatim,relative=1,line-width=12\cm]
930 \remove "Note_heads_engraver"
931 \consists "Completion_heads_engraver"
933 c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2
937 This engraver splits all running notes at the bar line, and inserts
938 ties. One of its uses is to debug complex scores: if the measures are
939 not entirely filled, then the ties exactly show how much each measure
942 If you want to allow line breaking on the bar lines where
943 @internalsref{Completion_heads_engraver} splits notes, you must
944 also remove @internalsref{Forbid_line_break_engraver}.
949 Not all durations (especially those containing tuplets) can be
950 represented exactly with normal notes and dots, but the engraver will
953 @code{Completion_heads_engraver} only affects notes; it does not split
959 Program reference: @internalsref{Completion_heads_engraver}.
965 Polyphony in music refers to having more than one voice occurring in
966 a piece of music. Polyphony in LilyPond refers to having more than
967 one voice on the same staff.
973 * Explicitly instantiating voices::
974 * Collision Resolution::
983 A chord is formed by a enclosing a set of pitches between @code{<}
984 and @code{>}. A chord may be followed by a duration, and a set of
985 articulations, just like simple notes
987 @lilypond[verbatim,ragged-right,fragment,quote,relative=1]
991 For more information about chords, see @ref{Chord names}.
997 Whenever a note is found, a @internalsref{Stem} object is created
998 automatically. For whole notes and rests, they are also created but
1007 @funindex \stemNeutral
1008 @code{\stemNeutral}.
1013 To change the direction of stems in the middle of the staff, use
1015 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1017 \override Stem #'neutral-direction = #up
1019 \override Stem #'neutral-direction = #down
1024 @node Basic polyphony
1025 @subsection Basic polyphony
1029 The easiest way to enter fragments with more than one voice on a staff
1030 is to enter each voice as a sequence (with @code{@{...@}}), and combine
1031 them simultaneously, separating the voices with @code{\\}
1035 @lilypond[quote,verbatim,fragment]
1036 \new Staff \relative c' {
1039 { g4 f e | d2 e2 } \\
1040 { r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
1046 The separator causes @internalsref{Voice} contexts@footnote{Polyphonic
1047 voices are sometimes called @q{layers} in other notation packages}
1049 to be instantiated. They bear the names @code{"1"}, @code{"2"}, etc. In
1050 each of these contexts, vertical direction of slurs, stems, etc., is set
1053 These voices are all separate from the voice that contains the notes just
1054 outside the @code{<< \\ >>} construct. This should be noted when making
1055 changes at the voice level. This also means that slurs and ties cannot go
1056 into or out of a @code{<< \\ >>} construct. Conversely, parallel voices
1057 from separate @code{<< \\ >>} constructs on the same staff are the
1058 same voice. Here is the same example, with different noteheads for each
1059 voice. Note that the change to the note-head style in the main voice does
1061 the inside of the @code{<< \\ >>} constructs. Also, the change to the
1063 voice in the first @code{<< \\ >>} construct is effective in the second
1064 @code{<< \\ >>}, and the voice is tied across the two constructs.
1066 @cindex note heads, styles
1068 @lilypond[quote,verbatim,fragment]
1069 \new Staff \relative c' {
1070 \override NoteHead #'style = #'cross
1074 { \override NoteHead #'style = #'triangle
1079 { c8 b16 a b8 g ~ g2 } \\
1080 { \override NoteHead #'style = #'slash s4 b4 c2 }
1085 Polyphony does not change the relationship of notes within a
1086 @code{\relative @{ @}} block. Each note is calculated relative
1087 to the note immediately preceding it.
1090 \relative @{ noteA << noteB \\ noteC >> noteD @}
1093 @code{noteC} is relative to @code{noteB}, not @code{noteA};
1094 @code{noteD} is relative to @code{noteC}, not @code{noteB} or
1098 @node Explicitly instantiating voices
1099 @subsection Explicitly instantiating voices
1101 @internalsref{Voice} contexts can also be instantiated manually
1102 inside a @code{<< >>} block to create polyphonic music, using
1103 @code{\voiceOne}, up to @code{\voiceFour} to assign stem directions
1104 and a horizontal shift for each part.
1108 << \upper \\ \lower >>
1116 \new Voice = "1" @{ \voiceOne \upper @}
1117 \new Voice = "2" @{ \voiceTwo \lower @}
1121 The @code{\voiceXXX} commands set the direction of stems, slurs, ties,
1122 articulations, text annotations, augmentation dots of dotted
1123 notes, and fingerings. @code{\voiceOne} and @code{\voiceThree} make
1124 these objects point upwards, while @code{\voiceTwo} and @code{\voiceFour}
1125 make them point downwards.
1126 The command @code{\oneVoice} will revert back to the normal setting.
1128 An expression that appears directly inside a @code{<< >>} belongs to
1129 the main voice. This is useful when extra voices appear while the main
1130 voice is playing. Here is a more correct rendition of the example from
1131 the previous section. The crossed noteheads demonstrate that the main
1132 melody is now in a single voice context.
1134 @lilypond[quote,ragged-right,verbatim]
1135 \new Staff \relative c' {
1136 \override NoteHead #'style = #'cross
1141 \new Voice="1" { \voiceTwo
1142 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1145 \new Voice { \voiceThree
1154 The correct definition of the voices allows the melody to be slurred.
1155 @lilypond[quote,ragged-right,verbatim]
1156 \new Staff \relative c' {
1161 \context Voice="1" { \voiceTwo
1162 r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
1165 \new Voice { \voiceThree
1174 Avoiding the @code{\\} separator also allows nesting polyphony
1175 constructs, which in some case might be a more natural way to typeset
1178 @lilypond[quote,ragged-right,verbatim]
1179 \new Staff \relative c' {
1184 \context Voice="1" { \voiceTwo
1187 {c8 b16 a b8 g ~ g2}
1188 \new Voice { \voiceThree
1200 In some instances of complex polyphonic music, you may need additional
1201 voices to avoid collisions between notes. Additional voices are added
1202 by defining an identifier, as shown below:
1204 @lilypond[quote,verbatim,ragged-right,relative=2]
1205 voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
1208 { \voiceOne g4 ~ \stemDown g32[ f( es d c b a b64 )g] } \\
1209 { \voiceThree b4} \\
1216 @node Collision Resolution
1217 @subsection Collision Resolution
1219 Normally, note heads with a different number of dots are not merged, but
1220 when the object property @code{merge-differently-dotted} is set in
1221 the @internalsref{NoteCollision} object, they are merged:
1223 @lilypond[quote,verbatim,fragment,ragged-right,relative=2]
1226 \override Staff.NoteCollision
1227 #'merge-differently-dotted = ##t
1229 } \\ { g8.[ f16] g8.[ f16] } >>
1232 Similarly, you can merge half note heads with eighth notes, by setting
1233 @code{merge-differently-headed}:
1235 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
1238 \override Staff.NoteCollision
1239 #'merge-differently-headed = ##t
1240 c8 c4. } \\ { c2 c2 } >>
1244 @code{merge-differently-headed} and @code{merge-differently-dotted}
1245 only apply to opposing stem directions (ie. Voice 1 & 2).
1247 LilyPond also vertically shifts rests that are opposite of a stem,
1250 @lilypond[quote,ragged-right,fragment,verbatim]
1251 \new Voice << c''4 \\ r4 >>
1254 If three or more notes line up in the same column,
1255 @code{merge-differently-headed} cannot
1256 successfully complete the merge of the two notes that should be merged.
1257 To allow the merge to work properly, apply a @code{\shift} to the note that
1258 should not be merged. In the first measure of following example,
1259 @code{merge-differently-headed} does not work (the half-note head is
1260 solid). In the second measure, @code{\shiftOn} is applied to move the
1261 top @code{g} out of the column, and @code{merge-differently-headed}
1264 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1265 \override Staff.NoteCollision #'merge-differently-headed = ##t
1268 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
1269 { \voiceFour e,,2 e'2}
1272 { d'=''2 \shiftOn g2 } \\
1273 { \oneVoice d=''8 c8 r4 e,8 c'8 r4 } \\
1274 { \voiceFour e,,2 e'2}
1287 @funindex \voiceThree
1289 @funindex \voiceFour
1296 @funindex \shiftOnnn
1299 @code{\shiftOff}: these commands specify the
1300 degree to which chords of the current voice should be shifted.
1301 The outer voices (normally: voice one and
1302 two) have @code{\shiftOff}, while the inner voices (three and four)
1303 have @code{\shiftOn}. @code{\shiftOnn} and @code{\shiftOnnn} define
1304 further shift levels.
1306 When LilyPond cannot cope, the @code{force-hshift}
1307 property of the @internalsref{NoteColumn} object and pitched rests can
1308 be used to override typesetting decisions.
1310 @lilypond[quote,verbatim,ragged-right]
1317 \once \override NoteColumn #'force-hshift = #1.7
1325 Program reference: the objects responsible for resolving collisions are
1326 @internalsref{NoteCollision} and @internalsref{RestCollision}.
1331 When using @code{merge-differently-headed} with an upstem eighth or a
1332 shorter note, and a downstem half note, the eighth note gets the wrong
1335 There is no support for clusters where the same note occurs with
1336 different accidentals in the same chord. In this case, it is
1337 recommended to use enharmonic transcription, or to use special cluster
1338 notation (see @ref{Clusters}).
1342 @node Staff notation
1343 @section Staff notation
1345 @cindex Staff notation
1347 This section describes music notation that occurs on staff level,
1348 such as key signatures, clefs and time signatures.
1354 * Partial measures::
1357 * System start delimiters::
1359 * Writing music in parallel::
1368 The clef indicates which lines of the staff correspond to which
1369 pitches. The clef is set with the @code{\clef} command
1371 @lilypond[quote,ragged-right,fragment,verbatim]
1372 { c''2 \clef alto g'2 }
1381 @cindex soprano clef
1382 @cindex mezzosoprano clef
1383 @cindex baritone clef
1384 @cindex varbaritone clef
1385 @cindex subbass clef
1387 Supported clefs include
1389 @multitable @columnfractions .33 .66
1390 @headitem Clef @tab Position
1391 @item @code{treble}, violin, G, G2 @tab
1393 @item @code{alto, C} @tab
1395 @item @code{tenor} @tab
1397 @item @code{bass, F} @tab
1399 @item @code{french} @tab
1400 G clef on 1st line, so-called French violin clef
1401 @item @code{soprano} @tab
1403 @item @code{mezzosoprano} @tab
1405 @item @code{baritone} @tab
1407 @item @code{varbaritone} @tab
1409 @item @code{subbass} @tab
1411 @item @code{percussion} @tab
1413 @item @code{tab} @tab
1417 By adding @code{_8} or @code{^8} to the clef name, the clef is
1418 transposed one octave down or up, respectively, and @code{_15} and
1419 @code{^15} transposes by two octaves. The argument @var{clefname}
1420 must be enclosed in quotes when it contains underscores or digits. For
1423 @cindex choral tenor clef
1424 @lilypond[quote,ragged-right,verbatim,fragment,relative=1]
1431 The command @code{\clef "treble_8"} is equivalent to setting
1433 @code{clefPosition} (which controls the Y position of the clef),
1434 @code{middleCPosition} and @code{clefOctavation}. A clef is printed
1435 when any of these properties are changed. The following example shows
1436 possibilities when setting properties manually.
1438 @lilypond[quote,ragged-right,verbatim]
1440 \set Staff.clefGlyph = #"clefs.F"
1441 \set Staff.clefPosition = #2
1443 \set Staff.clefGlyph = #"clefs.G"
1445 \set Staff.clefGlyph = #"clefs.C"
1447 \set Staff.clefOctavation = #7
1449 \set Staff.clefOctavation = #0
1450 \set Staff.clefPosition = #0
1454 \set Staff.middleCPosition = #4
1462 Manual: @ref{Grace notes}.
1464 Program reference: @internalsref{Clef}.
1468 @subsection Key signature
1470 @cindex Key signature
1473 The key signature indicates the tonality in which a piece is played. It
1474 is denoted by a set of alterations (flats or sharps) at the start of the
1477 Setting or changing the key signature is done with the @code{\key}
1481 @code{\key} @var{pitch} @var{type}
1490 @funindex \mixolydian
1494 @cindex church modes
1496 Here, @var{type} should be @code{\major} or @code{\minor} to get
1497 @var{pitch}-major or @var{pitch}-minor, respectively. You may also
1498 use the standard mode names (also called @q{church modes}): @code{\ionian},
1499 @code{\locrian}, @code{\aeolian}, @code{\mixolydian}, @code{\lydian},
1500 @code{\phrygian}, and @code{\dorian}.
1502 This command sets the context property
1503 @code{Staff.keySignature}. Non-standard key signatures
1504 can be specified by setting this property directly.
1506 Accidentals and key signatures often confuse new users, because
1507 unaltered notes get natural signs depending on the key signature. For
1508 more information, see @ref{Accidentals}, or @ref{Accidentals and key signatures}.
1510 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
1519 A natural sign is printed to cancel any previous accidentals. This
1520 can be suppressed by setting the @code{Staff.printKeyCancellation}
1523 @lilypond[quote,fragment,ragged-right,fragment,verbatim,relative=2]
1528 \set Staff.printKeyCancellation = ##f
1538 Program reference: @internalsref{KeyCancellation},
1539 @internalsref{KeySignature}.
1542 @node Time signature
1543 @subsection Time signature
1545 @cindex Time signature
1549 Time signature indicates the metrum of a piece: a regular pattern of
1550 strong and weak beats. It is denoted by a fraction at the start of the
1553 The time signature is set with the @code{\time} command
1555 @lilypond[quote,ragged-right,fragment,verbatim]
1556 \time 2/4 c'2 \time 3/4 c'2.
1561 The symbol that is printed can be customized with the @code{style}
1562 property. Setting it to @code{#'()} uses fraction style for 4/4 and
1565 @lilypond[fragment,quote,ragged-right,verbatim]
1568 \override Staff.TimeSignature #'style = #'()
1573 There are many more options for its layout. See @ref{Ancient time
1574 signatures}, for more examples.
1576 @code{\time} sets the property @code{timeSignatureFraction},
1577 @code{beatLength} and @code{measureLength} in the @code{Timing}
1578 context, which is normally aliased to @internalsref{Score}. The
1579 property @code{measureLength} determines where bar lines should be
1580 inserted, and how automatic beams should be generated. Changing the
1581 value of @code{timeSignatureFraction} also causes the symbol to be
1584 More options are available through the Scheme function
1585 @code{set-time-signature}. In combination with the
1586 @internalsref{Measure_grouping_engraver}, it will create
1587 @internalsref{MeasureGrouping} signs. Such signs ease reading
1588 rhythmically complex modern music. In the following example, the 9/8
1589 measure is subdivided in 2, 2, 2 and 3. This is passed to
1590 @code{set-time-signature} as the third argument @code{(2 2 2 3)}
1592 @lilypond[quote,ragged-right,verbatim]
1595 #(set-time-signature 9 8 '(2 2 2 3))
1596 g8[ g] d[ d] g[ g] a8[( bes g]) |
1597 #(set-time-signature 5 8 '(3 2))
1603 \consists "Measure_grouping_engraver"
1612 Program reference: @internalsref{TimeSignature}, and
1613 @internalsref{Timing_translator}.
1615 Examples: @lsr{contemporary,compound-time-signature.ly}.
1620 Automatic beaming does not use the measure grouping specified with
1621 @code{set-time-signature}.
1624 @node Partial measures
1625 @subsection Partial measures
1629 @cindex partial measure
1630 @cindex measure, partial
1631 @cindex shorten measures
1634 Partial measures, such as an anacrusis or upbeat, are entered using the
1636 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
1637 \partial 16*5 c16 cis d dis e | a2. c,4 | b2
1640 The syntax for this command is
1643 \partial @var{duration}
1646 where @code{duration} is the rhythmic length to be added before
1649 This is internally translated into
1652 \set Timing.measurePosition = -@var{length of duration}
1655 The property @code{measurePosition} contains a rational number
1656 indicating how much of the measure has passed at this point. Note
1657 that this is a negative number; @code{\partial 4} is internally
1658 translated to mean @qq{there is a quarter note left in the bar.}
1663 This command does not take into account grace notes at the start of
1664 the music. When a piece starts with graces notes in the pickup, then
1665 the @code{\partial} should follow the grace notes
1667 @lilypond[verbatim,quote,ragged-right,relative,fragment]
1674 @code{\partial} is only intended to be used at the beginning of a
1675 piece. If you use it after the beginning, some odd warnings may
1680 @subsection Bar lines
1684 @cindex measure lines
1687 Bar lines delimit measures, but are also used to indicate
1688 repeats. Normally they are inserted automatically. Line
1689 breaks may only happen on bar lines.
1691 Special types of bar lines can be forced with the @code{\bar} command
1693 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
1697 The following bar types are available
1699 @lilypondfile[ragged-right,quote]{bar-lines.ly}
1701 In addition, you can specify @code{"||:"}, which is equivalent to
1702 @code{"|:"} except at line breaks, where it gives a double bar line at
1703 the end of the line and a start repeat at the beginning of the next
1706 To allow a line break where there is no visible bar line, use
1713 This will insert an invisible bar line and allow line breaks at this
1714 point (without increasing the bar number counter).
1716 In scores with many staves, a @code{\bar} command in one staff is
1717 automatically applied to all staves. The resulting bar lines are
1718 connected between different staves of a @code{StaffGroup},
1719 @code{PianoStaff}, or @code{GrandStaff}.
1721 @lilypond[quote,ragged-right,fragment,verbatim]
1729 \new Staff { \clef bass c4 g e g }
1731 \new Staff { \clef bass c2 c2 }
1739 @funindex repeatCommands
1740 @funindex defaultBarType
1742 The command @code{\bar }@var{bartype} is a short cut for doing
1743 @code{\set Timing.whichBar = }@var{bartype}. Whenever @code{whichBar}
1744 is set to a string, a bar line of that type is created.
1746 A bar line is created whenever the @code{whichBar} property is set.
1747 At the start of a measure it is set to the contents of
1748 @code{Timing.defaultBarType}. The contents of @code{repeatCommands} are
1750 to override default measure bars.
1752 You are encouraged to use @code{\repeat} for repetitions. See
1758 In this manual: @ref{Repeats}, @ref{System start delimiters}.
1760 Program reference: @internalsref{BarLine} (created at
1761 @internalsref{Staff} level), @internalsref{SpanBar} (across staves).
1764 @node Unmetered music
1765 @subsection Unmetered music
1768 @funindex \cadenzaOn
1769 @funindex \cadenzaOff
1771 Bar lines and bar numbers are calculated automatically. For unmetered
1772 music (cadenzas, for example), this is not desirable. To turn off
1773 automatic bar lines and bar numbers, use the commands @code{\cadenzaOn}
1774 and @code{\cadenzaOff}.
1776 @lilypond[verbatim,quote,ragged-right,relative=2,fragment]
1788 LilyPond will only insert line breaks and page breaks at a
1789 barline. Unless the unmetered music ends before the end of
1790 the staff line, you will need to insert
1798 to indicate where breaks can occur.
1801 @node System start delimiters
1802 @subsection System start delimiters
1804 @cindex start of system
1805 @cindex Staff, multiple
1806 @cindex bracket, vertical
1807 @cindex brace, vertical
1810 @cindex staff, choir
1812 Many scores consist of more than one staff. These staves can be
1813 joined in four different ways
1816 @item The group is started with a brace at the left, and bar lines are
1817 connected. This is done with the @internalsref{GrandStaff} context.
1819 @lilypond[verbatim,ragged-right,quote]
1827 @item The group is started with a bracket, and bar lines are connected.
1828 This is done with the
1829 @internalsref{StaffGroup} context
1831 @lilypond[verbatim,ragged-right,quote]
1839 @item The group is started with a bracket, but bar lines are not
1840 connected. This is done with the @internalsref{ChoirStaff} context.
1842 @lilypond[verbatim,ragged-right,quote]
1850 @item The group is started with a vertical line. Bar lines are not
1851 connected. This is the default for the score.
1853 @lilypond[verbatim,ragged-right,quote]
1864 The bar lines at the start of each system are
1865 @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and
1866 @internalsref{SystemStartBracket}. Only one of these types is created
1867 in every context, and that type is determined by the property
1868 @code{systemStartDelimiter}.
1873 System start delimiters may be deeply nested,
1875 @lilypond[quote,ragged-right,verbatim]
1878 \set StaffGroup.systemStartDelimiterHierarchy
1879 = #'(SystemStartSquare (SystemStartBracket a (SystemStartSquare b)) d)
1890 @subsection Staff symbol
1892 @cindex adjusting staff symbol
1894 Notes, dynamic signs, etc., are grouped
1895 with a set of horizontal lines, called a staff (plural @q{staves}). In
1896 LilyPond, these lines are drawn using a separate layout object called
1897 @code{staff symbol}.
1899 The staff symbol may be tuned in the number, thickness and distance
1900 of lines, using properties. This is demonstrated in the example files
1901 @lsr{staff,changing-the-number-of-lines-in-a-staff.ly} and
1902 @lsr{staff,changing-the-staff-size.ly}.
1904 In addition, staves may be started and stopped at will. This is done
1905 with @code{\startStaff} and @code{\stopStaff}.
1907 @lilypond[verbatim,relative=2,fragment]
1909 \override Staff.StaffSymbol #'line-count = 2
1910 \stopStaff \startStaff
1912 \revert Staff.StaffSymbol #'line-count
1913 \stopStaff \startStaff
1917 In combination with Frenched staves, this may be used to typeset ossia
1918 sections. An example is shown here
1922 @lilypondfile{ossia.ly}
1924 @cindex staff lines, setting number of
1925 @cindex staff lines, setting thickness of
1926 @cindex thickness of staff lines, setting
1927 @cindex number of staff lines, setting
1931 Program reference: @internalsref{StaffSymbol}.
1933 Examples: @lsrdir{staff}
1936 @node Writing music in parallel
1937 @subsection Writing music in parallel
1939 @cindex Writing music in parallel
1940 @cindex Interleaved music
1942 Music for multiple parts can be interleaved
1944 @lilypond[quote,fragment,verbatim]
1945 \parallelMusic #'(voiceA voiceB) {
1946 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c'' e''] |
1948 r8 a'16[ d''] f''[ a' d'' f''] r8 a'16[ d''] f''[ a' d'' f''] |
1952 \new Staff \new Voice \voiceA
1953 \new Staff \new Voice \voiceB
1957 This works quite well for piano music
1959 @lilypond[quote,verbatim]
1963 \parallelMusic #'(voiceA voiceB voiceC voiceD) {
1965 r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c''
1968 r8 a16[ d'] f'[ a d' f'] r8 a16[ d'] f'[ a d' f'] |
1972 a'8 b' c'' d'' e'' f'' g'' a'' |
1974 c16 d e f d e f g e f g a f g a b |
2000 @node Connecting notes
2001 @section Connecting notes
2003 This section deals with notation that affects groups of notes.
2009 * Laissez vibrer ties::
2022 A tie connects two adjacent note heads of the same pitch. The tie in
2023 effect extends the length of a note. Ties should not be confused with
2024 slurs, which indicate articulation, or phrasing slurs, which indicate
2025 musical phrasing. A tie is entered using the tilde symbol @samp{~}
2027 @lilypond[quote,ragged-right,fragment,verbatim]
2028 e' ~ e' <c' e' g'> ~ <c' e' g'>
2031 When a tie is applied to a chord, all note heads whose pitches match
2032 are connected. When no note heads match, no ties will be created. Chords
2033 may be partially tied by placing the tie inside the chord,
2035 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2036 <c~ e g~ b> <c e g b>
2039 A tie is just a way of extending a note duration, similar to the
2040 augmentation dot. The following example shows two ways of notating
2041 exactly the same concept
2043 @lilypond[quote,fragment,ragged-right]
2044 \time 3/4 c'2. c'2 ~ c'4
2048 Ties are used either when the note crosses a bar line, or when dots
2049 cannot be used to denote the rhythm. When using ties, larger note
2050 values should be aligned to subdivisions of the measure, such as
2052 @lilypond[fragment,quote,ragged-right]
2054 r8 c8 ~ c2 r4 | r8^"not" c2 ~ c8 r4
2058 If you need to tie a lot of notes over bars, it may be easier to use
2059 automatic note splitting (see @ref{Automatic note splitting}). This
2060 mechanism automatically splits long notes, and ties them across bar
2063 @funindex \repeatTie
2065 When a second alternative of a repeat starts with a tied note, you
2066 have to repeat the tie. This can be achieved with @code{\repeatTie},
2068 @lilypond[fragment,quote,ragged-right,relative=2]
2072 @cindex repeating ties
2073 @cindex volta brackets and ties
2077 Ties are sometimes used to write out arpeggios. In this case, two tied
2078 notes need not be consecutive. This can be achieved by setting the
2079 @code{tieWaitForNote} property to true. The same feature is also useful,
2080 for example, to tie a tremolo to a chord. For example,
2082 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
2083 \set tieWaitForNote = ##t
2084 \grace { c16[~ e~ g]~ } <c, e g>2
2085 \repeat "tremolo" 8 { c32~ c'~ } <c c,>1
2086 e8~ c~ a~ f~ <e' c a f>2
2089 Ties may be engraved manually by changing the @code{tie-configuration}
2090 property. The first number indicates the distance from the center
2091 of the staff in staff-spaces, and the second number indicates the
2092 direction (1=up, -1=down).
2094 @lilypond[fragment,verbatim,relative=1,ragged-right,quote]
2096 \override TieColumn #'tie-configuration =
2097 #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1))
2109 @funindex \tieNeutral
2111 @funindex \tieDotted
2113 @funindex \tieDashed
2121 In this manual: @ref{Automatic note splitting}.
2123 Program reference: @internalsref{Tie}.
2128 Switching staves when a tie is active will not produce a slanted tie.
2130 Changing clefs or octavations during a tie is not really
2131 well-defined. In these cases, a slur may be preferable.
2139 A slur indicates that notes are to be played bound or
2140 @emph{legato}. They are entered using parentheses
2142 @lilypond[quote,ragged-right,relative=2,fragment,verbatim]
2143 f( g a) a8 b( a4 g2 f4)
2147 The direction of a slur can be specified with
2148 @code{\slur@emph{DIR}}, where @code{@emph{DIR}} is
2149 either @code{Up}, @code{Down}, or @code{Neutral} (automatically
2152 However, there is a convenient shorthand for forcing slur
2153 directions. By adding @code{_} or @code{^} before the opening
2154 parentheses, the direction is also set. For example,
2156 @lilypond[relative=2,ragged-right,quote,verbatim,fragment]
2160 Only one slur can be printed at once. If you need to print a long
2161 slur over a few small slurs, please see @ref{Phrasing slurs}.
2166 Some composers write two slurs when they want legato chords. This can
2167 be achieved in LilyPond by setting @code{doubleSlurs},
2169 @lilypond[verbatim,ragged-right,relative,fragment,quote]
2170 \set doubleSlurs = ##t
2171 <c e>4 ( <d f> <c e> <d f> )
2181 @funindex \slurNeutral
2182 @code{\slurNeutral},
2183 @funindex \slurDashed
2185 @funindex \slurDotted
2187 @funindex \slurSolid
2192 Program reference: @seeinternals{Slur}.
2195 @node Phrasing slurs
2196 @subsection Phrasing slurs
2198 @cindex phrasing slurs
2199 @cindex phrasing marks
2201 A phrasing slur (or phrasing mark) connects notes and is used to
2202 indicate a musical sentence. It is written using @code{\(} and @code{\)}
2205 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2206 \time 6/4 c'\( d( e) f( e) d\)
2209 Typographically, the phrasing slur behaves almost exactly like a
2210 normal slur. However, they are treated as different objects. A
2211 @code{\slurUp} will have no effect on a phrasing slur; instead, use
2212 @code{\phrasingSlurUp}, @code{\phrasingSlurDown}, and
2213 @code{\phrasingSlurNeutral}.
2215 You cannot have simultaneous phrasing slurs.
2220 @funindex \phrasingSlurUp
2221 @code{\phrasingSlurUp},
2222 @funindex \phrasingSlurDown
2223 @code{\phrasingSlurDown},
2224 @funindex \phrasingSlurNeutral
2225 @code{\phrasingSlurNeutral}.
2230 Program reference: @internalsref{PhrasingSlur}.
2233 @node Laissez vibrer ties
2234 @subsection Laissez vibrer ties
2235 @cindex Laissez vibrer
2236 @cindex Ties, laissez vibrer
2238 L.v. ties (laissez vibrer) indicate that notes must not be damped at the
2239 end. It is used in notation for piano, harp and other string and
2240 percussion instruments. They can be entered using @code{\laissezVibrer},
2242 @lilypond[fragment,ragged-right,verbatim,relative=1]
2243 <c f g>\laissezVibrer
2249 @internalsref{LaissezVibrerTie}
2250 @internalsref{LaissezVibrerTieColumn}
2253 @lsr{connecting,laissez-vibrer-ties.ly}
2256 @node Automatic beams
2257 @subsection Automatic beams
2259 LilyPond inserts beams automatically
2261 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2262 \time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
2265 When these automatic decisions are not good enough, beaming can be
2266 entered explicitly. It is also possible to define beaming patterns
2267 that differ from the defaults. See @ref{Setting automatic beam behavior},
2270 Individual notes may be marked with @code{\noBeam} to prevent them
2273 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2274 \time 2/4 c8 c\noBeam c c
2280 Program reference: @internalsref{Beam}.
2284 @subsection Manual beams
2286 @cindex beams, manual
2290 In some cases it may be necessary to override the automatic beaming
2291 algorithm. For example, the autobeamer will not put beams over rests
2292 or bar lines. Such beams are specified manually by marking the begin
2293 and end point with @code{[} and @code{]}
2295 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2297 r4 r8[ g' a r8] r8 g[ | a] r8
2304 @funindex stemLeftBeamCount
2305 @funindex stemRightBeamCount
2308 LilyPond can automatically determine beaming patterns within a beam,
2309 but this automatic behavior can sometimes produce odd results;
2310 therefore the @code{stemLeftBeamCount} and @code{stemRightBeamCount} properties can
2311 be used to override the defaults. If
2312 either property is set, its value will be used only once, and then it
2315 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2320 \set stemLeftBeamCount = #1
2325 The property @code{subdivideBeams} can be set in order to subdivide
2326 all 16th or shorter beams at beat positions, as defined by the
2327 @code{beatLength} property.
2329 @lilypond[fragment,quote,relative=2,verbatim]
2331 \set subdivideBeams = ##t
2333 \set Score.beatLength = #(ly:make-moment 1 8)
2336 @funindex subdivideBeams
2339 For more information about @code{make-moment}, see
2340 @ref{Time administration}.
2342 Line breaks are normally forbidden when beams cross bar lines. This
2343 behavior can be changed by setting @code{breakable}.
2347 @cindex beams and line breaks
2348 @cindex beams, kneed
2350 @cindex auto-knee-gap
2352 Kneed beams are inserted automatically when a large gap is detected
2353 between the note heads. This behavior can be tuned through the
2354 @code{auto-knee-gap} object.
2359 Automatically kneed cross-staff beams cannot be used together with
2360 hidden staves. See @ref{Hiding staves}.
2362 @c Is this still true with skyline spacing stuff? -J.Mandereau
2363 Beams do not avoid collisions with symbols around the notes, such as
2364 texts and accidentals.
2368 @subsection Grace notes
2373 @cindex appoggiatura
2374 @cindex acciaccatura
2376 Grace notes are ornaments that are written out. The most common ones
2377 are acciaccatura, which should be played as very short. It is denoted
2378 by a slurred small note with a slashed stem. The appoggiatura is a
2379 grace note that takes a fixed fraction of the main note, and is
2380 denoted as a slurred note in small print without a slash. They
2381 are entered with the commands @code{\acciaccatura} and
2382 @code{\appoggiatura}, as demonstrated in the following example
2384 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2385 b4 \acciaccatura d8 c4 \appoggiatura e8 d4
2386 \acciaccatura { g16[ f] } e4
2389 Both are special forms of the @code{\grace} command. By prefixing this
2390 keyword to a music expression, a new one is formed, which will be
2391 printed in a smaller font and takes up no logical time in a measure.
2393 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2395 \grace { c16[ d16] } c2 c4
2399 Unlike @code{\acciaccatura} and @code{\appoggiatura}, the
2400 @code{\grace} command does not start a slur.
2402 @cindex timing, internal
2404 Internally, timing for grace notes is done using a second, @q{grace}
2405 timing. Every point in time consists of two rational numbers: one
2406 denotes the logical time, one denotes the grace timing. The above
2407 example is shown here with timing tuples
2409 @lilypond[quote,ragged-right]
2412 c4 \grace c16 c4 \grace {
2415 \new Lyrics \lyricmode {
2416 \override LyricText #'font-family = #'typewriter
2420 ( \fraction 1 4 , \fraction -1 16 ) } 16 }
2421 \markup { (\fraction 1 4 , 0 ) } 4
2423 \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16
2424 \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16
2426 \markup { ( \fraction 2 4 , 0 ) }
2431 The placement of grace notes is synchronized between different staves.
2432 In the following example, there are two sixteenth grace notes for
2433 every eighth grace note
2435 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2436 << \new Staff { e4 \grace { c16[ d e f] } e4 }
2437 \new Staff { c4 \grace { g8[ b] } c4 } >>
2440 @funindex \afterGrace
2442 If you want to end a note with a grace, use the @code{\afterGrace}
2443 command. It takes two arguments: the main note, and the grace notes
2444 following the main note.
2446 @lilypond[ragged-right, verbatim,relative=2,fragment]
2447 c1 \afterGrace d1 { c16[ d] } c4
2450 This will put the grace notes after a @q{space} lasting 3/4 of the
2451 length of the main note. The fraction 3/4 can be changed by setting
2452 @code{afterGraceFraction}, ie.
2455 #(define afterGraceFraction (cons 7 8))
2459 will put the grace note at 7/8 of the main note.
2461 The same effect can be achieved manually by doing
2463 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2466 { s2 \grace { c16[ d] } } >>
2472 By adjusting the duration of the skip note (here it is a half-note),
2473 the space between the main-note and the grace is adjusted.
2475 A @code{\grace} music expression will introduce special typesetting settings,
2476 for example, to produce smaller type, and set directions. Hence, when
2477 introducing layout tweaks, they should be inside the grace expression,
2480 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2492 The overrides should also be reverted inside the grace expression.
2494 The layout of grace expressions can be changed throughout the music
2495 using the function @code{add-grace-property}. The following example
2496 undefines the @code{Stem} direction for this grace, so that stems do not
2501 #(add-grace-property 'Voice 'Stem 'direction '())
2507 Another option is to change the variables @code{startGraceMusic},
2508 @code{stopGraceMusic}, @code{startAcciaccaturaMusic},
2509 @code{stopAcciaccaturaMusic}, @code{startAppoggiaturaMusic},
2510 @code{stopAppoggiaturaMusic}. More information is in the file
2511 @file{ly/@/grace@/-init@/.ly}.
2514 The slash through the stem in acciaccaturas can be obtained
2515 in other situations by @code{\override Stem #'stroke-style = #"grace"}.
2520 Grace notes may be forced to use floating spacing,
2522 @lilypond[relative=2,ragged-right]
2524 \override Score.SpacingSpanner #'strict-grace-spacing = ##t
2533 c'16[ c'16 c'16 c'16]
2534 c'16[ c'16 c'16 c'16]
2543 Program reference: @internalsref{GraceMusic}.
2548 A score that starts with a @code{\grace} expression needs an explicit
2549 @code{\new Voice} declaration, otherwise the main note and the grace
2550 note end up on different staves.
2552 Grace note synchronization can also lead to surprises. Staff notation,
2553 such as key signatures, bar lines, etc., are also synchronized. Take
2554 care when you mix staves with grace notes and staves without, for example,
2556 @lilypond[quote,ragged-right,relative=2,verbatim,fragment]
2557 << \new Staff { e4 \bar "|:" \grace c16 d4 }
2558 \new Staff { c4 \bar "|:" d4 } >>
2562 This can be remedied by inserting grace skips of the corresponding
2563 durations in the other staves. For the above example
2566 \new Staff @{ c4 \bar "|:" \grace s16 d4 @}
2569 Grace sections should only be used within sequential music
2570 expressions. Nesting or juxtaposing grace sections is not supported,
2571 and might produce crashes or other errors.
2575 @node Expressive marks
2576 @section Expressive marks
2578 Expressive marks help musicians to bring more to the music than simple
2583 * Fingering instructions::
2594 @subsection Articulations
2596 @cindex Articulations
2600 A variety of symbols can appear above and below notes to indicate
2601 different characteristics of the performance. They are added to a note
2602 by adding a dash and the character signifying the
2603 articulation. They are demonstrated here
2605 @lilypondfile[quote,ragged-right]{script-abbreviations.ly}
2607 The meanings of these shorthands can be changed. See
2608 @file{ly/@/script@/-init@/.ly} for examples.
2610 The script is automatically placed, but the direction can be forced as
2611 well. Like other pieces of LilyPond code, @code{_} will place them
2612 below the staff, and @code{^} will place them above.
2614 @lilypond[quote,ragged-right,fragment,verbatim]
2618 Other symbols can be added using the syntax
2619 @var{note}@code{\}@var{name}. Again, they
2620 can be forced up or down using @code{^} and @code{_},
2623 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
2624 c\fermata c^\fermata c_\fermata
2629 @cindex staccatissimo
2639 @cindex organ pedal marks
2649 @cindex prallmordent
2652 @cindex thumb marking
2657 Here is a chart showing all scripts available,
2659 @lilypondfile[ragged-right,quote]{script-chart.ly}
2664 The vertical ordering of scripts is controlled with the
2665 @code{script-priority} property. The lower this number, the closer it
2666 will be put to the note. In this example, the
2667 @internalsref{TextScript} (the sharp symbol) first has the lowest
2668 priority, so it is put lowest in the first example. In the second, the
2669 prall trill (the @internalsref{Script}) has the lowest, so it is on the
2670 inside. When two objects have the same priority, the order in which
2671 they are entered decides which one comes first.
2673 @lilypond[verbatim,relative=3,ragged-right,fragment,quote]
2674 \once \override TextScript #'script-priority = #-100
2675 a4^\prall^\markup { \sharp }
2677 \once \override Script #'script-priority = #-100
2678 a4^\prall^\markup { \sharp }
2684 Program reference: @internalsref{Script}.
2689 These signs appear in the printed output but have no effect on the
2690 MIDI rendering of the music.
2693 @node Fingering instructions
2694 @subsection Fingering instructions
2697 @cindex finger change
2699 Fingering instructions can be entered using
2701 @var{note}-@var{digit}
2703 For finger changes, use markup texts
2705 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2707 c^\markup { \finger "2 - 3" }
2710 You can use the thumb-script to indicate that a note should be
2711 played with the thumb (e.g., in cello music)
2712 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2713 <a_\thumb a'-3>8 <b_\thumb b'-3>
2716 Fingerings for chords can also be added to individual notes
2717 of the chord by adding them after the pitches
2718 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2719 < c-1 e-2 g-3 b-5 >4
2725 You may exercise greater control over fingering chords by
2726 setting @code{fingeringOrientations}
2728 @lilypond[quote,verbatim,ragged-right,fragment,relative=1]
2729 \set fingeringOrientations = #'(left down)
2730 <c-1 es-2 g-4 bes-5 > 4
2731 \set fingeringOrientations = #'(up right down)
2732 <c-1 es-2 g-4 bes-5 > 4
2735 Using this feature, it is also possible to put fingering instructions
2736 very close to note heads in monophonic music,
2738 @lilypond[verbatim,ragged-right,quote,fragment]
2739 \set fingeringOrientations = #'(right)
2746 Program reference: @internalsref{Fingering}.
2748 Examples: @lsr{expressive,fingering-chords.ly}
2752 @subsection Dynamics
2773 Absolute dynamic marks are specified using a command after a note
2774 @code{c4\ff}. The available dynamic marks are @code{\ppppp},
2775 @code{\pppp}, @code{\ppp},
2776 @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff},
2777 @code{\fff}, @code{\ffff}, @code{\fp}, @code{\sf}, @code{\sff},
2778 @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}.
2780 @lilypond[quote,verbatim,ragged-right,fragment,relative=2]
2781 c\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff
2782 c2\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
2789 A crescendo mark is started with @code{\<} and terminated with
2790 @code{\!} or an absolute dynamic. A decrescendo is started with
2791 @code{\>} and is also terminated with @code{\!} or an absolute
2792 dynamic. @code{\cr} and @code{\decr} may be used instead of
2793 @code{\<} and @code{\>}. Because these marks are bound to notes, you must
2794 use spacer notes if multiple marks are needed during one note
2796 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2798 << f1 { s4 s4\< s4\! \> s4\! } >>
2802 A hairpin normally starts at the left edge of the beginning note
2803 and ends on the right edge of the ending note. If the ending
2804 note falls on the downbeat, the hairpin ends on the immediately
2805 preceding barline. This may be modified by setting the
2806 @code{hairpinToBarline} property,
2808 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2809 \set hairpinToBarline = ##f
2813 In some situations the @code{\espressivo} articulation mark may
2814 be suitable to indicate a crescendo and decrescendo on the one note,
2816 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
2817 c2 b4 a g1\espressivo
2820 This may give rise to very short hairpins. Use @code{minimum-length}
2821 in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for
2825 \override Voice.Hairpin #'minimum-length = #5
2831 Hairpins may be printed with a circled tip (al niente notation) by
2832 setting the @code{circled-tip} property,
2834 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2835 \override Hairpin #'circled-tip = ##t
2845 You can also use text saying @emph{cresc.} instead of hairpins
2847 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
2858 You can also supply your own texts
2859 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2860 \set crescendoText = \markup { \italic "cresc. poco" }
2861 \set crescendoSpanner = #'dashed-line
2865 To create new dynamic marks or text that should be aligned
2866 with dynamics, see @ref{New dynamic marks}.
2868 Vertical positioning of dynamics is handled by
2869 @internalsref{DynamicLineSpanner}.
2874 Dynamics that occur at, begin on, or end on, the same note
2875 will be vertically aligned. If you want to ensure that dynamics
2876 are aligned when they do not occur on the same note, you can
2877 increase the @code{staff-padding} property.
2880 \override DynamicLineSpanner #'staff-padding = #4
2883 You may also use this property if the dynamics are colliding
2884 with other notation.
2886 Crescendi and decrescendi that end on the first note of a
2887 new line are not printed. To change this behavior, use
2890 \override Score.Hairpin #'after-line-breaking = ##t
2893 Text style dynamic changes (such as @emph{cresc.} and @emph{dim.})
2895 dashed line showing their extent. To surpress printing this line, use
2898 \override DynamicTextSpanner #'dash-period = #-1.0
2904 @funindex \dynamicUp
2906 @funindex \dynamicDown
2907 @code{\dynamicDown},
2908 @funindex \dynamicNeutral
2909 @code{\dynamicNeutral}.
2914 Program reference: @internalsref{DynamicText}, @internalsref{Hairpin}.
2915 Vertical positioning of these symbols is handled by
2916 @internalsref{DynamicLineSpanner}.
2920 @subsection Breath marks
2922 Breath marks are entered using @code{\breathe}
2924 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
2931 The glyph of the breath mark can be tuned by overriding the
2932 @code{text} property of the @code{BreathingSign} layout object with
2933 any markup text. For example,
2934 @lilypond[quote,ragged-right,fragment,verbatim,relative=1]
2936 \override BreathingSign #'text
2937 = #(make-musicglyph-markup "scripts.rvarcomma")
2944 Program reference: @internalsref{BreathingSign}.
2946 Examples: @lsr{expressive,breathing-sign.ly}
2952 Short trills are printed like normal articulation; see @ref{Articulations}.
2954 Long running trills are made with @code{\startTrillSpan} and
2955 @code{\stopTrillSpan},
2957 @lilypond[verbatim,ragged-right,relative=2,quote,fragment]
2959 << { c1 \startTrillSpan }
2960 { s2. \grace { d16[\stopTrillSpan e] } } >>
2964 @cindex Pitched trills
2966 Trills that should be executed on an explicitly specified pitch can be
2967 typeset with the command @code{pitchedTrill},
2969 @lilypond[ragged-right,verbatim,fragment,relative=1,quote]
2970 \pitchedTrill c4\startTrillSpan fis
2975 The first argument is the main note. The pitch of the second
2976 is printed as a stemless note head in parentheses.
2981 @code{\startTrillSpan},
2982 @funindex \startTrillSpan
2983 @code{\stopTrillSpan}.
2984 @funindex \stopTrillSpan
2989 Program reference: @internalsref{TrillSpanner}.
2993 @subsection Glissando
2996 @funindex \glissando
2998 A glissando is a smooth change in pitch. It is denoted by a line or a
2999 wavy line between two notes. It is requested by attaching
3000 @code{\glissando} to a note
3002 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
3004 \override Glissando #'style = #'zigzag
3011 Program reference: @internalsref{Glissando}.
3014 @lsr{expressive,glissando.ly}, @lsr{expressive,line-styles.ly}
3020 Printing text over the line (such as @emph{gliss.}) is not supported.
3024 @subsection Arpeggio
3027 @cindex broken chord
3030 You can specify an arpeggio sign (also known as broken chord) on a
3031 chord by attaching an @code{\arpeggio} to a chord
3033 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3037 A square bracket on the left indicates that the player should not
3038 arpeggiate the chord
3040 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3045 The direction of the arpeggio is sometimes denoted by adding an
3046 arrowhead to the wiggly line
3048 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3060 When an arpeggio crosses staves, you may attach an arpeggio to the chords
3061 in both staves and set
3062 @internalsref{PianoStaff}.@code{connectArpeggios}
3064 @lilypond[quote,ragged-right,fragment,relative=1,verbatim]
3066 \set PianoStaff.connectArpeggios = ##t
3067 \new Staff { <c' e g c>\arpeggio }
3068 \new Staff { \clef bass <c,, e g>\arpeggio }
3072 @c TODO: cross-voice arpeggio example?
3073 @c such an example is already in LSR -J.Mandereau
3078 @funindex \arpeggioUp
3080 @funindex \arpeggioDown
3081 @code{\arpeggioDown},
3082 @funindex \arpeggioNeutral
3083 @code{\arpeggioNeutral},
3084 @funindex \arpeggioBracket
3085 @code{\arpeggioBracket}.
3090 Notation manual: @ref{Ties}, for writing out arpeggios.
3092 Program reference: @internalsref{Arpeggio}.
3097 It is not possible to mix connected arpeggios and unconnected
3098 arpeggios in one @internalsref{PianoStaff} at the same point in time.
3101 @node Falls and doits
3102 @subsection Falls and doits
3104 Falls and doits can be added to notes using the @code{\bendAfter}
3107 @lilypond[fragment,ragged-right,relative=2]
3108 \override Score.SpacingSpanner #'shortest-duration-space = #3.0
3117 Repetition is a central concept in music, and multiple notations exist
3123 * Repeats and MIDI::
3124 * Manual repeat commands::
3126 * Tremolo subdivisions::
3132 @subsection Repeat types
3136 The following types of repetition are supported
3140 Repeated music is fully written (played) out. This is useful when
3141 entering repetitious music. This is the only kind of repeat that
3142 is included in MIDI output.
3145 Repeats are not written out, but alternative endings (volte) are
3146 printed, left to right with brackets. This is the standard notation
3147 for repeats with alternatives. These are not played in MIDI output by
3152 Make tremolo beams. These are not played in MIDI output by default.
3155 Make beat or measure repeats. These look like percent signs. These
3156 are not played in MIDI output by default. Percent repeats must be
3157 declared within a @code{Voice} context.
3163 @subsection Repeat syntax
3167 @cindex seconda volta
3170 LilyPond has one syntactic construct for specifying different types of
3171 repeats. The syntax is
3174 \repeat @var{variant} @var{repeatcount} @var{repeatbody}
3177 If you have alternative endings, you may add
3178 @funindex \alternative
3189 where each @var{alternative} is a music expression. If you do not
3190 give enough alternatives for all of the repeats, the first alternative
3191 is assumed to be played more than once.
3193 Standard repeats are used like this
3195 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3197 \repeat volta 2 { c4 d e f }
3198 \repeat volta 2 { f e d c }
3201 With alternative endings
3203 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3205 \repeat volta 2 {c4 d e f}
3206 \alternative { {d2 d} {f f,} }
3209 Repeats with upbeats may be created.
3211 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3214 \repeat volta 4 { c2 d2 | e2 f2 | }
3215 \alternative { { g4 g g e } { a a a a | b2. } }
3222 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3225 \repeat volta 4 { e | c2 d2 | e2 f2 | }
3226 \alternative { { \partial 4*3 g4 g g } { a a a a | b2. } }
3232 @funindex \repeatTie
3234 Ties may be added to a second ending,
3236 @lilypond[quote,ragged-right,fragment,verbatim,relative=2]
3238 \repeat volta 2 {c4 d e f ~ }
3239 \alternative { {f2 d} {f\repeatTie f,} }
3242 It is possible to shorten volta brackets
3243 by setting @code{voltaSpannerDuration}. In the next example, the
3244 bracket only lasts one measure, which is a duration of 3/4.
3246 @lilypond[verbatim,ragged-right,quote]
3250 \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
3251 \repeat "volta" 5 { d d d }
3252 \alternative { { e e e f f f }
3257 If you want to start a repeat at the beginning of a line and have a
3258 double bar at the end of the previous line, use
3260 @dots{} \bar "||:" \break
3261 \repeat volta 2 @{ @dots{}
3263 see @ref{Bar lines} for more information.
3269 Brackets for the repeat are normally only printed over the topmost
3270 staff. This can be adjusted by moving @code{Volta_engraver} to the
3271 Staff context where you want the brackets to appear;
3272 see @ref{Modifying context plug-ins} and
3274 @lsr{repeats,volta@/-multi@/-staff@/.ly}.
3279 @cindex repeat, ambiguous
3281 A nested repeat like
3290 is ambiguous, since it is is not clear to which @code{\repeat} the
3291 @code{\alternative} belongs. This ambiguity is resolved by always
3292 having the @code{\alternative} belong to the inner @code{\repeat}.
3293 For clarity, it is advisable to use braces in such situations.
3295 Timing information is not remembered at the start of an alternative,
3296 so after a repeat timing information must be reset by hand; for
3297 example, by setting @code{Score.measurePosition} or entering
3298 @code{\partial}. Similarly, slurs or ties are also not repeated.
3300 Volta brackets are not vertically aligned.
3303 @node Repeats and MIDI
3304 @subsection Repeats and MIDI
3306 @cindex expanding repeats
3307 @funindex \unfoldRepeats
3309 With a little bit of tweaking, all types of repeats can be present
3310 in the MIDI output. This is achieved by applying the
3311 @code{\unfoldRepeats} music function. This function changes all
3312 repeats to unfold repeats.
3314 @lilypond[quote,verbatim,fragment,line-width=8.0\cm]
3316 \repeat tremolo 8 {c'32 e' }
3317 \repeat percent 2 { c''8 d'' }
3318 \repeat volta 2 {c'4 d' e' f'}
3327 When creating a score file using @code{\unfoldRepeats} for MIDI,
3328 it is necessary to make two @code{\score} blocks: one for MIDI (with
3329 unfolded repeats) and one for notation (with volta, tremolo, and
3330 percent repeats). For example,
3338 \unfoldRepeats @var{..music..}
3344 @node Manual repeat commands
3345 @subsection Manual repeat commands
3347 @funindex repeatCommands
3349 The property @code{repeatCommands} can be used to control the layout of
3350 repeats. Its value is a Scheme list of repeat commands.
3353 @item @code{start-repeat}
3354 Print a @code{|:} bar line.
3356 @item @code{end-repeat}
3357 Print a @code{:|} bar line.
3359 @item @code{(volta @var{text})}
3360 Print a volta bracket saying @var{text}: The text can be specified as
3361 a text string or as a markup text, see @ref{Text markup}. Do not
3362 forget to change the font, as the default number font does not contain
3363 alphabetic characters;
3365 @item @code{(volta #f)}
3366 Stop a running volta bracket.
3369 @lilypond[quote,ragged-right,verbatim,fragment,relative=2]
3371 \set Score.repeatCommands = #'((volta "93") end-repeat)
3373 \set Score.repeatCommands = #'((volta #f))
3380 Program reference: @internalsref{VoltaBracket},
3381 @internalsref{RepeatedMusic},
3382 @internalsref{VoltaRepeatedMusic}, and
3383 @internalsref{UnfoldedRepeatedMusic}.
3386 @node Tremolo repeats
3387 @subsection Tremolo repeats
3389 @cindex tremolo beams
3391 To place tremolo marks between notes, use @code{\repeat} with tremolo
3393 @lilypond[quote,verbatim,ragged-right]
3394 \new Voice \relative c' {
3395 \repeat "tremolo" 8 { c16 d16 }
3396 \repeat "tremolo" 4 { c16 d16 }
3397 \repeat "tremolo" 2 { c16 d16 }
3401 Tremolo marks can also be put on a single note. In this case, the
3402 note should not be surrounded by braces.
3403 @lilypond[quote,verbatim,ragged-right]
3404 \repeat "tremolo" 4 c'16
3407 Similar output is obtained using the tremolo subdivision, described in
3408 @ref{Tremolo subdivisions}.
3413 In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}.
3415 Program reference: @internalsref{Beam}, @internalsref{StemTremolo}.
3418 @node Tremolo subdivisions
3419 @subsection Tremolo subdivisions
3421 @cindex tremolo marks
3422 @funindex tremoloFlags
3424 Tremolo marks can be printed on a single note by adding
3425 @q{@code{:}[@var{number}]} after the note. The number indicates the
3426 duration of the subdivision, and it must be at least 8. A
3427 @var{length} value of 8 gives one line across the note stem. If the
3428 length is omitted, the last value (stored in @code{tremoloFlags}) is
3431 @lilypond[quote,ragged-right,verbatim,fragment]
3432 c'2:8 c':32 | c': c': |
3438 Tremolos entered in this way do not carry over into the MIDI output.
3443 In this manual: @ref{Tremolo repeats}.
3445 Elsewhere: @internalsref{StemTremolo}.
3448 @node Measure repeats
3449 @subsection Measure repeats
3451 @cindex percent repeats
3452 @cindex measure repeats
3454 In the @code{percent} style, a note pattern can be repeated. It is
3455 printed once, and then the pattern is replaced with a special sign.
3456 Patterns of one and two measures are replaced by percent-like signs,
3457 patterns that divide the measure length are replaced by slashes.
3458 Percent repeats must be declared within a @code{Voice} context.
3460 @lilypond[quote,verbatim,ragged-right]
3461 \new Voice \relative c' {
3462 \repeat "percent" 4 { c4 }
3463 \repeat "percent" 2 { c2 es2 f4 fis4 g4 c4 }
3467 Measure repeats of more than 2 measures get a counter, if you switch
3468 on the @code{countPercentRepeats} property,
3470 @lilypond[relative=2,fragment,quote,verbatim,ragged-right]
3472 \set countPercentRepeats = ##t
3473 \repeat "percent" 4 { c1 }
3479 Isolated percents can also be printed. This is done by putting a
3480 multi-measure rest with a different print function,
3482 @lilypond[fragment,verbatim,quote]
3483 \override MultiMeasureRest #'stencil
3484 = #ly:multi-measure-rest::percent
3493 Program reference: @internalsref{RepeatSlash},
3494 @internalsref{PercentRepeat}, @internalsref{DoublePercentRepeat},
3495 @internalsref{DoublePercentRepeatCounter},
3496 @internalsref{PercentRepeatCounter},
3497 @internalsref{PercentRepeatedMusic}.