lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selectively remove some staves consisting only of rests


From: Kieren MacMillan
Subject: Re: Selectively remove some staves consisting only of rests
Date: Tue, 5 Feb 2019 21:17:44 -0500

Hi all,

Working with Andrew’s "spacer" situation, I see now that my staff layout 
functions can be simplified significantly: since every break "must" be 
accompanied by a bar (even if it’s an invisible one!), one can simply use that 
interface (and no others!) to force visibility.

In the snippet below, you can see the effects of forcing visibility 
(\showStaff), forcing invisibility (\hideStaff), and reverting to normal 
(\resetStaff). Note that these functions can also be used with \once, if 
desired (though I haven’t in this snippet).

Hope this helps!
Kieren.

%%%  SNIPPET BEGINS  %%%
\version "2.19.80"

showStaff = \set Staff.keepAliveInterfaces = #'(bar-line-interface)
hideStaff = \set Staff.keepAliveInterfaces = #'()
resetStaff = \unset Staff.keepAliveInterfaces

violinOne = {
  \override Staff.VerticalAxisGroup.remove-first = ##t
  c''1 \break
  \showStaff
  c''1 \break
  s2 \bar "" \break s2 \break
  c''1 \break
  \resetStaff
  R1 \break
  c''1 \break
  \showStaff
  R1 \break
  c''1
}

violinTwo = {
  \repeat unfold 8 { c'4 }
  \break
  \hideStaff
  \repeat unfold 8 { c'4 }
  \break
  \repeat unfold 8 { c'4 }
  \break
  \resetStaff
  \repeat unfold 8 { c'4 }
}

\score {
  <<
    \new Staff \with { \override StaffSymbol.color = #red } {
      \violinOne
    }
    \new Staff \with { \override StaffSymbol.color = #blue } {
      \violinTwo
    }
  >>
  \layout {
    \context {
      \Staff
      \RemoveEmptyStaves
    }
  }
}

%%%  SNIPPET ENDS  %%%

________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]