lilypond-user
[Top][All Lists]
Advanced

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

Re: Breaking slurs at apex


From: Lukas-Fabian Moser
Subject: Re: Breaking slurs at apex
Date: Mon, 26 Apr 2021 10:54:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

Hi Michael,

Am 26.04.21 um 05:36 schrieb Michael Blankenship:
​​Is there a way to make all broken slurs look like they were a single slur that was broken at its apex? So the first half would terminate at horizontal, and the second half would begin at horizontal. That way they would really look like continuous entities, instead of kinda looking like two separate slurs.

In principle, this is absolutely possible. I don't have time at the moment for a production-quality solution, but here's a "proof of concept":

\version "2.22.0"

#(define (horizontalise-broken-slurs grob)
   (let*
    ((orig (ly:grob-original grob))
     (siblings (if (ly:grob? orig)
                   (ly:spanner-broken-into orig)
                   '()))
     (control-points (ly:grob-property grob 'control-points)))

    (if (>= (length siblings) 2)
        (let ((new-control-points
               (cond
                ((eq? (first siblings) grob)
                 (list (first control-points)
                       (second control-points)
                       (third control-points)
                       (third control-points)))
                ((eq? (last siblings) grob)
                 (list (second control-points)
                       (second control-points)
                       (third control-points)
                       (fourth control-points)))
                (else control-points))))
          (ly:grob-set-property! grob 'control-points new-control-points)))))

\relative \relative {
  \override Slur.after-line-breaking = #horizontalise-broken-slurs
  c'2 c c c c c c'1 ( \break c c2) 2 2 2 2 2( \break
  \repeat unfold 8 c4 \break 2)

}

Problems with this:

1) What should happen for a slur that's broken in more than two pieces?

2) I used a "poor man's way" of modifying the slurs: I just set the last control point equal to the penultimate one. For symmetric slurs as they arise usually, this gives a "kind of horizontal" ending, but with a wrong x position.

So the next task would be do just do the math :-) for the "good" choice of new control points.

Lukas


reply via email to

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