[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Repeats ] | [ Up : Repeats ] | [ Normal repeats > ] |
1.4.1 Long repeats
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 |
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Long repeats ] | [ Up : Long repeats ] | [ Manual repeat marks > ] |
Normal repeats
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
An extra staff appears.
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 "|." }
Selected Snippets
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 }
See also
Music Glossary: repeat, volta.
Notation Reference: Bar lines, Modifying context plug-ins, Modifying ties and slurs, Time administration.
Installed Files: ‘ly/engraver-init.ly’.
Snippets: Repeats.
Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic, UnfoldedRepeatedMusic.
Known issues and warnings
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.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Normal repeats ] | [ Up : Long repeats ] | [ Written-out repeats > ] |
Manual repeat marks
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-repeat
Print 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-repeat
Print 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)) }
See also
Notation Reference: Bar lines, Formatting text.
Snippets: Repeats.
Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Manual repeat marks ] | [ Up : Long repeats ] | [ Short repeats > ] |
Written-out repeats
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
An extra staff appears.
See also
Notation Reference: Chord repetition.
Snippets: Repeats.
Internals Reference: RepeatedMusic, UnfoldedRepeatedMusic.
[ << Musical notation ] | [Top][Contents][Index][ ? ] | [ Specialist notation >> ] | ||
[ < Manual repeat marks ] | [ Up : Long repeats ] | [ Short repeats > ] |
Jiné jazyky: català, deutsch, español, français, italiano, 日本語.
About automatic language selection.