8

Suppose I want to use eighth notes which differ widely in pitch, so that half of the eighth notes fall in a bass clef and half of them are best represented in a treble clef. Is there a way to use one beam to connect these notes on two different staves in Lilypond?

Dom
  • 47,095
  • 22
  • 150
  • 281
mclaren
  • 81
  • 1
  • You already have a piano score consisting of a treble and a bass clef? – guidot Dec 06 '16 at 07:49
  • 1
    Look at this documentation node: http://lilypond.org/doc/v2.19/Documentation/notation/common-notation-for-keyboards#cross_002dstaff-stems – Kilian Foth Dec 06 '16 at 09:51

2 Answers2

5

A Voice can change Staff (the respective Staff has to exist at that point of time, if necessary by using \skip as appropriate).

Try

\new PianoStaff <<
  \new Staff = "treble" {
    \new Voice {
      \repeat unfold 8 { \change Staff = "treble" c''16
             \change Staff = "bass" c,16
               }
    }
  }
  \new Staff = "bass" \with { \clef "bass" } { \skip 1 }
>>

which gives cross-staff beaming

user35809
  • 51
  • 2
1

Yes, this is possible, but there are some quirks you may encounter:

upper = \relative c' {
                      g''8  \change Staff = "LH" g,,,
 \change Staff = "RH" a'''  \change Staff = "LH" fis,,,
 \change Staff = "RH" b'''  \change Staff = "LH" e,,,,
 \change Staff = "RH" c'''' \change Staff = "LH" d,,,,

}
lower = \relative c {
\clef bass
 s2
}
\score {
 \new PianoStaff <<
  \new Staff = "RH" \upper
  \new Staff = "LH" \lower
 >>
}

Trying to enter notes onto a context that already stopped.

Hm, a warning:

warning: cannot find context to switch to
 \change Staff = "RH" b'''  
                            \change Staff = "LH" e,,,,

This means that the Staff named "LH" did not "exist" where another Staff was trying to reference it. So we need to keep both staves "alive." A spacer rest does nicely:

upper = \relative c' {
                      g''8  \change Staff = "LH" g,,,
 \change Staff = "RH" a'''  \change Staff = "LH" fis,,,
 \change Staff = "RH" b'''  \change Staff = "LH" e,,,,
 \change Staff = "RH" c'''' \change Staff = "LH" d,,,,

}
lower = \relative c {
\clef bass
 s2 s2 % (or s1)
}
\score {
 \new PianoStaff <<
  \new Staff = "RH" \upper
  \new Staff = "LH" \lower
 >>
}

Filling out the context with spacer rests.

You can control the when and where of beaming, as well. For when, see 1.2.4 Automatic beams > Selected Snippets > Changing beam knee gap: \override Beam.auto-knee-gap = #6; for where, you can specifically move the beams:

upper = \relative c' {
                      g''8  \change Staff = "LH" g,,,
 \change Staff = "RH" a'''  \change Staff = "LH" fis,,,
 \override Beam.positions = #'( -4.5 . -4.5 )
 \change Staff = "RH" b'''  \change Staff = "LH" e,,,,
 \change Staff = "RH" c'''' \change Staff = "LH" d,,,,

}
lower = \relative c {
\clef bass
 s2 s2 % (or s1)
}
\score {
 \new PianoStaff <<
  \new Staff = "RH" \upper
  \new Staff = "LH" \lower
 >>
}

Changing what the beams look like across staves.

Neal
  • 3,206
  • 1
  • 11
  • 26