Sharon,
On Thu, Mar 10, 2016 at 3:02 AM, Sharon Rosner [via Lilypond] <
ml-node+s1069038n18837...@n5.nabble.com> wrote:
> Would there be a way to change the slur thickness in proportion to its
> length, so short slurs will be thinner and longer ones will be thicker?
>
I was thinking about this just yesterday. Here's a reasonable solution:
%%%%%%%%%%
\version "2.19"
\layout {
\context {
\Score
\override Slur.height-limit = 1.7
\override Slur.thickness = 2.8
\override Slur.line-thickness = 0.5
\override Slur.ratio = 0.2
}
}
\paper {
#(define page-breaking ly:one-line-auto-height-breaking)
}
\relative c' {
\cadenzaOn
c16[( d]) c[( d e]) c[( d e f]) c[( d e f g a]) c,[( d e f g a b c])
}
\layout {
\override Slur.after-line-breaking =
#(lambda (grob)
(let* ((cpt (ly:grob-property grob 'control-points))
(cp0 (car cpt))
(cp3 (cadddr cpt))
(th (ly:grob-property grob 'thickness))
(tip (ly:grob-property grob 'line-thickness))
(x0 (car cp0))
(y0 (cdr cp0))
(x1 (car cp3))
(y1 (cdr cp3))
(len
(sqrt (+ (expt (- x1 x0) 2)
(expt (- y1 y0) 2))))
;; Set the following FOUR values:
;; maxth = maximum desired thickness
;; (default: Slur 'thickness)
;; minth = minimum desired thickness
;; (default: 75% of maxth)
;; maxlen = maximum length of curve
;; to interpolate between (lengths
;; above this will have thickness
;; of maxth)
;; minlen = minimum length of curve
;; to interpolate between (lengths
;; below this will have thickness
;; of minth)
(maxth th)
(minth (* 0.75 maxth))
(maxlen 10)
(minlen 3)
(newth
(if (<= len maxlen)
(if (< len minlen)
minth
(+ minth
(* (- len minlen)
(/ (- maxth minth) (- maxlen minlen)))))
maxth))
)
;; For debugging purposes
;(format #t "***********\n")
;(format #t "cp0: ~a\n" cp0)
;(format #t "cp3: ~a\n" cp3)
;(format #t "len: ~a\n" len)
;(format #t "th: ~a\n" th)
;(format #t "newth: ~a\n" newth)
(ly:grob-set-property! grob 'thickness newth)
))
}
%%%%%%%%%%
HTH,
Abraham
P.S. Some of the power users on this list filter inline images, so if you
wouldn't mind making the image an attachment next time, I know they'll
appreciate it. :-)
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Variable-slur-thickness-tp188374p188377.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user