Folks,
How about: [... very elegant solution ...]
While Harm's solution is great, I'm under the impression that it
shouldn't be needed, i.e., that LilyPond's behaviour classifies as a
bug. I tried to boil the example down to its essentials:
\version "2.20.0"
\new PianoStaff
<<
\new Staff = "upper" {
e''4 \clef bass f
}
\new Staff = "lower" {
\clef bass
c16 e' \change Staff = "upper" g' c''
\change Staff = "lower"
d,4
}
>>
Also, compare:
\version "2.20.0"
\new PianoStaff
<<
\new Staff = "upper" {
\clef bass
e4*3/4 \clef violin s4*1/4 f
}
\new Staff = "lower" {
\clef bass
c16 e \change Staff = "upper" g c''
\change Staff = "lower"
d,4
}
>>
What do you think?
Lukas
It clearly qualifies as a bug to me. It seems to happen whenever a
\change Staff occurs at the same musical moment as a clef or key change.
\version "2.21.80"
<<
\new Staff <<
{
c''4
\clef treble
4
}
\\
{
g'8 8
\change Staff = "lower"
}
>>
\new Staff = "lower" { s2 }
>>
Note that if you comment out the note just after the clef, i.e.
\version "2.21.80"
<<
\new Staff <<
{
c''4
\clef treble
}
\\
{
g'8 8
\change Staff = "lower"
}
>>
\new Staff = "lower" { s2 }
>>
the output gets particularly bad. Yet, I think that is another bug,
probably reminiscent of
https://gitlab.com/lilypond/lilypond/-/issues/4084, because it
disappears if the \clef is no longer played during another note:
\version "2.21.80"
<<
\new Staff <<
{
c''4
\clef treble
}
\\
{
g'8 8
\change Staff = "lower"
}
>>
\new Staff = "lower" { s4 4 }
>>
Best,
Jean