lilypond-user
[Top][All Lists]
Advanced

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

Re: Cross staff and beaming


From: Thomas Morley
Subject: Re: Cross staff and beaming
Date: Sat, 5 Nov 2016 19:24:51 +0100

2016-11-05 16:05 GMT+01:00 Andrew Bernard <address@hidden>:
> 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

Attachment: atest-45.preview.png
Description: PNG image


reply via email to

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