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, 1 Apr 2016 21:25:36 -0700 (MST)

Thanks, Harm!

On Friday, April 1, 2016, Thomas Morley-2 [via Lilypond] <[hidden email]> wrote:
2016-03-11 21:51 GMT+01:00 Thomas Morley <[hidden email]>:

> 2016-03-11 14:31 GMT+01:00 Sharon Rosner <[hidden email]>:
>>> 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):
>>
>> Works great! I improved it further by making it compatible with ties too:
>>
>>
>> #(define (variable-slur-thickness min-l max-l min-t max-t) (lambda (grob)
>>   (let* ((cpf (if (grob::has-interface grob 'tie-interface)
>>                   ly:tie::calc-control-points
>>                   ly:slur::calc-control-points))
>>          (cpt (cpf grob))
>>          (cp0 (car cpt)) (cp3 (cadddr cpt))
>>          (dx (- (car cp3) (car cp0)))
>>          (dy (- (cdr cp3) (cdr cp0)))
>>          (len (magnitude (make-rectangular dx dy)))
>>          (thickness
>>            (cond ((< len min-l) min-t)
>>                  ((> len max-l) max-t)
>>                  (else (+ min-t (* (- len min-l)
>>                          (/ (- max-t min-t) (- max-l min-l))))))))
>>
>>          thickness)))
>>
>>
>>> 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.
>>
>> A preliminary check with a 17-page score shows a pretty negligible effect on
>> compilation time, 0.6s (the total time is about 21s), or about 2.7%
>> additional compilation time. A small price to pay for more beauty!
>>
>> Sharon
>
>
>
> How about below,
> Should work for all bows, hence the name is changed
>
> #(define (variable-bow-thickness min-l max-l min-t max-t)
>   (lambda (grob)
>     ;; Get the procedure to calculate the control-points
>     ;; If none use `fall-back' to return a default-value for 'thickness
>     (let ((cpf (assoc-get 'control-points (ly:grob-basic-properties grob)))
>           (fall-back 1.2))
>       (if (procedure? cpf)
>           (let* ((cpt (cpf grob))
>                  (cp0 (car cpt))
>                  (cp3 (cadddr cpt))
>                  (dx (- (car cp3) (car cp0)))
>                  (dy (- (cdr cp3) (cdr cp0)))
>                  (len (magnitude (make-rectangular dx dy)))
>                  (thickness
>                    (cond ((< len min-l) min-t)
>                          ((> len max-l) max-t)
>                          (else (+ min-t (* (- len min-l)
>                                (/ (- max-t min-t) (- max-l min-l))))))))
>             thickness)
>           fall-back))))
>
>
> Cheers,
>  Harm
I made some further editions.
Works now for Slurs, Ties, PhrasingSlurs and theoretical for RepeatTie
and LaissezVibrerTie.
Approved as
Variable bow thickness depending on length
http://lsr.di.unimi.it/LSR/Item?u=1&id=1028

Cheers,
  Harm

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



If you reply to this email, your message will be added to the discussion below:
http://lilypond.1069038.n5.nabble.com/Variable-slur-thickness-tp188374p189182.html
To start a new topic under User, email <a href="" target="_blank">address@hidden
To unsubscribe from Lilypond, click here.
NAML


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]