I would like to include some Staff and Voice context settings in the \midi
block only if a flag is set to ##t and I have not been able to figure out how
to do this. When I try to wrap the \context blocks in a code block with #{…#}
I get this error:
trackPerVoiceMWE.ly:31:16: error: syntax error, unexpected '{', expecting
SCM_IDENTIFIER or SCM_TOKEN or STRING or SYMBOL
\context {
Is there any way to conditionally change the Staff_performer based on a flag
setting?
This is my non-working MWE:
\version "2.24.0"
\include "english.ly"
global = {
\key c \major
\time 4/4
}
TrackPerVoice = ##t
\score {
\new ChoirStaff <<
\new Staff <<
\new Voice = "soprano" <<
\global
\relative c' { c'4 d e f << g1 \\ { g4 f e2 } >> }
>>
\new Voice = "alto" <<
\global
\voiceTwo
\relative c' { c'4 b a g | f e d2 }
>>
>>
>>
\layout {}
\midi {
#(display (format #f "TrackPerVoice is ~a\n" TrackPerVoice))
#(if TrackPerVoice #{
#(display "One track per Voice (may make too many voices with polyphony)")
#(display "Turn this off to get sop and alto combined in one track.")
\context {
\Staff
\remove "Staff_performer"
}
\context {
\Voice
\consists "Staff_performer"
}
#} )
}
}
Thanks,
Carolyn