Hello there,
Please let this not be a duplicate.
Is there a way for the tacet staff to be shown *only* when all the other staves are empty ? Manual intervention is not a viable option here.
If I understand correctly what you're after, the following seems to do the trick:
\version "2.25.9"
\language "english"
tacet = {
R1*40
}
musicA = {
\repeat unfold 28 g'4 |
\repeat unfold 4 g'4 |
R1*10
\repeat unfold 16 f'4 |
}
musicB = {
R1*4
\break
\repeat unfold 16 c'4 |
\break
R1*10
\break
\repeat unfold 16 d'4 |
}
\new StaffGroup \with { \consists Keep_alive_together_engraver }
<<
\new Staff \with {
instrumentName = "Tacet"
shortInstrumentName = "Tacet"
\override VerticalAxisGroup.remove-layer = 2
} \tacet
\new Staff \with {
instrumentName = "A"
shortInstrumentName = "A"
\RemoveAllEmptyStaves
\override VerticalAxisGroup.remove-layer = 1
} \musicA
\new Staff \with {
instrumentName = "B"
shortInstrumentName = "B"
\RemoveAllEmptyStaves
\override VerticalAxisGroup.remove-layer = 1
} \musicB
>>