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: Sun, 17 Jan 2016 16:36:32 +0000

Thank you for the suggestion (below) for controlling the actual length
of hairpins.  I am afraid it has taken until now for me to have an
opportunity to try it out in my string quartet.  Unfortunately, I find
that it is only a partial success.

Previously I had '\override Hairpin.minimum-length = #7' in my Voice
defaults.  This works OK most of the time, although obviously sometimes
it produces an over-long hairpin which needs an override.

I then tried setting \myHairpinMinimumLength #1.5 (as in your example),
but had to remove the Hairpin.minimum-length setting to get it to work.
Unfortunately I found that a number of hairpins produced a compiler
warning: "decrescendo too small".

I don't understand this, because the example you gave seems to compile
without a problem, other than that the line length is far greater than
my page width.

The bar that seems to cause most of the problems is:

        g8\< a b cs( ~ cs\mf\> b) d,\mp cs |
        g8\< g a g fs4\mf\> r\! |
        d8\< e fs e as,(\mf\> b) r4\! |
        e2\< d4\mf\> fs8(--\mp fs)-- |

This is a "parallelMusic" bar for a standard string quartet.  The
warnings are produced by the decrescendo, and this hairpin has zero
actual length, despite the \myHairpinMinimumLength setting.  This
happens in each of the parts (apart from the viola), but not in the
score.  Presumably the extra quaver in the viola part saves the score
and the viola part from getting this too-short hairpin, but then the
viola part gives a similar warning in a later bar.

I am using Lilypond 2.19.30.

David



On Sat, 2015-12-12 at 22:35 +0100, Thomas Morley wrote:
> 2015-12-12 17:46 GMT+01:00 David Sumbler <address@hidden>:
> > Although I quite often find myself needing to use
> >
> > \override Voice.Hairpin.minimum-length = #2
> >
> > or similar, I find that the results are unpredictable (to me!)
> >
> > Sometimes I have a very short hairpin, perhaps starting on a quaver and
> > ending on the next quaver.  In the output such a hairpin sometimes
> > appears as a short vertical line (i.e. with length=0), and a warning is
> > shown in the compiler output.
> >
> > If I change Hairpin.minimum-length I have to do it by trial and error,
> > because the result does not seem necessarily to correspond to the value
> > I have specified.  (I am assuming that the units are staff spaces.)  I'm
> > guessing that this may perhaps be something to do with having an actual
> > dynamic such as mf attached to one or both notes.
> 
> It's issue 2207
> https://sourceforge.net/p/testlilyissues/issues/2207/
> 
> >
> > The Internals Reference says that use of the minimum-length property
> > with a hairpin "requires an appropriate callback for the
> > springs-and-rods property".  Unfortunately I have no clear idea what
> > this means, and I haven't managed to find out yet either by searching or
> > by experimentation.  The best I have come up with so far is
> >
> > \override Hairpin.springs-and-rods = #ly:spanner::set-spacing-rods
> 
> This is already the default for Hairpins (but nor for Glissando par example)
> No need to set it again in your file.
> 
> >
> > This doesn't improve the output at all, but at least it doesn't produce
> > any additional error or warning!
> >
> > How can I guarantee that all hairpins will be printed with a minimum
> > length of, say, 1.5 staff spaces, and the notes spaced appropriately,
> > regardless of preceding or following dynamics?
> 
> You may find the discussion at the linked issue enlightning.
> 
> For now you may try the following as a workaround.
> Though, please be aware it's not tested beyond the example, your turn ;)
> Ofcorse I'll try to improve the code, if you notice issues
> 
> \version "2.18.2"
> 
> %% a helper:
> #(define (look-up-for-parent name-symbol axis grob)
> "Return the parent of @var{grob}, specified by it's @var{name-symbol} in
> axis @var{axis} or @var{grob}, if equal to the grob named @var{name-symbol}
> already.
> If not found, look up for the next parent."
>  (let* ((parent (ly:grob-parent grob axis)))
>  (cond
>    ((not (ly:grob? parent))
>     (ly:error
>        (_"Perhaps typing error for \"~a\" or \"~a\" is not in the 
> parent-tree.")
>        name-symbol name-symbol))
>    ((equal? name-symbol (grob::name grob)) grob)
>    ((not (equal? name-symbol (grob::name parent)))
>     (look-up-for-parent name-symbol axis parent))
>    (else parent))))
> 
> #(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 (abs (cdr left-x-ext)) (abs (cdr right-x-ext)))))))
> 
> myHairpinMinimumLength =
> #(define-music-function (parser location minimum)(number?)
> #{
>   \override Hairpin.before-line-breaking =
>     #(hairpin-minimum-length minimum)
> #})
> 
> {
>     \override Hairpin.color = #red
>     \myHairpinMinimumLength #1.5
>     \repeat unfold 8 { c4\ffff\> d\pppp\! c d \noBreak }
>     \break
>     %% overriding 'minimum-length is still possible
>     \override Hairpin.minimum-length = 20
>     \repeat unfold 8 { c4\ffff\> d\pppp\! c d \noBreak }
> }
> 
> 
> 
> HTH,
>   Harm





reply via email to

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