6

I have a piece of lilypond code here:

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 {}
}

I want both the repetition notation (\repeat volta 2) printed in the sheet music pdf, and for the midi file generated to contain repeated plays.

The above code prints:

score with unfolded repeats

But I want in pdf:

score with repeat notation

with midi repetition.

1 Answer 1

8

To get repeats to display in proper notation in the PDF, but to also unfold in the MIDI, you will actually need to make two score blocks.
One score block with a \layout{}, and one with a \midi{}.
Put the \unfoldRepeats command in the midi score block.
(see 3.5.6 Using repeats with MIDI)

Something like this:

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 { }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.