7

I'm trying to engrave a score, and I'm working on setting up the wind staves. There are two flutes, so what I would like to happen is passages where they play mostly in unison to be displayed on one stave, and passages where they do not play in unison or at a large difference in pitch to be displayed on two separate staves. I would also like that when there is only flute 1 or flute 2 playing, that they be displayed as Voice One on their own staff. I can do the first two using the example from the Hiding Staves article in the manual. But I haven't found a way to make the third requirement (which in an ideal world would happen by itself when one of the staves is empty) possible.

Here's what I have so far. In this example, the notes on the fourth system should ideally be displayed as Voice One, with the staff name "2." completing the "Fl. 2." label. Which is generated by:

\version "2.24.1"

fluteOne = \relative c'' {
  \time 2/4
  \repeat unfold 8 {c2} \break
  \repeat unfold 8 {c2} \break
  \unset Staff.keepAliveInterfaces
  c'8 a d e | f e d c
  \set Staff.keepAliveInterfaces = #'()
  \repeat unfold 6 {c2} \break
  \repeat unfold 8 {R2}
}

fluteTwo = \relative c'' {
  \time 2/4
  \repeat unfold 8 {a2}
  \repeat unfold 8 {a2}
  \repeat unfold 8 {d,2}
  c'8 a d e | f e d c | c8 a d e | f e d c |
  \repeat unfold 4 {R2}
}

\score {
<<
  \new GrandStaff \with { 
    \consists Keep_alive_together_engraver
    \alterBroken stencil #'(#t) SystemStartBrace
    \override InstrumentName.X-offset = -6
    instrumentName = "Fl."
    shortInstrumentName = "Fl."
  } 
  <<
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      \consists Merge_rests_engraver
      instrumentName = \markup {
        \column
        \string-lines 
        "1.
         2."
      }
      shortInstrumentName = \markup {
        \column
        \string-lines 
        "1.
         2."
      }
      \override VerticalAxisGroup.remove-layer = 3
      keepAliveInterfaces = #'()
    } 
    <<
      \fluteOne \\ \fluteTwo
    >>
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      instrumentName = "1."
      shortInstrumentName = "1."
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 2
      keepAliveInterfaces = #'()
    } 
    << 
      \fluteOne
    >>
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      instrumentName = "2."
      shortInstrumentName = "2."
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 2
      keepAliveInterfaces = #'()
    } 
    <<
      \fluteTwo
    >>
  >>
>>
  \layout {
    mragged-left = ##t
    indent = 2\cm
    short-indent = 1\cm
    #(layout-set-staff-size 20)
    \context {
      \Score
      \override Stem.french-beaming = ##t
      %rehearsalMarkFormatter = #format-mark-box-numbers
      %\override Beam.whiteout = ##t
      %\RemoveAllEmptyStaves
    }
  }
}

I have a hunch that it has something to do with the keepAliveInterfaces, but I'm not sure how to make it work, help would be really appreciated.

2
  • 1
    Are you sure this is a good approach? In my experience, it’s more standard to keep them always condensed onto a single stave (at least, exceptions are very rare, and your (2) certainly wouldn’t need to be broken out as two staves), and this is easier to read since it makes the grouping of staves much more consistent.
    – PLL
    Aug 9, 2023 at 22:55
  • @PLL you're probably right. I'm just thinking about passages where the voices cross, or where the dynamics aren't in sync; in those cases I feel like the stave gets crowded very easily. Aug 13, 2023 at 17:25

1 Answer 1

7

How about making use of \partCombine?

\version "2.24.1"

fluteOne = \relative c'' {
  \time 2/4
  \repeat unfold 8 {c2} \break
  \repeat unfold 8 {c2} \break
  \unset Staff.keepAliveInterfaces
  c'8 a d e | f e d c
  \set Staff.keepAliveInterfaces = #'()
  \repeat unfold 6 {c2} \break
  \repeat unfold 8 {R2}
}

fluteTwo = \relative c'' {
  \time 2/4
  \repeat unfold 8 {a2}
  \repeat unfold 8 {a2}
  \repeat unfold 8 {d,2}
  c'8 a d e | f e d c | c8 a d e | f e d c |
  \repeat unfold 4 {R2}
}

\score {
<<
  \new GrandStaff \with { 
    \consists Keep_alive_together_engraver
    \alterBroken stencil #'(#t) SystemStartBrace
    \override InstrumentName.X-offset = -6
    instrumentName = "Fl."
    shortInstrumentName = "Fl."
  } 
  <<
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      \consists Merge_rests_engraver
      instrumentName = \markup {
        \column
        \string-lines 
        "1.
         2."
      }
      shortInstrumentName = \markup {
        \column
        \string-lines 
        "1.
         2."
      }
      \override VerticalAxisGroup.remove-layer = 3
      keepAliveInterfaces = #'()
    } 
    \partCombine \fluteOne \fluteTwo
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      instrumentName = "1."
      shortInstrumentName = "1."
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 2
      keepAliveInterfaces = #'()
    } 
    << 
      \fluteOne
    >>
    \new Staff \with {
      \override InstrumentName.X-offset = -3
      instrumentName = "2."
      shortInstrumentName = "2."
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 2
      keepAliveInterfaces = #'()
    } 
    <<
      \fluteTwo
    >>
  >>
>>
  \layout {
    mragged-left = ##t
    indent = 2\cm
    short-indent = 1\cm
    #(layout-set-staff-size 20)
    \context {
      \Score
      \override Stem.french-beaming = ##t
      %rehearsalMarkFormatter = #format-mark-box-numbers
      %\override Beam.whiteout = ##t
      %\RemoveAllEmptyStaves
    }
  }
}
2
  • Oh cool! that does work, although it's not exactly what I had in mind. Is there a way to customize the text it displays? Say if I wanted it to say "2 solo" or something like that? Aug 9, 2023 at 10:09
  • 1
    @ValérieThibault Yes you can customise the text: \set Staff.soloIIText = #"2 solo", see this page: lilypond.org/doc/v2.24/Documentation/notation/… Aug 9, 2023 at 10:32

Your Answer

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

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