グループ内に演奏する譜がある場合に GrandStaff 全体を表示したままにする

オーケストラ譜では、いくつかの楽器 (あるいはグループ) が全く演奏されない時間があり、その時の譜は (\removeEmptyStaves で) 削除することができます。

楽器が後で再度演奏される場合には、グループで譜を残しておきたい場合があります。これはグループ化しているコンテキスト (GrandStaff や StaffGroup) に Keep_alive_together_engraver を追加することで実現できます。

例では、セカンド バイオリンは 2 番目と 3 番目のシステムで演奏されていません。ファースト バイオリンは 2 番目のシステムでは演奏されず、3 番目のシステムでは最後の小節に演奏部分があります。Keep_alive_together_engraver により、3 番目のシステムではセカンド バイオリンも表示されています。

\score {
  <<
    \new StaffGroup = "StaffGroup_woodwinds"
    <<
      \new Staff = "Staff_flute" \with {
        instrumentName = "Flute"
        shortInstrumentName = "Fl"
      }
      \relative c' {
        \repeat unfold 3 { c'4 c c c | c c c c | c c c c | \break }
      }
    >>
    \new StaffGroup = "StaffGroup_Strings"
    <<
      \new GrandStaff = "GrandStaff_violins"
      <<
        \new Staff = "StaffViolinI" \with {
          instrumentName = "Violin I"
          shortInstrumentName = "Vi I"
        }
        \relative c'' {
          a1 \repeat unfold 7 { s1 } \repeat unfold 12 a16  a4
        }
        \new Staff = "StaffViolinII" \with {
          instrumentName = "Violin II"
          shortInstrumentName = "Vi II"
        }
        \relative c' { e1 \repeat unfold 8 { s1 } }
      >>
      \new Staff = "Staff_cello" \with {
        instrumentName = "Cello"
        shortInstrumentName = "Ce"
      }
      \relative c { \clef bass \repeat unfold 9 { c1 }}
    >>
  >>
}

\paper { tagline = ##f }

\layout {
  indent = 3.0\cm
  short-indent = 1.5\cm
  \context {
    \GrandStaff
    \consists Keep_alive_together_engraver
  }
  \context {
    \Staff
    \RemoveEmptyStaves
  }
}

[image of music]


LilyPond snippets v2.25.15 (開発版).