On 2019-11-17 6:40 pm, Andrew Bernard wrote:
Hi Aaron,

What if I want to change this for each different length? Really long
ones and medium long ones, for example. Ideally I'd just like to be
able to specify a percentage or absolute offset where the flare
starts, for each different hairpin. That would be the simplest.

Something like:

\flare 0.05 % percent of length start

elbowed-hairpin is already relative (i.e. percentage-based) to the width and height of the hairpin.

If you need absolute, you could do a little math based on the estimated width of the normal hairpin stencil:

%%%%
\version "2.19.83"

abs-hairpin = #(define-scheme-function (elx ely) (number? number?)
  (lambda (grob)
    (let* ((sten (ly:hairpin::print grob))
           (xex (ly:stencil-extent sten X))
           (yex (ly:stencil-extent sten Y))
           (width (interval-length xex))
           (height (/ (interval-length yex) 2))
           (x (- 1 (/ elx width)))
           (y (- 1 (/ ely height))))
      (elbowed-hairpin `((0 . 0) (,x . ,y) (1 . 1)) #t))))

{
  \override Hairpin.height = 2
  \override Hairpin.stencil = \abs-hairpin 1.5 1
  c''4^\> \repeat unfold 2 { c'' } c''\!
  c''4^\< \repeat unfold 4 { c'' } c''\!
  c''4^\> \repeat unfold 6 { c'' } c''\!
  c''4^\< \repeat unfold 8 { c'' } c''\!
}
%%%%

Haven't tested this much with broken spanners, so there may need to be additional work.


-- Aaron Hill

Reply via email to