Cross staff and beaming

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cross staff and beaming

Andrew Bernard

This is a question about cross staff stems and beaming. Referring to the attached example, can this be done by any means in lilypond? Am I missing something obvious?

 

Is there perhaps any way to have beams from the bass and from the treble be made to coincide so as to get something like this, as a sort of fake out? Lilypond of course does its level best to avoid beams from the staves colliding. I am wondering if there is any way to override this behaviour, of course normally desirable, but here it would be useful.

 

Any thoughts?

 

Andrew

 

 


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

cross-staff-beams.png (243K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cross staff and beaming

Thomas Morley-2
2016-11-05 16:05 GMT+01:00 Andrew Bernard <[hidden email]>:

> This is a question about cross staff stems and beaming. Referring to the
> attached example, can this be done by any means in lilypond? Am I missing
> something obvious?
>
>
>
> Is there perhaps any way to have beams from the bass and from the treble be
> made to coincide so as to get something like this, as a sort of fake out?
> Lilypond of course does its level best to avoid beams from the staves
> colliding. I am wondering if there is any way to override this behaviour, of
> course normally desirable, but here it would be useful.
>
>
>
> Any thoughts?
>
>
>
> Andrew


Hi Andrew,

how about:

\version "2.19.49"

\layout {
  \context {
    \PianoStaff
    \consists #Span_stem_engraver
  }
}

pushNC =
\once \override NoteColumn.X-offset =
  #(lambda (grob)
    (let* ((p-c (ly:grob-parent grob X))
           (p-c-elts (ly:grob-object p-c 'elements))
           (stems
             (if (ly:grob-array? p-c-elts)
                 (filter
                   (lambda (elt)(grob::has-interface elt 'stem-interface))
                   (ly:grob-array->list p-c-elts))
                 #f))
           (stems-x-exts
             (if stems
                 (map
                   (lambda (stem)
                     (ly:grob-extent
                       stem
                       (ly:grob-common-refpoint grob stem X)
                       X))
                   stems)
                 '()))
           (sane-ext
             (filter interval-sane? stems-x-exts))
           (cars (map car sane-ext)))
    (if (pair? cars)
        (abs (apply - 0 cars))
        0)))


\new PianoStaff <<
  \new Staff = "up" {
      s2
      \override TupletBracket.bracket-visibility = ##t
      \override TupletBracket.direction = #UP
    \times 8/9 {
      \pushNC
       cis''32[
      \change Staff = "down"
      b,,!32 e,!16
      \change Staff = "up"
      e''!8 cis'''32]
    }
  }
  \new Staff = "down" {
    \clef bass
    % keep staff alive
    s2
    \crossStaff { a,,32 } s4
  }
>>

HTH,
  Harm


png attached

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

atest-45.preview.png (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cross staff and beaming

Nathan Ho-2
In reply to this post by Andrew Bernard
On 2016-11-05 08:05, Andrew Bernard wrote:

> This is a question about cross staff stems and beaming. Referring to
> the attached example, can this be done by any means in lilypond? Am I
> missing something obvious?
>
> Is there perhaps any way to have beams from the bass and from the
> treble be made to coincide so as to get something like this, as a sort
> of fake out? Lilypond of course does its level best to avoid beams
> from the staves colliding. I am wondering if there is any way to
> override this behaviour, of course normally desirable, but here it
> would be useful.

Hi Andrew,

There's a hack for this that works very well, if I may say so myself. I
don't think I ever posted it to the list and it's lost on an old hard
drive, but it shouldn't be hard to recreate.

This is a kind of cross-staff stem, the twist being that the stems being
joined have opposing directions. Copy-paste the Scheme code for
cross-staff stems, which has a check to ensure that the two stems that
you're joining 1) have the same direction and 2) have horizontal
positions are within a certain margin of error of each other (I think it
was 0.01 staff spaces). Remove the first check and widen the margin as
necessary. All you need to do then is manually shift one of the note
columns until the stems connect, and it Just Works.


Nathan

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Loading...