lilypond-user
[Top][All Lists]
Advanced

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

Re: staff switches


From: Kieren MacMillan
Subject: Re: staff switches
Date: Sat, 12 Jul 2008 23:52:59 -0400

Hi James,

Is it possible to have staff switches in a separate variable?
I was thinking somthing along the lines of
voiceA = \relative {
   c4 d e g,
   f e e' d
}
voiceAswitches = {
   s2. \change Staff = "LH" s4
   s2 \change Staff = "RH" s2
}

\score {
   \new PianoStaff
   <<
      \new Staff = "RH" \voiceA
      \new Staff = "LH" <<\clef bass s1*2>>
   >>
}
but that doesn't work out so well for me. Any suggestions?

Here's a perfect reason to use \context Voice instead of — or rather, in addition to — \new Voice:

%%%%%%%%
\version "2.11.49"

voiceA = \relative
{
        c4 d e g,
        f e e' d
}
voiceAswitches =
{
        s2. \change Staff = "LH" s4
        s2 \change Staff = "RH" s2
}

\score
{
        \new PianoStaff
        <<
                \new Staff = "RH"
                        \new Voice = "RH_voice" \voiceA
                        \context Voice = "RH_voice" \voiceAswitches
                \new Staff = "LH" { \clef bass s1*2 }
        >>
}
%%%%%%%%

Once the Voice context has been created and populated with the notes, you are then able to "cram the staff switch information" down its throat by referencing it using the \context Voice construct. =)

Hope this helps!
Kieren.



reply via email to

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