>
> ---------- Forwarded message ----------
> From: Michael Gerdau <[email protected]>
> To: Lilypond User <[email protected]>
> Date: Sat, 18 Jul 2020 07:57:23 +0200 (CEST)
> Subject: Q: Irregular alternate repeats and MIDI
> Hi List,
>
> I have a score with repeats and irregular alternate endings. I can neatly
> engrave that but I don't seem to be able to produce correct MIDI w/o
> manually arranging all segments.
>
> Does someone has a trick up his sleeve?
> I found mails regarding this problem in the archive dating back to 2008...
>
> Here is my "kind of" MWE:
> %-------------------
> \version "2.21.2"
>
> body = { c'4 c' c' c' }
> voltaI = { d'4 d' d' d' }
> voltaII = { e'4 e' e' e' }
> voltaIII = { g'4 g' g' g' }
>
> musicI = {
> \repeat volta 5 \body
> \alternative {
> \voltaI
> \voltaII
> \voltaIII
> }
> \bar "|."
> }
>
> musicII = {
> \repeat volta 5 \body
> \set Score.repeatCommands = #'((volta "1."))
> \voltaI
> \set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
> \voltaII
> \set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
> \voltaIII
> \set Score.repeatCommands = #'((volta #f))
> \bar "|."
> }
>
> \markup "Default w/o \unfoldRepeats"
> \score {
> \musicI
> \layout { }
> \midi { }
> }
>
> \markup "Default unfold is 1.-3. -> Volta 1, 4. -> Volta 2 and 5. -> Volta
> 3"
> \score {
> \unfoldRepeats \musicI
> \layout { }
> \midi { }
> }
>
>
> \markup "This is what I want..."
> \score {
> \musicII
> \layout { }
> \midi { }
> }
>
> \markup "...but \unfoldRepeats does not deal with it"
> \score {
> \unfoldRepeats \musicII
> \layout { }
> \midi { }
> }
>
> \markup "Of course I could enforce it manually"
> \score {
> { \body \voltaI \repeat unfold 3 { \body \voltaII } \body \voltaIII \bar
> "|." }
> \layout { }
> \midi { }
> }
>
> \markup "How should I change \musicII to enable \unfoldRepeats to work the
> way I want it?"
> \markup "Is there a way to tell \alternative which repeats in which volta
> (and the volta texts)?"
> %-------------------
>
> Kind regards,
> Michael
> --
> Michael Gerdau email: [email protected]
>
Not exactly what you asked for, but one possible approach is to use tags.
Tags allow for conditional use of material.
In this case, you would add a tag that is specific to MIDI
and put the repetitions in a similar way you did in the "manual" version.
Then, have two different scores, one for PDF and one for MIDI,
which use different tags.
Even in the printed score, you need to use the \keepWithTag command,
even though there is no PDF-specific content here,
in order to keep the MIDI-tagged content out.
Note that the tag names "MIDI" and "PDF" are just arbitrary words,
there is no intrinsic significance to them.
This approach becomes handy when coding other differences for MIDI,
such as fermatas, breaths, rit/accel, trills.
\version "2.19.81"
body = { c'4 c' c' c' }
voltaI = { d'4 d' d' d' }
voltaII = { e'4 e' e' e' }
voltaIII = { g'4 g' g' g' }
music = {
\repeat volta 5 \body
\set Score.repeatCommands = #'((volta "1."))
\voltaI
\tag #'MIDI { \body }
\set Score.repeatCommands = #'((volta #f) (volta "2. 3. 4.") end-repeat)
\voltaII
\tag #'MIDI {
\body \voltaII
\body \voltaII
\body }
\set Score.repeatCommands = #'((volta #f) (volta "5.") end-repeat)
\voltaIII
\set Score.repeatCommands = #'((volta #f))
\bar "|."
}
\score {
\keepWithTag #'PDF \music
\layout { }
}
\score {
\keepWithTag #'MIDI \music
\midi { }
}
HTH,
Elaine Alt
415 . 341 .4954 "*Confusion is
highly underrated*"
[email protected]
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-