Re: Hairpin endings

2017-04-24 Thread Thomas Morley
Hi David,

2017-04-24 1:34 GMT+02:00 David Nalesnik :
> On Sun, Apr 23, 2017 at 6:15 PM, Thomas Morley  
> wrote:
>> 2017-04-23 12:34 GMT+02:00 Andrew Bernard :
>>
>>> 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?
>>
>> How about:
>
> This is great!

Glad you like it.

>
>>
>> #(define (solid-dashed-print-proc grob startx starty endx endy)
>>   (let* ((dash-def (ly:grob-property grob 'dash-definition))
>>  (thick
>>(* (layout-line-thickness grob)
>>   (ly:grob-property grob 'thickness 0.1
>> (if (null? dash-def)
>> (ly:line-interface::line grob startx starty endx endy)
>> (apply ly:stencil-add empty-stencil
>
> Why not reduce instead of apply?  Tiny point, but then you won't have
> the extra empty stencil in the stencil expression.

True, so the above should read:

[...]
 (reduce ly:stencil-add empty-stencil
[...]

Thanks,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-23 Thread David Nalesnik
On Sun, Apr 23, 2017 at 6:15 PM, Thomas Morley  wrote:
> 2017-04-23 12:34 GMT+02:00 Andrew Bernard :
>
>> 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?
>
> How about:

This is great!

>
> #(define (solid-dashed-print-proc grob startx starty endx endy)
>   (let* ((dash-def (ly:grob-property grob 'dash-definition))
>  (thick
>(* (layout-line-thickness grob)
>   (ly:grob-property grob 'thickness 0.1
> (if (null? dash-def)
> (ly:line-interface::line grob startx starty endx endy)
> (apply ly:stencil-add empty-stencil

Why not reduce instead of apply?  Tiny point, but then you won't have
the extra empty stencil in the stencil expression.

>   (map
> (lambda (dash-def-elt)
>   (let* ((start-x
>(+ startx (* (- endx startx) (first dash-def-elt
>  (start-y
>(+ starty (* (- endy starty) (first dash-def-elt
>  (end-x
>(+ startx (* (- endx startx) (second dash-def-elt
>  (end-y
>(+ starty (* (- endy starty)  (second dash-def-elt)
> (ly:stencil-translate
>   (ly:make-stencil
> (list 'dashed-line
>   ;; thickness
>   thick
>   ;; on
>   (third dash-def-elt)
>   ;; off
>   (- 1 (fourth dash-def-elt)) ;; calculation correct?
>   ;; x-dest
>   (- end-x start-x)
>   ;; y-dest
>   (- end-y start-y)
>   ;; phase
>   0)
> ;; x-ext
> (cons start-x (- end-x start-x))
> ;; y-ext
> (ordered-cons 0 (- end-y start-y)))
>   (cons start-x start-y
> dash-def)
>
> #(define ((open-hairpin open-gap close-gap) grob)
>(let* ((stencil (ly:hairpin::print grob))
>   (thick (layout-line-thickness grob))
>   (dir (ly:grob-property grob 'grow-direction))
>   (X-ext (ly:stencil-extent stencil X))
>   (Y-ext (ly:stencil-extent stencil Y))
>   (width (- (interval-length X-ext) thick))
>   (height (- (interval-length Y-ext) thick))
>   (scaled-height (* height (max open-gap close-gap)))
>   (scaled-gap (* height (min open-gap close-gap)))
>   (upper-stil-part
> (solid-dashed-print-proc
>   grob
>   0
>   (/ (if (= dir -1) scaled-height scaled-gap) 2)
>   width
>   (/ (if (= dir -1) scaled-gap scaled-height) 2
>  (ly:stencil-translate
>(ly:stencil-add
>  upper-stil-part
>  (ly:stencil-scale upper-stil-part 1 -1))
>(cons (interval-start X-ext) (interval-start Y-ext)
>
> {
>   c'1\> c'1 c'1\!
>   \once \override Hairpin.dash-definition =
> #'((0  0.300.4)
>(0.30.711)
>(0.71.00.4  0.75))
>   %% order of arguments for 'open-hairpin' doesn't matter!
>   \override Hairpin.stencil = #(open-hairpin 0.2 1.0)
>   c'1\fff\> c'1 c'2 c'2\\!
>   \once \override Hairpin.dash-definition =
> #'((0  0.300.4)
>(0.30.4511)
>(0.71.00.4  0.3))
>   \once \override Hairpin.thickness = 2
>   c'1\< c'1 c'1\!
>   \revert Hairpin.dash-definition
>   \override Hairpin.style = #'dashed-line
>   \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
>   c'1\> c'1 c'1\!
>   \override Hairpin.dash-fraction = 0.3
>   \override Hairpin.dash-period = 1.5
>   \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
>   c'1-\tweak thickness 3 \> c'1 c'1\!
> }
>
> HTH,
>   Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-23 Thread Thomas Morley
2017-04-23 12:34 GMT+02:00 Andrew Bernard :

> 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?

How about:

#(define (solid-dashed-print-proc grob startx starty endx endy)
  (let* ((dash-def (ly:grob-property grob 'dash-definition))
 (thick
   (* (layout-line-thickness grob)
  (ly:grob-property grob 'thickness 0.1
(if (null? dash-def)
(ly:line-interface::line grob startx starty endx endy)
(apply ly:stencil-add empty-stencil
  (map
(lambda (dash-def-elt)
  (let* ((start-x
   (+ startx (* (- endx startx) (first dash-def-elt
 (start-y
   (+ starty (* (- endy starty) (first dash-def-elt
 (end-x
   (+ startx (* (- endx startx) (second dash-def-elt
 (end-y
   (+ starty (* (- endy starty)  (second dash-def-elt)
(ly:stencil-translate
  (ly:make-stencil
(list 'dashed-line
  ;; thickness
  thick
  ;; on
  (third dash-def-elt)
  ;; off
  (- 1 (fourth dash-def-elt)) ;; calculation correct?
  ;; x-dest
  (- end-x start-x)
  ;; y-dest
  (- end-y start-y)
  ;; phase
  0)
;; x-ext
(cons start-x (- end-x start-x))
;; y-ext
(ordered-cons 0 (- end-y start-y)))
  (cons start-x start-y
dash-def)

#(define ((open-hairpin open-gap close-gap) grob)
   (let* ((stencil (ly:hairpin::print grob))
  (thick (layout-line-thickness grob))
  (dir (ly:grob-property grob 'grow-direction))
  (X-ext (ly:stencil-extent stencil X))
  (Y-ext (ly:stencil-extent stencil Y))
  (width (- (interval-length X-ext) thick))
  (height (- (interval-length Y-ext) thick))
  (scaled-height (* height (max open-gap close-gap)))
  (scaled-gap (* height (min open-gap close-gap)))
  (upper-stil-part
(solid-dashed-print-proc
  grob
  0
  (/ (if (= dir -1) scaled-height scaled-gap) 2)
  width
  (/ (if (= dir -1) scaled-gap scaled-height) 2
 (ly:stencil-translate
   (ly:stencil-add
 upper-stil-part
 (ly:stencil-scale upper-stil-part 1 -1))
   (cons (interval-start X-ext) (interval-start Y-ext)

{
  c'1\> c'1 c'1\!
  \once \override Hairpin.dash-definition =
#'((0  0.300.4)
   (0.30.711)
   (0.71.00.4  0.75))
  %% order of arguments for 'open-hairpin' doesn't matter!
  \override Hairpin.stencil = #(open-hairpin 0.2 1.0)
  c'1\fff\> c'1 c'2 c'2\\!
  \once \override Hairpin.dash-definition =
#'((0  0.300.4)
   (0.30.4511)
   (0.71.00.4  0.3))
  \once \override Hairpin.thickness = 2
  c'1\< c'1 c'1\!
  \revert Hairpin.dash-definition
  \override Hairpin.style = #'dashed-line
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \override Hairpin.dash-fraction = 0.3
  \override Hairpin.dash-period = 1.5
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1-\tweak thickness 3 \> c'1 c'1\!
}

HTH,
  Harm
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-23 Thread Andrew Bernard
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  wrote:

> On Sun, Apr 23, 2017 at 5:34 AM, Andrew Bernard
>  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
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-23 Thread David Nalesnik
On Sun, Apr 23, 2017 at 5:34 AM, Andrew Bernard
 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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-22 Thread Thomas Morley
2017-04-21 19:15 GMT+02:00 Thomas Morley :
> 2017-04-21 14:39 GMT+02:00 David Nalesnik :

> The code for "Ferneyhough" hairpins uses make-connected-path-stencil,
> hence it will not work for this purpose.
>
> Below a rewrite using make-path-stencil:
[...]
> Probably worth a patch.

[...]

I newly rewrote it, now using ly:line-interface::line.

It's now
https://sourceforge.net/p/testlilyissues/issues/5123/
with patch.

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-21 Thread David Nalesnik
Hi Nathan,

On Fri, Apr 21, 2017 at 12:54 PM, Nathan Ho  wrote:
> On 2017-04-21 05:39, David Nalesnik wrote:
>>
>> Instead of using a markup, why not use ly:line-interface::line
>> (available from 2.19.27)? This gets thickness from the grob--and any
>> other line attributes you want, so you can create dashed hairpins,
>> whatever.  There's no need adjust thickness in this case.
>
>
> Hi David,
>
> Thanks for the info. I still prefer markups for this kind of thing because
> more people understand them and they're (somewhat) better documented. Less
> ly:foo stuff I have to look up, the better. Good to know the proper way
> though!
>

OK, I see.

Anyway, in case anyone wonders, here is how your function would look:

\version "2.19.59"

#(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 0 (interval-start Y-ext)

{
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1\> c'1 c'1\!
  \override Hairpin.style = #'dashed-line
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1-\tweak thickness 3 \> c'1 c'1\!
}

%%%

-David

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-21 Thread Nathan Ho

On 2017-04-21 05:39, David Nalesnik wrote:

Instead of using a markup, why not use ly:line-interface::line
(available from 2.19.27)? This gets thickness from the grob--and any
other line attributes you want, so you can create dashed hairpins,
whatever.  There's no need adjust thickness in this case.


Hi David,

Thanks for the info. I still prefer markups for this kind of thing 
because more people understand them and they're (somewhat) better 
documented. Less ly:foo stuff I have to look up, the better. Good to 
know the proper way though!



Nathan

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-21 Thread Thomas Morley
2017-04-21 14:39 GMT+02:00 David Nalesnik :
> Hi,
>
> On Fri, Apr 21, 2017 at 1:07 AM,   wrote:
>> Am 2017-04-21 07:41, schrieb Nathan Ho:
>>>
>>> On 2017-04-20 20:42, Andrew Bernard wrote:

 I posted a while ago with a query about hairpins, to which no
 response.

 Would there be any way to have hairpins that don't start, or end in
 the other direction, with the lines converging to the same point? I
 have need from time to time of hairpins where the end points are still
 separated, rather than coming to a termination together. Sure this can
 be done with a whiteout box, but that is always fiddly and the
 position tends to move when the score is repaginated etc etc. In the
 same way as the 'height' property allows you to specify the separation
 at the open end, it would be useful to have some property for this
 sort of thing at the pointy end. Yes, definitely not Common Era
 engraving practice, but this keeps coming up in the New Complexity
 scores I work with.
>
> Besides Nathan's code below, you might be able to use the
> "Ferneyhough" hairpins.
>
> Can you provide an usage example of these partial hairpins?  How would
> they behave over line breaks?

The code for "Ferneyhough" hairpins uses make-connected-path-stencil,
hence it will not work for this purpose.

Below a rewrite using make-path-stencil:

#(define ((elbowed-hairpin coords mirrored?) grob)
  "Create hairpin based on a list of @var{coords} in @code{(cons x y)}
form.  @code{x} is the portion of the width consumed for a given line
and @code{y} is the portion of the height.  For example,
@code{'((0 . 0) (0.3 . 0.7) (0.8 . 0.9) (1.0 . 1.0))} means that at the point
where the hairpin has consumed 30% of its width, it must
be at 70% of its height.  Once it is to 80% width, it
must be at 90% height.  It finishes at 100% width and 100% height.
If @var{coords} does not begin with @code{'(0 . 0)} the final hairpin will have
an open tip.  For example '(0 . 0.5) will cause an open end of 50% of the usual
height.
@var{mirrored?} indicates if the hairpin is mirrored over the Y-axis or if
just the upper part is drawn.
Returns a function that accepts a hairpin grob as an argument
and draws the stencil based on its coordinates.

@lilypond[verbatim,quote]
#(define simple-hairpin
  (elbowed-hairpin '((0 . 0)(1.0 . 1.0)) #t))

\\relative c' {
  \\override Hairpin #'stencil = #simple-hairpin
  a\\p\\< a a a\\f
}
@end lilypond
"
  (define (normalize-coords goods x y)
(map
  (lambda (coord)
(cons (* x (car coord)) (* y (cdr coord
  goods))

  (define (my-c-p-s points thick decresc?)
(let ((start-point (car points)))
  (make-path-stencil
(append
  `(moveto
,(car start-point)
,(cdr start-point))
  (append-map
(lambda (elt)
  (list 'lineto (car elt) (cdr elt)))
(cdr points)))
thick
(if decresc? -1.0 1.0)
1.0
#f)))
  ;; outer let to trigger suicide
  (let ((sten (ly:hairpin::print grob)))
(if (grob::is-live? grob)
(let* ((decresc? (eqv? (ly:grob-property grob 'grow-direction) LEFT))
   (thick (ly:grob-property grob 'thickness 0.1))
   (thick (* thick (layout-line-thickness grob)))
   (xex (ly:stencil-extent sten X))
   (lenx (interval-length xex))
   (yex (ly:stencil-extent sten Y))
   (leny (interval-length yex))
   (xtrans (+ (car xex) (if decresc? lenx 0)))
   (ytrans (car yex))
   (uplist (normalize-coords coords lenx (/ leny 2)))
   (downlist (normalize-coords coords lenx (/ leny -2)))
   (stil
 (ly:stencil-aligned-to
   (ly:stencil-translate
 (ly:stencil-add
   (my-c-p-s uplist thick decresc?)
   (if mirrored?
   (my-c-p-s downlist thick decresc?)
   empty-stencil))
 (cons xtrans ytrans))
   Y CENTER))
   (stil-y-extent (ly:stencil-extent stil Y)))
;; Return a final stencil properly aligned in Y-axis direction and with
;; proper extents. Extent in X-axis direction is taken from the
;; original, in Y-axis direction from the new stencil.
;; Otherwise stencil-operations like 'box-stencil' will return badly.
(ly:make-stencil (ly:stencil-expr stil) xex stil-y-extent))
;; return empty if no Hairpin.stencil present.
'(

%%
%% EXAMPLE
%%

{
  \override Hairpin.to-barline = ##f
  \once \override Hairpin.stencil =
#(elbowed-hairpin '((0.0 . 0.4)(1.0 . 1.2)) #t)
  c'4\> c'' c''' d'''\! d'''1

  \once \override Hairpin.stencil =
#(elbowed-hairpin '((0.0 . 0.0)(1.0 . 0.5)) #t)
  c'1\pp\<
  

Re: Hairpin endings

2017-04-21 Thread David Nalesnik
Hi,

On Fri, Apr 21, 2017 at 1:07 AM,   wrote:
> Am 2017-04-21 07:41, schrieb Nathan Ho:
>>
>> On 2017-04-20 20:42, Andrew Bernard wrote:
>>>
>>> I posted a while ago with a query about hairpins, to which no
>>> response.
>>>
>>> Would there be any way to have hairpins that don't start, or end in
>>> the other direction, with the lines converging to the same point? I
>>> have need from time to time of hairpins where the end points are still
>>> separated, rather than coming to a termination together. Sure this can
>>> be done with a whiteout box, but that is always fiddly and the
>>> position tends to move when the score is repaginated etc etc. In the
>>> same way as the 'height' property allows you to specify the separation
>>> at the open end, it would be useful to have some property for this
>>> sort of thing at the pointy end. Yes, definitely not Common Era
>>> engraving practice, but this keeps coming up in the New Complexity
>>> scores I work with.

Besides Nathan's code below, you might be able to use the
"Ferneyhough" hairpins.

Can you provide an usage example of these partial hairpins?  How would
they behave over line breaks?

>>
>> hi andrew,
>>
>> check it out:
>>
>> #(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
>>(grob-interpret-markup grob
>>  (markup
>>(#:path 0.1
>>  (list (list 'moveto 0 (* height (- 0.5 (* 0.5 left-open
>>(list 'lineto width (* height (- 0.5 (* 0.5
>> right-open
>>(list 'moveto 0 (* height (+ 0.5 (* 0.5 left-open
>>(list 'lineto width (* height (+ 0.5 (* 0.5
>> right-open
>>(cons 0 (interval-start Y-ext)
>>
>> {
>>   c'1\> c'1 c'1\!
>>   \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
>>   c'1\> c'1 c'1\!
>>   \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
>>   c'1\> c'1 c'1\!
>> }
>>
>> respects height, but not thickness. anyone know how to convert a
>> thickness value into staff spaces?
>
>
> If I'm not mistaken this actually is a missing piece of information in
> LilyPond.
> The thickness is interpreted as relative to the staffline thickness, and
> there's no general property for it.
> It should be possible to use something like (untested)
>
> (hairpin-thickness (* (ly:staff-symbol-line-thickness grob)
> (ly:grob-property grob 'thickness)))
>
> in the let-block and use hairpin-thickness in the markup generation.
>

Yes, this would work

Instead of using a markup, why not use ly:line-interface::line
(available from 2.19.27)? This gets thickness from the grob--and any
other line attributes you want, so you can create dashed hairpins,
whatever.  There's no need adjust thickness in this case.

HTH,
David

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Hairpin endings

2017-04-20 Thread Nathan Ho

On 2017-04-20 20:42, Andrew Bernard wrote:

I posted a while ago with a query about hairpins, to which no
response.

Would there be any way to have hairpins that don't start, or end in
the other direction, with the lines converging to the same point? I
have need from time to time of hairpins where the end points are still
separated, rather than coming to a termination together. Sure this can
be done with a whiteout box, but that is always fiddly and the
position tends to move when the score is repaginated etc etc. In the
same way as the 'height' property allows you to specify the separation
at the open end, it would be useful to have some property for this
sort of thing at the pointy end. Yes, definitely not Common Era
engraving practice, but this keeps coming up in the New Complexity
scores I work with.


hi andrew,

check it out:

#(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
   (grob-interpret-markup grob
 (markup
   (#:path 0.1
 (list (list 'moveto 0 (* height (- 0.5 (* 0.5 left-open
   (list 'lineto width (* height (- 0.5 (* 0.5 
right-open

   (list 'moveto 0 (* height (+ 0.5 (* 0.5 left-open
   (list 'lineto width (* height (+ 0.5 (* 0.5 
right-open

   (cons 0 (interval-start Y-ext)

{
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1\> c'1 c'1\!
}

respects height, but not thickness. anyone know how to convert a 
thickness value into staff spaces?



nathan

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user