3.6.6 Using repeats with MIDI

Repeats can be represented in the MIDI output by applying the \unfoldRepeats command.

\score {
  \unfoldRepeats {
    \repeat tremolo 8 { c'32 e' }
    \repeat percent 2 { c''8 d'' }
    \repeat volta 2 { c'4 d' e' f' }
    \alternative {
      \volta 1 { g' a' a' g' }
      \volta 2 { f' e' d' c' }
    }
  }
  \midi { }
}

In order to restrict the effect of \unfoldRepeats to the MIDI output only, while also generating printable scores, it is necessary to make two \score blocks; one for MIDI (with unfolded repeats) and one for the notation (with volta, tremolo, and percent repeats);

\score {
  … music …
  \layout { }
}
\score {
  \unfoldRepeats {
    … music …
  }
  \midi { }
}

When using multiple voices, each of the voices must contain completely unfolded repeats for correct MIDI output.

See also

Notation Reference: Repeats.


LilyPond — Notation Reference v2.23.82 (development-branch).