[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: alternative notehead style breaks cross-staff stem
From: |
Thomas Morley |
Subject: |
Re: alternative notehead style breaks cross-staff stem |
Date: |
Sun, 13 Nov 2016 21:44:44 +0100 |
2016-11-13 15:45 GMT+01:00 Urs Liska <address@hidden>:
> Hi all,
>
> I'm trying to build something like similar to an automated harmonic
> display on two staves, and it seems that alternative note head styles
> break the cross staff stems:
>
> Is this known (at least not said in the NR)? Is there a way around this
> issue? Note that the example code isn't necessarily the ideal approach
> but a first attempt. What I eventually need is a way for a music
> function to produce such a "chord" distributed on two staves, connected
> by a cross-staff stem and either note head configurable in appearance.
>
> TIA for any hints or pointers
> Urs
>
>
> \version "2.19.51"
>
> \layout {
> \context {
> \PianoStaff
> \consists #Span_stem_engraver
> }
> }
>
> \score {
> <<
> \new PianoStaff <<
> \new Staff = "one" {
> s1
> }
>
> \new Staff = "two" {
> \clef bass
> <<
> \crossStaff {
> c,4 c, c, c,
> }
> \new Voice {
> \stemUp
> \change Staff = "one"
> \override NoteHead.style = #'harmonic
> e' g' bes' c''
> }
> >>
>
> }
> >>
> >>
> }
Hi Urs,
cross-staff Stems are only printed if certain conditions are fullfilled.
One of them is the Stem's left edge are within a range 0.001
-> `close-enough?' in music-functions.scm
In a recent thread I developed `pushNC' to force the Stems doing so.
http://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00230.html
Works here as well:
\version "2.19.49"
pushNC =
\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 max cars) (apply min cars)))
0)))
\layout {
\context {
\PianoStaff
\consists #Span_stem_engraver
}
}
\score {
<<
\new PianoStaff <<
\new Staff = "one" {
s1
}
\new Staff = "two" {
\clef bass
<<
\crossStaff {
c,4 c, c, c,
}
\new Voice {
\stemUp
\change Staff = "one"
\override NoteHead.style = #'harmonic
%\once
\pushNC
e' g' bes' c''
}
>>
}
>>
>>
}
HTH,
Harm