lilypond-user
[Top][All Lists]
Advanced

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

Re: Breaking slurs at apex


From: Michael Blankenship
Subject: Re: Breaking slurs at apex
Date: Mon, 26 Apr 2021 08:51:09 -0400

Lukas,
​Well, I only needed it for over a single break for a figure in a dissertation that I'm turning in today, so it's good enough for the moment.
​Thanks!
​Cracking me up though, you and Jean with your "a little trig" and "just do the math."
​Michael

On Apr 26 2021, at 4:54 am, Lukas-Fabian Moser <lfm@gmx.de> wrote:
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]