On 23/10/11 07:07, J Ruiz wrote:
I need to show a scale of notes, where every note has a slur to the next one. Lilypond typesets the slurs with length to each notehead center, so my chain of slurs have ends that meet, not visually pleasing. In this case, I'd like the slurs to be somewhat shortened, such that slur ends are some distance before the note head centers, but are still centralizedbetween each note pair. I can't seem to find a way to systematically override slur end-point location relative to note head destinations.

Can't remember where I got this function from, but it does what you want.

\version "2.15.14"

shapeSlur = #(define-music-function (parser location offsets) (list?)
    #{
        \override Slur #'control-points = #(alter-slur-curve $offsets)
    #})

#(define ((alter-slur-curve offsets) grob)
    ;; get default control-points
    (let ((coords (ly:slur::calc-control-points grob))
        (n 0))
    ;; add offsets to default coordinates
    (define loop (lambda (n)
        (set-car! (list-ref coords n)
            (+ (list-ref offsets (* 2 n))
                (car (list-ref coords n))))
        (set-cdr! (list-ref coords n)
            (+ (list-ref offsets (1+ (* 2 n)))
                (cdr (list-ref coords n))))
        (if (< n 3)
            (loop (1+ n)))))
    ;; return altered coordinates
    (loop n)
    coords))

\relative c'' {
    c4( d)( e)( f)
    \shapeSlur #'(0.2 0 0 0 0 0 0 -0.2)
    c( d)( e)( f)
    \revert Slur #'control-points
    c( d)( e)( f)
}

<<attachment: shapeslur.png>>

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

Reply via email to