lilypond-user
[Top][All Lists]
Advanced

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

Re: Controlling hairpin length


From: David Sumbler
Subject: Re: Controlling hairpin length
Date: Tue, 19 Jan 2016 12:53:47 +0000

On Tue, 2016-01-19 at 01:27 +0100, Thomas Morley wrote:
> 2016-01-19 1:04 GMT+01:00 Thomas Morley <address@hidden>:
> > Hi David,
> >
> > 2016-01-18 22:56 GMT+01:00 David Sumbler <address@hidden>:
> >
> >> After spending some hours trying to get to the bottom of this problem,
> > [...]
> >
> > Well, I spend some hours creating the function(s) ;)
> >
> >> I narrowed it down to 3 different elements in my files
> > [...]
> >> I feel
> >> that ideally an improvement in an area where Lilypond is somewhat
> >> unsatisfactory (so far as the user is concerned) should not at the same
> >> time break some other aspect(s) of the program's output,
> >
> > Indeed.
> > Though I can't fix a problem which I didn't foresee or which wasn't 
> > reported.
> > Thus, thanks for your examples.
> >
> > Please replace
> > #(define ((hairpin-minimum-length my-minimum) grob)
> > ...
> >
> > with the code below:
> >
> > #(define ((hairpin-minimum-length my-minimum) grob)
> >   (let* ((bound-left (ly:spanner-bound grob LEFT))
> >          (bound-right (ly:spanner-bound grob RIGHT))
> >          (sys (look-up-for-parent 'System Y grob))
> >          (left-x-ext (ly:grob-extent bound-left sys X))
> >          (right-x-ext (ly:grob-extent bound-right sys X)))
> >     (ly:grob-set-property! grob 'minimum-length
> >       ;; keep 'minimum-length user-settable
> >       (max (ly:grob-property-data grob 'minimum-length)
> >            ;; nb, this calculation is only an approximation
> >            ;; should work in most cases, though
> >            (+ my-minimum
> >               (max (cdr left-x-ext) 0)
> >               (max (cdr right-x-ext) 0))))))
> 
> Probably even better:
> 
> #(define ((hairpin-minimum-length my-minimum) grob)
>   (let* ((bound-left (ly:spanner-bound grob LEFT))
>          (bound-right (ly:spanner-bound grob RIGHT))
>          (sys (look-up-for-parent 'System Y grob))
>          (left-x-ext (ly:grob-extent bound-left sys X))
>          (right-x-ext (ly:grob-extent bound-right sys X)))
>     (ly:grob-set-property! grob 'minimum-length
>       ;; keep 'minimum-length user-settable
>       (max (ly:grob-property-data grob 'minimum-length)
>            ;; nb, this calculation is only an approximation
>            ;; should work in most cases, though
>            (+ my-minimum
>               (if (interval-sane? left-x-ext) (cdr left-x-ext) 0)
>               (if (interval-sane? right-x-ext) (cdr right-x-ext) 0))))))
> 
> >
> > Please report back, whether it works now.
> >
> > Cheers,
> >   Harm

Thank you for accepting my comments about the usability of
\myHairpinMinimumLength in the spirit that was intended.

I can report that both of the new versions produce no errors.

However, I am still having a problem with the following bar:

g8\< g a g fs4\mf\> r\invP |

where invP = \tweak stencil ##f \p

This gives a "decrescendo too small" warning, with the all too familiar
vertical line in place of a hairpin, if myHairpinMinimumLength is set to
a value of less than 3.

Yet in the very next bar:

b,8\mp as\< b cs as--\> b\! r4 |

the diminuendo is unnecessarily long (approximately 5.5 staff spaces
with the variable set to #2), forcing the final two quavers apart.

I note that in the comments you say "nb, this calculation is only an
approximation; should work in most cases, though".  But from the above 2
bars it appears that the printed length of a hairpin can be at least 2.5
staff spaces shorter or longer than the requested length.  This means
that the length of individual hairpins may need to be tweaked - which is
the same problem that we have with the built in Hairpin.minimum-length .

David




reply via email to

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