| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Repetition is a central concept in music, and multiple notations exist for repetitions. LilyPond supports the following kinds of repeats:
voltaThe repeated music is not written out but enclosed between repeat bar lines. If the repeat is at the beginning of a piece, a repeat bar line is only printed at the end of the repeat. Alternative endings (volte) are printed left to right with brackets. This is the standard notation for repeats with alternatives.
unfoldThe repeated music is fully written out, as many times as
specified by repeatcount. This is useful when
entering repetitious music.
percentThese are beat or measure repeats. They look like single slashes or percent signs.
tremoloThis is used to write tremolo beams.
| 1.4.1 Long repeats | ||
| 1.4.2 Short repeats |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section discusses how to input long (usually multi-measure) repeats. The repeats can take two forms: repeats enclosed between repeat signs; or written-out repeats, used to input repetitious music. Repeat signs can also be controlled manually.
| Normal repeats | ||
| Manual repeat marks | ||
| Written-out repeats |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax for a normal repeat is
\repeat volta repeatcount musicexpr |
where musicexpr is a music expression.
A single repeat without an alternate ending:
\relative { \repeat volta 2 { c''4 d e f } c2 d \repeat volta 2 { d4 e f g } }
An ‘opening’ repeat mark is not, by default, printed in the first full
measure. However it is possible to add one by using \bar ".|:"
before the first note.
\relative { \repeat volta 2 { \bar ".|:" c''4 d e f } c2 d \repeat volta 2 { d4 e f g } }
Alternative endings can be produced using \alternative. Each
group of alternatives must be themselves, enclosed in a set of braces.
\repeat volta repeatcount musicexpr
\alternative {
{ musicexpr }
}
|
where musicexpr is a music expression.
If there are more repeats than there are alternate endings, the earliest repeats are given the first alternative.
A single repeat with one alternate ending:
\relative { \repeat volta 2 { c''4 d e f | } \alternative { { c2 e | } { f2 g | } } c1 }
Multiple repeats with one alternate ending:
\relative { \repeat volta 4 { c''4 d e f | } \alternative { { c2 e | } { f2 g | } } c1 }
Multiple repeats with more than one alternate ending:
\relative { \repeat volta 3 { c''4 d e f | } \alternative { { c2 e | } { f2 g | } { a2 g | } } c1 }
Note: If there are two or more alternatives, nothing should appear
between the closing brace of one and the opening brace of the next
in an \alternative block, otherwise you will not get the
expected number of endings.
Note: If you include \relative inside a
\repeat without explicitly instantiating the
Voice context, extra (unwanted) staves will appear. See
(usage)An extra staff appears section ‘An extra staff appears’ in Application Usage.
If a repeat that has no alternate endings starts in the middle of a
measure, it will usually end at a corresponding place in the middle of a
later measure (so that the two ends add up to one complete measure). In
this case the repeat signs are not ‘true’ bar lines so neither bar
checks nor \partial commands should be placed there:
c'4 e g \repeat volta 4 { e4 | c2 e | g4 g g } g4 | a2 a | g1 |
If a repeat that has no alternate endings starts with a partial measure,
then the same principles apply, except that a \partial command is
required at the start of the measure:
\partial 4 \repeat volta 4 { e'4 | c2 e | g4 g g } g4 | a2 a | g1 |
Ties may be added to a second ending:
\relative { c''1 \repeat volta 2 { c4 d e f~ } \alternative { { f2 d } { f2\repeatTie f, } } }
The \inStaffSegno command can be used to generate a composite
bar line incorporating the segno symbol with the appropriate repeat
bar line when used with the \repeat volta command. The
correct type of repeat bar line, viz. start repeat, end repeat or
double repeat, is selected automatically. Note that the
corresponding “D.S.” mark must be added manually.
Away from a repeat:
\relative { e'1 \inStaffSegno f2 g a b c1_"D.S." \bar "|." }
At the start of a repeat:
\relative { e'1 \repeat volta 2 { \inStaffSegno % start repeat f2 g a b } c1_"D.S." \bar "|." }
At the end of a repeat:
\relative { e'1 \repeat volta 2 { f2 g a b \inStaffSegno % end repeat } f2 g a b c1_"D.S." \bar "|." }
Between two repeats:
\relative { e'1 \repeat volta 2 { f2 g a b } \inStaffSegno % double repeat \repeat volta 2 { f2 g a b } c1_"D.S." \bar "|." }
Alternative bar line symbols can be obtained by setting (in the Score
context) the properties segnoType, startRepeatSegnoType,
endRepeatSegnoType or doubleRepeatSegnoType to the
required bar line type. The alternative bar line types must be
selected from the pre-defined types or types previously defined
with the \defineBarLine command (see Bar lines).
\defineBarLine ":|.S[" #'(":|." "S[" "") \defineBarLine "]" #'("]" "" "") \relative { e'1 \repeat volta 2 { f2 g a b \once \set Score.endRepeatSegnoType = ":|.S[" \inStaffSegno } f2 g \bar "]" a b c1_"D.S." \bar "|." }
Shortening volta brackets
By default, the volta brackets will be drawn over all of the
alternative music, but it is possible to shorten them by setting
voltaSpannerDuration. In the next example, the bracket only
lasts one measure, which is a duration of 3/4.
\relative c'' { \time 3/4 c4 c c \set Score.voltaSpannerDuration = #(ly:make-moment 3/4) \repeat volta 5 { d4 d d } \alternative { { e4 e e f4 f f } { g4 g g } } }
Adding volta brackets to additional staves
The Volta_engraver by default resides in the Score
context, and brackets for the repeat are thus normally only printed
over the topmost staff. This can be adjusted by adding the
Volta_engraver to the Staff context where the brackets
should appear; see also the “Volta multi staff” snippet.
<< \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff \with { \consists "Volta_engraver" } { c'2 g' e' a' } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } >>
Setting the double repeat default for volte
There are three different styles of double repeats for volte, that can
be set using doubleRepeatType.
\relative c'' { \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":..:" \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":|.|:" \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":|.:" \repeat volta 1 { c1 } }
Alternative bar numbering
Two alternative methods for bar numbering can be set, especially for when using repeated music.
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
Music Glossary: (music-glossary)repeat section ‘repeat’ in Music Glossary, (music-glossary)volta section ‘volta’ in Music Glossary.
Notation Reference: Bar lines, Modifying context plug-ins, Modifying ties and slurs, Time administration.
Installed Files: ‘ly/engraver-init.ly’.
Snippets: (snippets)Repeats section ‘Repeats’ in Snippets.
Internals Reference: (internals)VoltaBracket section ‘VoltaBracket’ in Internals Reference, (internals)RepeatedMusic section ‘RepeatedMusic’ in Internals Reference, (internals)VoltaRepeatedMusic section ‘VoltaRepeatedMusic’ in Internals Reference, (internals)UnfoldedRepeatedMusic section ‘UnfoldedRepeatedMusic’ in Internals Reference.
Slurs that span from a \repeat block into an
\alternative block will only work for the first alternative
ending. The visual appearance of a continuing slur in other
alternative blocks may be simulated with \repeatTie if the
slur extends into only one note in the alternative block, although
this method does not work in TabStaff. Other methods which
may be tailored to indicate continuing slurs over several notes in
alternative blocks, and which also work in TabStaff contexts,
are shown in Modifying ties and slurs.
Also, slurs cannot wrap around from the end of one alternative back to the beginning of the repeat.
Glissandi that span from a \repeat block into an
\alternative block will only work for the first alternative
ending. The visual appearance of a continuing glissando in other
alternative blocks may be indicated by coding a glissando starting
on a hidden grace note. For an example, see
“Extending glissandi across repeats” under Selected Snippets
in Glissando.
If a repeat that begins with an incomplete measure has an
\alternative block that contains modifications to the
measureLength property, using \unfoldRepeats will
result in wrongly-placed bar lines and bar check warnings.
A nested repeat like
\repeat … \repeat … \alternative |
is ambiguous, since it is not clear to which \repeat the
\alternative belongs. This ambiguity is resolved by always
having the \alternative belong to the inner \repeat.
For clarity, it is advisable to use braces in such situations.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Note: These methods are only used for displaying unusual repeat
constructs, and may produce unexpected behavior. In most cases,
repeats should be created using the standard \repeat command
or by printing the relevant bar lines. For more information, see
Bar lines.
The property repeatCommands can be used to control the
layout of repeats. Its value is a Scheme list of repeat commands.
start-repeatPrint a .|: bar line.
\relative { c''1 \set Score.repeatCommands = #'(start-repeat) d4 e f g c1 }
As per standard engraving practice, repeat signs are not printed at the beginning of a piece.
end-repeatPrint a :|. bar line:
\relative { c''1 d4 e f g \set Score.repeatCommands = #'(end-repeat) c1 }
(volta number) … (volta #f)Create a new volta with the specified number. The volta bracket must be explicitly terminated, or it will not be printed.
\relative { f''4 g a b \set Score.repeatCommands = #'((volta "2")) g4 a g a \set Score.repeatCommands = #'((volta #f)) c1 }
Multiple repeat commands may occur at the same point:
\relative { f''4 g a b \set Score.repeatCommands = #'((volta "2, 5") end-repeat) g4 a g a c1 \set Score.repeatCommands = #'((volta #f) (volta "95") end-repeat) b1 \set Score.repeatCommands = #'((volta #f)) }
Text can be included with the volta bracket. The text can be a number or numbers or markup text, see Formatting text. The simplest way to use markup text is to define the markup first, then include the markup in a Scheme list.
voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative { c''1 \set Score.repeatCommands = #(list(list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) }
Notation Reference: Bar lines, Formatting text.
Snippets: (snippets)Repeats section ‘Repeats’ in Snippets.
Internals Reference: (internals)VoltaBracket section ‘VoltaBracket’ in Internals Reference, (internals)RepeatedMusic section ‘RepeatedMusic’ in Internals Reference, (internals)VoltaRepeatedMusic section ‘VoltaRepeatedMusic’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
By using the unfold command, repeats can be used to simplify the
writing out of repetitious music. The syntax is
\repeat unfold repeatcount musicexpr |
where musicexpr is a music expression and
repeatcount is the number of times
musicexpr is repeated.
\relative { \repeat unfold 2 { c''4 d e f } c1 }
In some cases, especially in a \relative context, the
\repeat unfold function is not the same as writing out the
music expression multiple times. E.g,
\repeat unfold 2 { a'4 b c }
|
is not equivalent to
a'4 b c | a'4 b c |
Unfold repeats can be made with alternate endings.
\relative { \repeat unfold 2 { c''4 d e f } \alternative { { c2 g' } { c,2 b } } c1 }
If there are more repeats than there are alternate endings, the first alternative is applied multiple times until the remaining alternatives make up the total number of repeats.
\relative { \repeat unfold 4 { c''4 d e f } \alternative { { c2 g' } { c,2 b } { e2 d } } c1 }
If there are more alternate endings than repeats then only the first alternatives are applied. The remaining alternatives will be ignored and not printed.
\relative { \repeat unfold 2 { c''4 d e f } \alternative { { c2 g' } { c,2 b } { e2 d } } c1 }
It is also possible to nest multiple unfold functions (with or
without alternate endings).
\relative { \repeat unfold 2 { \repeat unfold 2 { c''4 d e f } \alternative { { c2 g' } { c,2 b } } } c1 }
Chord constructs can be repeated by the chord repetition symbol
q. See Chord repetition.
Note: If you include \relative inside a \repeat
without explicitly instantiating the Voice context, extra
(unwanted) staves will appear. See
(usage)An extra staff appears section ‘An extra staff appears’ in Application Usage.
Notation Reference: Chord repetition.
Snippets: (snippets)Repeats section ‘Repeats’ in Snippets.
Internals Reference: (internals)RepeatedMusic section ‘RepeatedMusic’ in Internals Reference, (internals)UnfoldedRepeatedMusic section ‘UnfoldedRepeatedMusic’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section discusses how to input short repeats. Short repeats can take two forms: slashes or percent signs to represent repeats of a single note, a single measure or two measures, and tremolos otherwise.
| Percent repeats | ||
| Tremolo repeats |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Repeated short patterns are printed once, and the repeated pattern is replaced with a special sign.
The syntax is
\repeat percent number musicexpr |
where musicexpr is a music expression.
Patterns that are shorter than one measure are replaced by slashes.
\relative c'' { \repeat percent 4 { c128 d e f } \repeat percent 4 { c64 d e f } \repeat percent 5 { c32 d e f } \repeat percent 4 { c16 d e f } \repeat percent 4 { c8 d } \repeat percent 4 { c4 } \repeat percent 2 { c2 } }
Patterns of one or two measures are replaced by percent-like symbols.
\relative c'' { \repeat percent 2 { c4 d e f } \repeat percent 2 { c2 d } \repeat percent 2 { c1 } }
\relative { \repeat percent 3 { c''4 d e f | c2 g' } }
Patterns that are shorter than one measure but contain mixed durations use a double-percent symbol.
\relative { \repeat percent 4 { c''8. <d f>16 } \repeat percent 2 { \tuplet 3/2 { r8 c d } e4 } }
Percent repeat counter
Measure repeats of more than two repeats can get a counter when the convenient property is switched, as shown in this example:
\relative c'' { \set countPercentRepeats = ##t \repeat percent 4 { c1 } }
Percent repeat count visibility
Percent repeat counters can be shown at regular intervals by setting
the context property repeatCountVisibility.
\relative c'' { \set countPercentRepeats = ##t \set repeatCountVisibility = #(every-nth-repeat-count-visible 5) \repeat percent 10 { c1 } \break \set repeatCountVisibility = #(every-nth-repeat-count-visible 2) \repeat percent 6 { c1 d1 } }
Isolated percent repeats
Isolated percents can also be printed.
makePercent = #(define-music-function (note) (ly:music?) "Make a percent repeat the same length as NOTE." (make-music 'PercentEvent 'length (ly:music-length note))) \relative c'' { \makePercent s1 }
Music Glossary: (music-glossary)percent repeat section ‘percent repeat’ in Music Glossary, (music-glossary)simile section ‘simile’ in Music Glossary.
Snippets: (snippets)Repeats section ‘Repeats’ in Snippets.
Internals Reference: (internals)RepeatSlash section ‘RepeatSlash’ in Internals Reference, (internals)RepeatSlashEvent section ‘RepeatSlashEvent’ in Internals Reference, (internals)DoubleRepeatSlash section ‘DoubleRepeatSlash’ in Internals Reference, (internals)PercentRepeat section ‘PercentRepeat’ in Internals Reference, (internals)PercentRepeatCounter section ‘PercentRepeatCounter’ in Internals Reference, (internals)PercentRepeatedMusic section ‘PercentRepeatedMusic’ in Internals Reference, (internals)Percent_repeat_engraver section ‘Percent_repeat_engraver’ in Internals Reference, (internals)DoublePercentEvent section ‘DoublePercentEvent’ in Internals Reference, (internals)DoublePercentRepeat section ‘DoublePercentRepeat’ in Internals Reference, (internals)DoublePercentRepeatCounter section ‘DoublePercentRepeatCounter’ in Internals Reference, (internals)Double_percent_repeat_engraver section ‘Double_percent_repeat_engraver’ in Internals Reference, (internals)Slash_repeat_engraver section ‘Slash_repeat_engraver’ in Internals Reference.
Percent repeats will not contain anything else apart from the percent sign itself; in particular, timing changes will not be repeated.
\repeat percent 3 { \time 5/4 c2. 2 \time 4/4 2 2 }
Any meter changes or \partial commands need to occur in parallel
passages outside of any percent repeat, e.g in a separate
timing track.
<< \repeat percent 3 { c2. 2 2 2 } \repeat unfold 3 { \time 5/4 s4*5 \time 4/4 s1 } >>
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Tremolos can take two forms: alternation between two chords or two notes, and rapid repetition of a single note or chord. Tremolos consisting of an alternation are indicated by adding beams between the notes or chords being alternated, while tremolos consisting of the rapid repetition of a single note are indicated by adding beams or slashes to a single note.
To place tremolo marks between notes, use \repeat with
tremolo style:
\relative c'' { \repeat tremolo 8 { c16 d } \repeat tremolo 6 { c16 d } \repeat tremolo 2 { c16 d } }
The \repeat tremolo syntax expects exactly two notes within
the braces, and the number of repetitions must correspond to a
note value that can be expressed with plain or dotted notes. Thus,
\repeat tremolo 7 is valid and produces a double dotted
note, but \repeat tremolo 9 is not.
The duration of the tremolo equals the duration of the
braced expression multiplied by the number of repeats:
\repeat tremolo 8 { c16 d16 } gives a whole note tremolo,
notated as two whole notes joined by tremolo beams.
There are two ways to put tremolo marks on a single note. The
\repeat tremolo syntax is also used here, in which case
the note should not be surrounded by braces:
\repeat tremolo 4 c'16
The same output can be obtained by adding :N after
the note, where N indicates the duration of the
subdivision (it must be at least 8). If N is 8, one
beam is added to the note’s stem. If N is omitted,
the last value is used:
\relative { c''2:8 c:32 c: c: }
Cross-staff tremolos
Since \repeat tremolo expects exactly two musical arguments for
chord tremolos, the note or chord which changes staff within a
cross-staff tremolo should be placed inside curly braces together with
its \change Staff command.
\new PianoStaff << \new Staff = "up" \relative c'' { \key a \major \time 3/8 s4. } \new Staff = "down" \relative c'' { \key a \major \time 3/8 \voiceOne \repeat tremolo 6 { <a e'>32 { \change Staff = "up" \voiceTwo <cis a' dis>32 } } } >>
Snippets: (snippets)Repeats section ‘Repeats’ in Snippets.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by gub on July 13, 2020 using texi2html 1.82.
Other languages: català, deutsch, español, français, italiano, 日本語.
About automatic language selection.