Next: , Previous: Repeat types, Up: Repeats


6.7.2 Repeat syntax

LilyPond has one syntactic construct for specifying different types of repeats. The syntax is

\repeat variant repeatcount repeatbody

If you have alternative endings, you may add

\alternative {
  alternative1
  alternative2
  alternative3
  ...
}

where each alternative is a music expression. If you do not give enough alternatives for all of the repeats, the first alternative is assumed to be played more than once.

Standard repeats are used like this

     c1
     \repeat volta 2 { c4 d e f }
     \repeat volta 2 { f e d c }

[image of music]

With alternative endings

     c1
     \repeat volta 2 {c4 d e f}
     \alternative { {d2 d} {f f,} }

[image of music]

     \context Staff {
       \partial 4
       \repeat volta 4 { e | c2 d2 | e2 f2 | }
       \alternative { { g4 g g } { a | a a a a | b2. } }
     }

[image of music]

It is possible to shorten volta brackets 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
       c c c
       \set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
       \repeat "volta" 5 { d d d }
       \alternative { { e e e f f f }
       { g g g } }
     }

[image of music]

See also

Examples:

Brackets for the repeat are normally only printed over the topmost staff. This can be adjusted by setting the voltaOnThisStaff property; see input/regression/volta-multi-staff.ly.

Bugs

A nested repeat like

\repeat ...
\repeat ...
\alternative

is ambiguous, since it is 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.

Timing information is not remembered at the start of an alternative, so after a repeat timing information must be reset by hand, for example by setting Score.measurePosition or entering \partial. Similarly, slurs or ties are also not repeated.

This page is for LilyPond-2.6.3 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.

Other languages: English.
Using automatic language selection.