lilypond-user
[Top][All Lists]
Advanced

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

Re: Hairpin endings


From: Andrew Bernard
Subject: Re: Hairpin endings
Date: Sun, 23 Apr 2017 23:42:14 +1000

A correction to the code - the hairpin was not starting at the correct place after a dynamic, but was starting at zero offset. Here's the fix:

      (cons 0 (interval-start Y-ext)))))
->
      (cons (interval-start X-ext) (interval-start Y-ext)))))

Andrew

== snip

% Open hairpin.
% By Nathan Ho and David Nalesnik.
#(define ((open-hairpin left-open right-open) grob)
   (let* ((stencil (ly:hairpin::print grob))
          (X-ext (ly:stencil-extent stencil X))
          (Y-ext (ly:stencil-extent stencil Y))
          (width (interval-length X-ext))
          (height (interval-length Y-ext)))
     (ly:stencil-translate
      (ly:stencil-add
       (ly:line-interface::line
        grob
        0 (* height (- 0.5 (* 0.5 left-open)))
        width (* height (- 0.5 (* 0.5 right-open))))
       (ly:line-interface::line
        grob
        0 (* height (+ 0.5 (* 0.5 left-open)))
        width (* height (+ 0.5 (* 0.5 right-open)))))
      (cons (interval-start X-ext) (interval-start Y-ext)))))

== snip



On 23 April 2017 at 22:31, David Nalesnik <address@hidden> wrote:
On Sun, Apr 23, 2017 at 5:34 AM, Andrew Bernard
<address@hidden> wrote:
> Hi David and Nathan,
>
> Apologies for a tardy response.
>
> Sincere thanks to both of you for your work on this. It's really useful to
> me. I prefer using the ly:line-interface::line version because of the way it
> inherits the grob properties.
>
> David, you naturally asked for the use cases I have for this, because it is
> very non-standard, for sure. There are several situations where this comes
> up in the scores I set. One common case is where the composer indicates a
> very long cresc. or decresc. between levels with open hairpins near an
> absolute mark such as ff, rather than cluttering page after page with
> immensely long hairpins. The attached snippet of an image gives some idea of
> this.

Thanks -- makes a lot more sense to me now.

>
> Once more, sincere thanks and appreciation.
>
> Next thing to do is to achieve the half dashed/half solid appearance - or
> can this be done already, in the same way that slurs can?
>

Not currently.  I suppose the best way would be to allow for
dash-definition in lily/line-interface.cc, so it could be read from
the grob.  But you could go the replacement stencil route.  I'm
guessing that you could make good use of Harm's code above as a
framework.

No time right now, but I should post my Scheme version of
ly:hairpin::print, so you can meddle directly with hairpins without
building a stencil solely for dimension info, then throwing it away.

-David


reply via email to

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