I'm trying to typeset a double-choir score with piano. Overall the score is set up as Frenched Score, removing the choir staves when empty, but handling both choirs separately.
This is a distilled version of my current state:
\version "2.24.1"
\paper {
#(set-paper-size "a4")
left-margin = 3\cm
}
global = {
\key c \major
\time 4/4
}
scoreASopranoChoirI = \relative c'' {
\global
%\separate
\textMark "Choir I"
R1*20
\repeat unfold 10 { g4 a f c }
\repeat unfold 50 f4
%\join
\textMark "Choir I && II"
\repeat unfold 50 c4
%\separate
\textMark "Choir I"
\repeat unfold 50 f4
}
scoreAAltoChoirI = \relative c' {
\global
%\separate
R1*20
\repeat unfold 10 { g'4 a f c }
\repeat unfold 50 a4
%\join
\repeat unfold 50 e'4
%\separate
\repeat unfold 50 a4
}
scoreASopranoChoirII = \relative c'' {
\global
%\separate
\textMark "Choir II"
R1*30
\repeat unfold 50 a4
%\join
\repeat unfold 50 c4
%\separate
\textMark "Choir II"
\repeat unfold 50 a4
}
scoreAAltoChoirII = \relative c' {
\global
%\join
R1*30
%\separate
\repeat unfold 50 c4
%\join
\repeat unfold 50 e4
%\separate
\repeat unfold 50 c4
}
scoreARight = \relative c'' {
\global
\repeat unfold 30 { g4 a f c }
\repeat unfold 50 e4
\repeat unfold 50 c4
\repeat unfold 50 e4
}
scoreALeft = \relative c' {
\global
\repeat unfold 30 { g4 a f c }
\repeat unfold 50 a4
\repeat unfold 50 e4
\repeat unfold 50 a4
}
scoreAChoirIPart = \new ChoirStaff \with {
instrumentName = "Choir I"
shortInstrumentName = ""
\consists Keep_alive_together_engraver
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
} <<
\new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S.1"
} \new Voice = "soprano" \scoreASopranoChoirI
\new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A.1"
} \new Voice = "alto" \scoreAAltoChoirI
>>
scoreAChoirIIPart = \new ChoirStaff \with {
instrumentName = "Choir II"
shortInstrumentName = ""
\consists Keep_alive_together_engraver
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
} <<
\new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S.2"
} \new Voice = "soprano" \scoreASopranoChoirII
\new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A.2"
} \new Voice = "alto" \scoreAAltoChoirII
>>
scoreAPianoPart = \new PianoStaff \with {
instrumentName = "Piano"
shortInstrumentName = "Pno."
} <<
\new Staff = "right" \with {
} \scoreARight
\new Staff = "left" \with {
} { \clef bass \scoreALeft }
>>
\score {
<<
\scoreAChoirIPart
\scoreAChoirIIPart
\scoreAPianoPart
>>
\layout {
\context {
\Staff
}
}
}
At some point, the two choirs sign the same voices and I'd like to display them together in a single staff. To do that I'd tried to follow the solution provided here and I end up with:
\version "2.24.1"
join = {
\set Staff.keepAliveInterfaces = #'()
}
separate = {
\unset Staff.keepAliveInterfaces
}
\paper {
#(set-paper-size "a4")
left-margin = 3\cm
}
global = {
\key c \major
\time 4/4
}
scoreASopranoChoirI = \relative c'' {
\global
\separate
\textMark "Choir I"
R1*20
\repeat unfold 10 { g4 a f c }
\repeat unfold 50 f4
\join
\textMark "Choir I && II"
\repeat unfold 50 c4
\separate
\textMark "Choir I"
\repeat unfold 50 f4
}
scoreAAltoChoirI = \relative c' {
\global
\separate
R1*20
\repeat unfold 10 { g'4 a f c }
\repeat unfold 50 a4
\join
\repeat unfold 50 e'4
\separate
\repeat unfold 50 a4
}
scoreASopranoChoirII = \relative c'' {
\global
\separate
\textMark "Choir II"
R1*30
\repeat unfold 50 a4
\join
\repeat unfold 50 c4
\separate
\textMark "Choir II"
\repeat unfold 50 a4
}
scoreAAltoChoirII = \relative c' {
\global
\join
R1*30
\separate
\repeat unfold 50 c4
\join
\repeat unfold 50 e4
\separate
\repeat unfold 50 c4
}
scoreARight = \relative c'' {
\global
\repeat unfold 30 { g4 a f c }
\repeat unfold 50 e4
\repeat unfold 50 c4
\repeat unfold 50 e4
}
scoreALeft = \relative c' {
\global
\repeat unfold 30 { g4 a f c }
\repeat unfold 50 a4
\repeat unfold 50 e4
\repeat unfold 50 a4
}
scoreAChoirIPart = \new ChoirStaff \with {
instrumentName = "Choir I"
shortInstrumentName = ""
\consists Keep_alive_together_engraver
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
\override VerticalAxisGroup.remove-layer = 1
} <<
\new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S.1"
} \new Voice = "soprano" \scoreASopranoChoirI
\new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A.1"
} \new Voice = "alto" \scoreAAltoChoirI
>>
scoreAChoirIIPart = \new ChoirStaff \with {
instrumentName = "Choir II"
shortInstrumentName = ""
\consists Keep_alive_together_engraver
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
\override VerticalAxisGroup.remove-layer = 1
} <<
\new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S.2"
} \new Voice = "soprano" \scoreASopranoChoirII
\new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A.2"
} \new Voice = "alto" \scoreAAltoChoirII
>>
scoreAChoirIandIIPart = \new ChoirStaff \with {
instrumentName = "Choir I & II"
shortInstrumentName = "Ch. I & II"
\consists Keep_alive_together_engraver
\override VerticalAxisGroup.remove-first = ##t
\override VerticalAxisGroup.remove-layer = 2
} <<
\new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S. I & II"
} \new Voice = "soprano" \scoreASopranoChoirI
\new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A. I & II"
} \new Voice = "alto" \scoreAAltoChoirI
>>
scoreAPianoPart = \new PianoStaff \with {
instrumentName = "Piano"
shortInstrumentName = "Pno."
} <<
\new Staff = "right" \with {
} \scoreARight
\new Staff = "left" \with {
} { \clef bass \scoreALeft }
>>
\score {
<<
\new ChoirStaff \with {
\consists Keep_alive_together_engraver
}
<<
\set ChoirStaff.systemStartDelimiter = #'SystemStartBar
\scoreAChoirIPart
\scoreAChoirIIPart
\scoreAChoirIandIIPart
>>
\scoreAPianoPart
>>
\layout {
\context {
\Staff
}
}
\midi {
\tempo 4=100
}
}
This more ore less works ....
... but it has two problems:
- When both choirs are empty, the choir I & II staff pops up. Turning on remove-empty on the joined choirs staff make it disappear everywhere.
- When only one of the choirs is empty, both choirs are displayed.
Bonus points for how show a text mark when both choirs are displayed joined (which is not when they are ready to be joined)