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]

In the following example, the first ending is not a complete bar (it only had 3 beats). The beginning of the second ending contains the 4th beat from the first ending. This “extra”

beat in the second ending is due to the first time ending, and has nothing to do with the \partial at the beginning of the example.

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

[image of music]

Ties may be added to a second ending,

     
     c1
     \repeat volta 2 {c4 d e f ~ }
     \alternative { {f2 d} {f\repeatTie f,} }

[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.

Volta brackets are not vertically aligned.


Next: , Previous: Repeat types, Up: Repeats

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

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Other languages: French.