\unfoldRepeats y \repeat con salida midi en lilypond

Tengo un fragmento de código lilypond aquí:

trebleNotesOne = {
    \unfoldRepeats { 
        \repeat volta 2 {
            r8 a'16 b'16 c''8 b'16 c''16 d''2 | 
            r8 b'16 a'16 b'8 a'16 g'16 f'2 |
        } 
    }
}

bassNotesOne = { 
    \clef bass  
    \unfoldRepeats { 
        \repeat volta 2 {
            a8 b8 c8 d8 a8 b8 c8 d8 | 
            a8 b8 c8 d8 a8 b8 c8 d8 |
        } 
    }
}

\score {
    \new GrandStaff
    <<
        \new Staff << \trebleNotesOne >>
        \new Staff << \bassNotesOne >> 
    >>
    
    \layout {
        ragged-right = ##t
    }
    \midi {}
}

Quiero tanto la notación de repetición ( \repeat volta 2) impresa en el pdf de la partitura como que el archivo midi generado contenga reproducciones repetidas.

El código anterior imprime:

partitura con repeticiones desplegadas

Pero quiero en pdf:

puntuación con notación repetida

con repetición midi.

Respuestas (1)

Para que las repeticiones se muestren en la notación adecuada en el PDF, pero también se desplieguen en el MIDI, necesitará hacer dos bloques de partitura.
Un bloque de puntuación con a \layout{}y otro con a \midi{}.
Ponga el \unfoldRepeatscomando en el bloque de partitura midi.
(ver 3.5.6 Uso de repeticiones con MIDI )

Algo como esto:

trebleNotesOne = {
    \new Staff
        \repeat volta 2 {
            r8 a'16 b'16 c''8 b'16 c''16 d''2 | 
            r8 b'16 a'16 b'8 a'16 g'16 f'2 |
        }
}

bassNotesOne = {
    \new Staff 
        \clef bass  
        \repeat volta 2 {
            a8 b8 c8 d8 a8 b8 c8 d8 | 
            a8 b8 c8 d8 a8 b8 c8 d8 |
        }
}

theMusic = {
    \new GrandStaff
        <<
            \trebleNotesOne
            \bassNotesOne 
        >>
}

%% PDF SCORE
\score {
    \theMusic

    \layout {
        ragged-right = ##t
    }
}

%% MIDI SCORE
\score {
    \unfoldRepeats { 
        \theMusic
    }
    \midi { }
}