2012/2/6 me <[email protected]>: > On Mon, Feb 6, 2012 at 12:40 PM, lily-user <[email protected]> wrote: >> >> How do I do notate a harp glissando like the one in the attached image? >> http://old.nabble.com/file/p33274457/HarpGliss.png HarpGliss.png >> Thanks. > > In 2.14.2: > > \new PianoStaff << > \new Staff = "right" { > \clef treble > e'''8\glissando s s4 > \change Staff = "left" > \override NoteHead #'transparent = ##t > \override NoteHead #'no-ledgers = ##t > f,8\glissando s s4 | > \change Staff = "right" e'''8 > } > \new Staff = "left" { > \clef bass > s1 > } >>> > > To go back to normal noteheads, use: > > \override NoteHead #'transparent = ##f > \override NoteHead #'no-ledgers = ##f > > _______________________________________________ > lilypond-user mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/lilypond-user
Based upon the work of me :) I come up with the attached file. Thanks again to David Nalesnik and his great centering functions. Tested with 2.14.2. Testing with 2.15.24 gives a very bad output, I'm going to make bug-report about it. Cheers, Harm
\version "2.14.2"
#(define (radians->degree radians)
(/ (* radians 180) PI))
#(define ((gliss-plus-text text) grob)
(let* ((text-stencil (grob-interpret-markup grob text))
(spanner-stencil (ly:line-spanner::print grob))
(left-bound-info (ly:grob-property grob 'left-bound-info))
(y-left (cdar left-bound-info))
(right-bound-info (ly:grob-property grob 'right-bound-info))
(y-right (cdar right-bound-info))
(slant (if (> y-right y-left) 1 -1))
(spanner-stencil-x-length (interval-length (ly:stencil-extent spanner-stencil X)))
(spanner-stencil-y-length (interval-length (ly:stencil-extent spanner-stencil Y)))
(alpha (radians->degree (atan (/ spanner-stencil-y-length spanner-stencil-x-length))))
(spanner-center-X (interval-center (ly:stencil-extent spanner-stencil X)))
(label-center-X (interval-center (ly:stencil-extent text-stencil X))))
(ly:stencil-combine-at-edge
spanner-stencil
Y UP
(ly:stencil-translate
(ly:stencil-rotate text-stencil (* slant alpha) 0 0)
(cons (- spanner-center-X label-center-X) 0))
(* -0.5 spanner-stencil-y-length))))
glissandoTextOn = \override Glissando #'stencil = #(gliss-plus-text (markup #:italic #:tiny "gliss"))
glissandoTextOff = \revert Glissando #'stencil
noteHeadsOff = {
\override NoteHead #'transparent = ##t
\override NoteHead #'no-ledgers = ##t
}
noteHeadsOn = {
\revert NoteHead #'transparent
\revert NoteHead #'no-ledgers
}
%---- test
\paper { ragged-right = ##f }
\new PianoStaff <<
\new Staff = "right" {
\clef treble
\glissandoTextOn
e'''8\glissando s s4
\change Staff = "left"
\noteHeadsOff
a,,8\glissando s s4 |
\change Staff = "right"
b''8
}
\new Staff = "left" {
\clef bass
s1 s8
}
>>
<<attachment: gliss-text-02.png>>
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
