lilypond-user
[Top][All Lists]
Advanced

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

Re: Variable slur thickness


From: tisimst
Subject: Re: Variable slur thickness
Date: Fri, 11 Mar 2016 04:17:20 -0700 (MST)

Thomas and Sharon,

On Fri, Mar 11, 2016 at 3:17 AM, Thomas Morley-2 [via Lilypond] <[hidden email]> wrote:
2016-03-11 10:23 GMT+01:00 Sharon Rosner <[hidden email]>:
>> This problem arose before.
>> One needs to set 'thickness before-line-breaking, but then you don't
>> have access to the control-points, as far as I remember.
>> I'm not sure there is any way, have to think about it.
>
> Can you explain what’s going on?

I can't, at least not yet (if at all). My regular job is calling, have to run.
I'll try to look at it again in the evening.

I've managed to bypass using before-line-breaking AND after-line-breaking by assigning the function to the 'thickness property and having each grob internally calculate its own control points rather than relying on it being calculated elsewhere (also attached):

%%%%%%%%%%%%%%%%

\version "2.19.36"
#(define (variable-slur-thickness min-l max-l min-t max-t) (lambda (grob)
  (let* ((cpt (ly:slur::calc-control-points grob))
         (cp0 (car cpt)) (cp3 (cadddr cpt))
         (x0 (car cp0)) (y0 (cdr cp0))
         (x1 (car cp3)) (y1 (cdr cp3))
         (len (sqrt (+ (expt (- x1 x0)  2) (expt (- y1 y0)  2))))
         (thickness
           (if (<= len max-l)
             (if (< len min-l)
                min-t
                (+ min-t
                  (* (- len min-l)
                    (/ (- max-t min-t) (- max-l min-l)))))
             max-t)))
         thickness)))

\score {
  \relative c' { \repeat unfold 12 { c1( d) c( d e) c( d e f) c( d e f g) } }

  \layout {
    \override Slur.thickness = #(variable-slur-thickness 3 10 1 12.7)
  }
}

%%%%%%%%%%%%%%%%

This is certainly an extreme case to illustrate the effect, but it seems to be working as designed. If we are all satisfied with the functionality, I'll update the snippet. The only thing I'm (slightly) concerned with is the duplicate control-point calculation in this function and how it might affect compilation times if this were applied to a large orchestral score, for example.

Best,
Abraham

variable-slur-thickness.ly (1K) Download Attachment
variable-slur-thickness.pdf (44K) Download Attachment


View this message in context: Re: Variable slur thickness
Sent from the User mailing list archive at Nabble.com.

reply via email to

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