2012/10/6 Nick Payne <[email protected]>: > I'm using glissandos to indicate a guide finger in fingering, and in > most cases where there are chords, I don't want it between all the notes > in successive chords. Can this be done without creating a separate > hidden voice with the single notes having the glissando between them. > e.g. in the following, I only want the glissando between the top notes > in the chords. > > \version "2.17.3" > > guide = #(define-music-function (parser location padleft padright shift > missacc) (number? number? pair? boolean?) > #{ > \once \override Glissando #'(bound-details left padding) = #padleft > \once \override Glissando #'(bound-details right padding) = #padright > \once \override Glissando #'extra-offset = #shift > \once \override Glissando #'(bound-details right end-on-accidental) > = #missacc > \once \override Glissando #'breakable = ##t > \once \override Glissando #'after-line-breaking = ##t > #}) > > \relative c'' { > \guide #1 #0.5 #'(0 . 1.4) ##f <fis^4 b, a dis,>2\glissando <g^4 b, g e> | > } > > > _______________________________________________ > lilypond-user mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/lilypond-user
Hi Nick,
two month ago I created the code below (the same is attached, too).
It is not exactly what you want, but it should give you some ideas.
\version "2.15.39"
#(define (radians->degree radians)
(/ (* radians 180) PI))
#(define ((gliss-plus-text padding 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) padding))))
glissTweak =
#(define-music-function (parser location lst)(pair?)
#{
\once \override Glissando #'after-line-breaking =
#(lambda (grob)
(let ((gliss-count (ly:grob-property grob 'glissando-index)))
(map (lambda (x)
(let ((gliss-nmbr (car x))
(property-value-alist (cdr x)))
(if (eq? gliss-nmbr gliss-count)
(map (lambda (y) (ly:grob-set-property! grob (car y)
(cdr y))) property-value-alist)
#f)))
; $lst))) % for Version "2.14.2"
lst)))
$(make-music 'EventChord 'elements (list (make-music 'GlissandoEvent)))
#})
tweakedGliss = {
\once \override Glissando #'minimum-length = #8
\once \override Glissando #'springs-and-rods =
#ly:spanner::set-spacing-rods
}
\relative c' {
\override TextScript #'font-size = #-2
<c e g bes d>2\glissando^"\"no tweaks\""
<d, a' fis' c' e'>
\tweakedGliss
\glissTweak
#`((0 . ((color . ,red)
(normalized-endpoints . (0 . 0.8))
(stencil . ,(gliss-plus-text -1.8 (markup #:italic
#:fontsize -8 "gliss.")))))
(1 . ((style . zigzag)))
(2 . ((style . trill)
(color . (0.5 0.5 0.5))))
(3 . ((style . dashed-line)))
(4 . ((stencil . ,(gliss-plus-text 0 (markup #:italic
#:fontsize -8 "gliss.")))
(normalized-endpoints . (0 . 0.7))
(color . ,green))))
<c' e g bes d>2^"\"some tweaks\""
<d, a' fis' c' e'>
\once \override Glissando #'(bound-details right arrow) = ##t
\glissTweak
#`((0 . ((style . dashed-line)
(normalized-endpoints . (0 . -2.1))))
(1 . ((stencil . #f)))
(2 . ((stencil . #f)))
(3 . ((stencil . #f)))
(4 . ((style . dashed-line)
(normalized-endpoints . (0 . -1.5)))))
<c' e g bes d>2^"\"some other tweaks\""
<d, a' fis' c' e'>
}
HTH,
Harm
<<attachment: gliss-chf-2.png>>
gliss-chf-2.ly
Description: Binary data
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
