lilypond-user
[Top][All Lists]
Advanced

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

Re: Variable slur thickness


From: Thomas Morley
Subject: Re: Variable slur thickness
Date: Fri, 1 Apr 2016 22:15:39 +0200

2016-03-11 21:51 GMT+01:00 Thomas Morley <address@hidden>:
> 2016-03-11 14:31 GMT+01:00 Sharon Rosner <address@hidden>:
>>> 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



reply via email to

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