lilypond-user
[Top][All Lists]
Advanced

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

Re: Shorten hairpin


From: David Nalesnik
Subject: Re: Shorten hairpin
Date: Thu, 19 Mar 2015 09:01:30 -0500

Hi Joram,

On Thu, Mar 19, 2015 at 8:12 AM, Noeck <address@hidden> wrote:
Hi,

I would like to shorten a hairpin like in this example:

\relative c'' {
  <b c>8\< q q q\!
}

The left end should start with the beam, the right end should stay the
same. How can I do this?


I suppose a decent solution to this would involve writing the stencil callback for Hairpin to allow displacement of the endpoints.  (Some addition to the C++ code?)  Then it would straightforward to read the coordinates of this or that related object, and adjust the hairpin's length accordingly.

The following works, at least for your example.  It resets the parent of the left bound of the Hairpin spanner to a Stem object.  You asked for the beam, specifically, but I don't know that there would be any appreciable difference.

I haven't tested this beyond your example, so I can't say what will happen in a real-world example.  Anyway...

%%%
\version "2.19.17"

#(define (shorten-hairpin grob)
   (let ((rb (ly:spanner-bound grob LEFT)))
     (if (grob::has-interface rb 'note-column-interface)
         (let ((stem (ly:grob-object rb 'stem)))
           (if (ly:grob? stem)
               (ly:spanner-set-bound! grob LEFT stem))))
     ; return default for after-line-breaking
     ly:spanner::kill-zero-spanned-time))

\relative c'' {
  \override Hairpin.after-line-breaking = #shorten-hairpin
  <b c>8\< q q q\!
}

%%%

--David


reply via email to

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