lilypond-user
[Top][All Lists]
Advanced

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

Re: Tie/slur variable thickness vs shape


From: Pierre Perol-Schneider
Subject: Re: Tie/slur variable thickness vs shape
Date: Fri, 22 May 2020 09:32:47 +0200

Yes it does, thank you Kevin!
Cheers,
Pierre

Le ven. 22 mai 2020 à 09:21, Kevin Barry <address@hidden> a écrit :
On Fri, 2020-05-22 at 07:16 +0200, Pierre Perol-Schneider wrote:
> Hi,
> I'm using Abraham's function: http://lsr.di.unimi.it/LSR/Item?id=1028
> However, the overrides are killed by the shape adjustment:
>
> Any idea how to avoid that?
> TIA, cheers,
> Pierre

Hi Pierre,

Does this solve the problem?

%%%
\version "2.20.0"

#(define (variable-bow-thickness min-l max-l min-t max-t)
   (lambda (grob)
     (let* (;; get the procedure to calculate the control-points
             (cpf (assoc-get 'control-points (ly:grob-basic-properties
grob)))
             (cpt (cond ((list? cpf) cpf)
                        ((procedure? cpf) (cpf grob))
                        ((ly:unpure-pure-container? cpf)
                         (ly:unpure-call cpf grob))))
             (cp0 (car cpt))
             (cp3 (cadddr cpt))
             (dx (- (car cp3) (car cp0)))
             (dy (- (cdr cp3) (cdr cp0)))
             (len (magnitude (make-rectangular dx dy)))
             ;; return a value for thickness
             ;;   below min-l             -> min-l
             ;;   greater than max-l      -> max-l
             ;;   between min-l and max-l -> calculate a nice value
             (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)))

\layout {
  ragged-last = ##f
  \override PhrasingSlur.thickness = #(variable-bow-thickness 6 25 1 3)
  \override Slur.thickness = #(variable-bow-thickness 6 25 1 3)
  \override Tie.thickness = #(variable-bow-thickness 6 18 1 2)
}

%% Test:
{
  \shape #'((0 . 0) (0 . 0) (0 . 0) (0 . 0)) Tie
  \shape #'((0 . 0) (0 . 0) (0 . 0) (0 . 0)) Slur
  \shape #'((0 . 0) (0 . 0) (0 . 0) (0 . 0)) PhrasingSlur
  c''1~\(( 1 1 1) 1 1\)
}
%%
%%%

Kevin


reply via email to

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