Re: Broken Hairpin

2018-05-18 Thread foxfanfare
Thomas Morley-2 wrote
> No idea why alterBroken's not working, too late here to investigate.
> 
> Anyway, below may give you a starting point for a different coding:
> 
>   \override Hairpin.after-line-breaking =
>   #(lambda (grob)
>  (let* ((orig (ly:grob-original grob))
> (siblings (if (ly:grob? orig)
>   (ly:spanner-broken-into orig) '(
>(if (and (pair? siblings) (equal? grob (car siblings)))
>(ly:grob-set-property! grob 'thickness 10
> 
> Cheers,
>   Harm

Thank you Harm for this solution. This morning I tried alterBroken with
other propreties and it worked in certain cases.

For instance, the Y-offset property works well (which is good because it is
what I needed). But the exemple of thickness as written in the documentation
doesn't seem to work for hairpins, even when not written in a dynamic
context.

\new PianoStaff
<<
  \relative c' {
c4 d e f
\break
g_"working" f e d
\break 
c4 d -\alterBroken thickness #'(5 1) \< e f
\break
g^"not working" f\! e d
\break 
  }
  \new Dynamics {
\override PianoStaff.Hairpin.to-barline = ##f
\override PianoStaff.Hairpin.after-line-breaking = ##t
s1 -\alterBroken Y-offset #'(0 -7.5) \<
s2\! s

  }
  \relative c' {
c4 d e f
g f e d
c4 d e f
g f e d
  }
>> 



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Broken Hairpin

2018-05-17 Thread Thomas Morley
2018-05-17 15:47 GMT+02:00 foxfanfare <foxfanf...@gmx.com>:
> Kieren MacMillan wrote
>> Hi foxfanfare,
>>
>>> Is it possible to adjust the padding of a broken hairpin after a line
>>> break?
>>
>> http://lilypond.org/doc/v2.18/Documentation/notation/modifying-broken-spanners
>>
>> Hope that helps!
>> Kieren.
>> 
>>
>> Kieren MacMillan, composer
>> ‣ website: www.kierenmacmillan.info
>> ‣ email:
>
>> info@
>
>>
>>
>> ___
>> lilypond-user mailing list
>
>> lilypond-user@
>
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> Thank you Kieren.
> It is a good lead, but unfortunately I can't get it to work in a dynamic
> context:
>
> \new PianoStaff
> <<
>   \relative c' {
> c4 d e -\alterBroken thickness #'(10 1) ^( f
> \break
> g f) e d
>   }
>   \new Dynamics {
> \override PianoStaff.Hairpin.to-barline = ##f
> \override PianoStaff.Hairpin.after-line-breaking = ##t
> s1 -\alterBroken thickness #'(10 1) \<
> s2\! s
>   }
>   \relative c' {
> c4 d e f
> g f e''' d
>   }
>>>
>
> Am I missing something?


No idea why alterBroken's not working, too late here to investigate.

Anyway, below may give you a starting point for a different coding:

  \override Hairpin.after-line-breaking =
  #(lambda (grob)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig) '(
   (if (and (pair? siblings) (equal? grob (car siblings)))
   (ly:grob-set-property! grob 'thickness 10

Cheers,
  Harm

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


Re: Broken Hairpin

2018-05-17 Thread foxfanfare
Kieren MacMillan wrote
> Hi foxfanfare,
> 
>> Is it possible to adjust the padding of a broken hairpin after a line
>> break?
> 
> http://lilypond.org/doc/v2.18/Documentation/notation/modifying-broken-spanners
> 
> Hope that helps!
> Kieren.
> 
> 
> Kieren MacMillan, composer
> ‣ website: www.kierenmacmillan.info
> ‣ email: 

> info@

> 
> 
> ___
> lilypond-user mailing list

> lilypond-user@

> https://lists.gnu.org/mailman/listinfo/lilypond-user

Thank you Kieren.
It is a good lead, but unfortunately I can't get it to work in a dynamic
context:

\new PianoStaff
<<
  \relative c' {
c4 d e -\alterBroken thickness #'(10 1) ^( f
\break
g f) e d
  }
  \new Dynamics {
\override PianoStaff.Hairpin.to-barline = ##f
\override PianoStaff.Hairpin.after-line-breaking = ##t
s1 -\alterBroken thickness #'(10 1) \<
s2\! s
  }
  \relative c' {
c4 d e f
g f e''' d
  }
>> 

Am I missing something?



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Broken Hairpin

2018-05-17 Thread Kieren MacMillan
Hi foxfanfare,

> Is it possible to adjust the padding of a broken hairpin after a line break?

http://lilypond.org/doc/v2.18/Documentation/notation/modifying-broken-spanners

Hope that helps!
Kieren.


Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


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


Broken Hairpin

2018-05-17 Thread foxfanfare
Hi,

Is it possible to adjust the padding of a broken hairpin after a line break?

For instance:

\new PianoStaff
<<
  \relative c' {
c4 d e f
\break
g f e d
  }
  \new Dynamics {
\override PianoStaff.Hairpin.to-barline = ##f
\override PianoStaff.Hairpin.after-line-breaking = ##t
s1\<
s2\! s
  }
  \relative c' {
c4 d e f
g f e''' d
  }
>>

If I use Hairpin.Y-offset, both parts will move, or I'd like to move the
second hairpin only!
I'm stuck here...



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Broken Hairpin height not affected by \alterBroken

2014-07-02 Thread Pierre Perol-Schneider
2014-07-02 4:37 GMT+02:00 Javier Ruiz-Alma jav...@ruiz-alma.com:

 The 2nd Hairpin.height value in \alterBroken seems to get ignored.  Is
 this a limitation, or my bad syntax?


None of them. I thing it could be considered as a bug.
Cheers,
Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Broken Hairpin height not affected by \alterBroken

2014-07-02 Thread Thomas Morley
2014-07-02 4:37 GMT+02:00 Javier Ruiz-Alma jav...@ruiz-alma.com:
 The 2nd Hairpin.height value in \alterBroken seems to get ignored.  Is this
 a limitation, or my bad syntax?
 I'm dealing with a broken multi-bar hairpin.  Not being able to adjust
 heights per segment results in either too-narrow first or too-wide second
 hairpin segment.
 \version 2.18.2
 \paper { ragged-right = ##t indent = 0.0 }
 \relative c' {
 \alterBroken height #'( 1.5 0.3 ) Hairpin
 c\ c c c c c c c c c c c \break
 c c c c c c c c\!
 }

Hi Javier,

IMHO the untweaked output of your code is _exactly_ what I want to see
for a broken Hairpin.

Nevertheless, the reason alterBroken does not work here, seems to be
that during an override for Hairpin.height no broken Spanner is
recognized. See the output of this test-code:

\version 2.18.2

\paper { ragged-right = ##t indent = 0.0 }

%% tests whether broken Hairpins are recognized during an 'height-override
test =
  \override Hairpin.height =
#(lambda (grob)
  (let* ((orig (ly:grob-original grob))
 (siblings (ly:spanner-broken-into orig)))
  (if (null? siblings)
  (display \n\tno broken spanner found))
  ;; default value:
  0.))

\relative c' {
  \test
  c1\ c c \break c c c\!
}

Overriding the 'after-line-breaking property will work, though.
(Too lazy to turn it into a music-function)

\version 2.18.2

%% tweaks a broken Hairpin 'height
height-tweak =
  \override Hairpin.after-line-breaking =
  #(lambda (grob)
(let* ((orig (ly:grob-original grob))
   (siblings (ly:spanner-broken-into orig)))
(if (= (length siblings) 2)
(begin
  (if (equal? grob (car siblings))
  (ly:grob-set-property! grob 'height 1.5))
  (if (equal? grob (cadr siblings))
  (ly:grob-set-property! grob 'height 0.3))

\relative c' {
  \height-tweak
  c1\ c c \break
  c c c\!
}

HTH,
  Harm

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


Re: Broken Hairpin height not affected by \alterBroken

2014-07-02 Thread David Nalesnik
Hi,


On Wed, Jul 2, 2014 at 3:37 AM, Thomas Morley thomasmorle...@gmail.com
wrote:



 Overriding the 'after-line-breaking property will work, though.
 (Too lazy to turn it into a music-function)


Yes, it does.  This is an unfortunate limitation of \alterBroken--the
spanner may not be broken at the time the property is set.

It isn't that difficult to rewrite \alterBroken in terms of
'after-line-breaking (and return the default setting as recommended in
Difficult Tweaks in the Extending manual); however, I'm not sure how
multiple tweaks of the same object could be achieved (outside of allowing
the function to take a list of property/value settings).

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


Broken Hairpin height not affected by \alterBroken

2014-07-01 Thread Javier Ruiz-Alma
The 2nd Hairpin.height value in \alterBroken seems to get ignored.  Is this a 
limitation, or my bad syntax?I'm dealing with a broken multi-bar hairpin.  Not 
being able to adjust heights per segment results in either too-narrow first or 
too-wide second hairpin segment.
 
\version 2.18.2
\paper { ragged-right = ##t indent = 0.0 }
\relative c' {
\alterBroken height #'( 1.5 0.3 ) Hairpin
c\ c c c  c c c c  c c c c \break
c c c cc c c c\!
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: shorten a broken hairpin at a linebreak?

2011-09-08 Thread harm6


David Nalesnik-2 wrote:
 
 tweaking the decrescendi like the diminuendi and doing some minor
 changes, I
 come up with:
 
Ooops, should be: tweaking the crescendi like the diminuendi 


 Looks great!  I'll definitely use this, though something tells me I won't
 run into quite as extreme a situation as your example :)
 
I always test with most extreme examples, hoping to notice all possible
problems. :D


 Checking my just-bought copy of Gould, I find on pg. 104 the rule that a
 broken hairpin should stop on the barline, with an example involving a key
 change at the line break.  Maybe LilyPond's behavior should be reported as
 a
 bug (I couldn't find it listed, anyway) 
 
I think it's the intended default-behaviour. If I'm right, can you call it a
bug? 
Anyway, I'd wish lilypond would be changed to follow Gould, as you pointed
out.


 with your function as a workaround?
 
The best parts of the function are Mike's and your's, so I don't think it is
my function


 (One tiny thing: Mike went to the trouble of writing functions to
 determine
 a grob's system, and for consistency you could replace my calls to
 ly:grob-system with his find-system.)
 
Do you think of lines 26 and 57 of the attached file?



Some other points:

Tweaking a TextSpanner I build:

\version 2.14.2

textSpannerTweak = {
\override TextSpanner #'(bound-details left text) = 
\markup \italic \bold { TextSpanner } 
\override TextSpanner #'(bound-details left-broken text) = ##f 
\override TextSpanner #'(bound-details right-broken end-on-note) =
##t
\override TextSpanner #'(bound-details right-broken padding) =
#'-2.5
\override TextSpanner #'(bound-details right padding) = #'-2.5
\override TextSpanner #'style = #'line
}

%- Test


\paper {
indent = 0
}

\relative c'' {
\textSpannerTweak 
\key bes\major
\repeat unfold 4 { c c c c } 
\key d\major \break
\repeat unfold 3 { c4 c c c } 
c\startTextSpan c c c
\key ges\major \break
\repeat unfold 3 { c c c c } 
c2 c
\key cis\major \break
\repeat unfold 3 { c4 c c c }   
c c\stopTextSpan c c
}

This is very simple and I'd wished it could have been done with the hairpins
in a similiar way.

But I'm not sure how to begin the tweaking of the DynamicTextSpanner. 

engraver-init.ly states:
crescendoSpanner = #'hairpin
decrescendoSpanner = #'hairpin

spanners-init.ly states:
crescTextCresc = {
\set crescendoText = \markup { \italic cresc. }
\set crescendoSpanner = #'text
}

So I'm afraid it has to be done in the same manner as the hairpins!?

Best,
  Harm

http://old.nabble.com/file/p32427649/testBrokenHairpin-2.ly
testBrokenHairpin-2.ly 
-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32427649.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-09-07 Thread harm6


David Nalesnik-2 wrote:
 
 You're very welcome!
 
 

Hi,

tweaking the decrescendi like the diminuendi and doing some minor changes, I
come up with:

\version 2.14.2

\pointAndClickOff

 \paper { 
 ragged-right = ##f
 %right-margin = 30
 %indent = 0
 }

% Thanks to Mike Solomon and David Nalesnik
%
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--td32343028.html
 
#(define (last-bar grob)
  ;; return the X-coordinate of the last barline on a line
  (let* ((sys (ly:grob-system grob))
 (array (ly:grob-object sys 'all-elements))
 (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta)
'name)))
 (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
  (ly:grob-array-list array)))
 (bar-coords (sort (map (lambda (x) (ly:grob-relative-coordinate x
sys X)) lst) )))

 (car bar-coords)))

#(define (has-interface? grob interface)
   (member interface
  (assoc-get 'interfaces
 (ly:grob-property grob 'meta

#(define (find-system grob)
   (if (has-interface? grob 'system-interface)
   grob
   (find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
   (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
   (car grobl)
   (first-musical-column (cdr grobl

#(define (change-bound grob)
   (let* ((system (find-system grob))
  (cols (ly:grob-array-list (ly:grob-object system 'columns)))
  (musical-column (first-musical-column (reverse cols
 (ly:spanner-set-bound! grob RIGHT musical-column)))

#(define (change-broken-hairpins grob)
 (let* ((st (ly:hairpin::print grob))
(orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig)
  '()))
(gd (ly:grob-property grob 'grow-direction))
(w (ly:stencil-extent st X))
(thick (* (ly:grob-property grob 'thickness)
(ly:staff-symbol-line-thickness grob)))
(h (ly:stencil-extent st Y))
(bar-pos (last-bar grob))
(hairpin-origin (ly:grob-relative-coordinate grob (ly:grob-system
grob) X))
(add (- (interval-length (cons (cdr w) bar-pos)) 1.5))
(xr (- (+ add (cdr w)) hairpin-origin))
(ylu (if (eqv? gd LEFT)
(cdr h) 
(if (and (equal? gd RIGHT)(= (length siblings) 2) (eq? (car
siblings) grob))
   (interval-center h)  
   (interval-center (cons (interval-center h)(cdr h)))  
   )))  
(yru (if (eqv? gd RIGHT)
(cdr h) 
(interval-center (cons (interval-center h) (cdr h))) 
))
(yld (if (eqv? gd LEFT)
(car h) 
(if (and (equal? gd RIGHT)(= (length siblings) 2) (eq? (car
siblings) grob))
   (interval-center h)  
   (interval-center (cons (car h)(interval-center h)))  
   )))   
(yrd (if (eqv? gd RIGHT)
(car h) 
(interval-center (cons (car h)(interval-center h))) 
))
(new-stencil (ly:stencil-add
(make-line-stencil thick (car w) ylu xr yru)
(make-line-stencil thick (car w) yld xr yrd)))
)
   new-stencil
   ))

#(define (internal-my-callback grob fn1 fn2)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig)
 '(

  (if (and (= (length siblings) 2)
   (not (eq? (car (reverse siblings)) grob)))
(fn1 grob)
(fn2 grob

#(define (my-broken-hairpin-callback grob)
 (internal-my-callback grob change-bound values)
(internal-my-callback grob change-broken-hairpins ly:hairpin::print))

% --- Test
-

one = {
% 1
   a1\break
   \override Hairpin #'stencil = #my-broken-hairpin-callback
   \override Hairpin #'color = #red
% 2
   a\ \repeat unfold 2 { a } \break \key des \major \bar :|:
% 5
   \repeat unfold 8 { a } \break \key fis \major \bar :|:
% 13
   \repeat unfold 2 { a } \break \key ees \major \bar :|:
% 15
   \repeat unfold 17 { a } a\p \break \key ces\major \bar :|:
   
% 33 with new hairpin
   a1\ a1 \break \key cis\major \bar :|:
% 35
   a a2. a4\p
   }
   
two = {
   \override Hairpin #'stencil = #my-broken-hairpin-callback
   \override Hairpin #'color = #blue
c'1\ \repeat unfold 34 { c'1 } c'2. c'4\f
}

\score {
\new StaffGroup 
\new Staff \one
\new Staff \two

}

Seems to work.

Cheers,
  Harm
-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32419640.html
Sent

Re: shorten a broken hairpin at a linebreak?

2011-09-07 Thread harm6


harm6 wrote:
 
 ...
 

The same. Attaching the file.

http://old.nabble.com/file/p32419760/testBrokenHairpin.ly
testBrokenHairpin.ly 
-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32419760.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-09-07 Thread David Nalesnik
Hi, Harm --

tweaking the decrescendi like the diminuendi and doing some minor changes, I
 come up with:


Looks great!  I'll definitely use this, though something tells me I won't
run into quite as extreme a situation as your example :)

Checking my just-bought copy of Gould, I find on pg. 104 the rule that a
broken hairpin should stop on the barline, with an example involving a key
change at the line break.  Maybe LilyPond's behavior should be reported as a
bug (I couldn't find it listed, anyway) with your function as a workaround?

(One tiny thing: Mike went to the trouble of writing functions to determine
a grob's system, and for consistency you could replace my calls to
ly:grob-system with his find-system.)

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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread harm6


Mike Solomon-2 wrote:
 
 More control over the length is always achievable by overriding the
 stencil, as is the solution to the problem you pose above regarding the
 closing diminuendi.
 
 

Hi Mike,

great work on the closing diminuendi!!

One point left: I want each diminuendo of the broken siblings to be
increased up to the barline.
Using David's last-bar-Definition I came up with this Definition.
Problem: Some lines are fine, some not. Don't know why!

Any hint to proceed?

Cheers,
  Harm

\version 2.14.2

#(define (has-interface? grob interface)
(member interface
(assoc-get 'interfaces
   (ly:grob-property grob 'meta

#(define (find-system grob)
(if (has-interface? grob 'system-interface)
grob
(find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
(if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
(car grobl)
(first-musical-column (cdr grobl

#(define (change-bound grob)
(let* ((system (find-system grob))
   (cols (ly:grob-array-list (ly:grob-object system 'columns)))
   (musical-column (first-musical-column (reverse cols
  (ly:spanner-set-bound! grob RIGHT musical-column)))

% by David Nalesnik:

#(define (last-bar grob)
   ;; return the X-coordinate of the last barline on a line
   (let* ((sys (ly:grob-system grob))
  (array (ly:grob-object sys 'all-elements))
  (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
  (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
   (ly:grob-array-list array)))
  (bar-coords (sort (map (lambda (x) (ly:grob-relative-coordinate x sys 
X))
lst) )))
  
 (define (find-last-bar bar-coords)
   (if (null? (cdr bar-coords))
   (car bar-coords)
   (find-last-bar (cdr bar-coords
   
  (find-last-bar bar-coords)))


  
#(define (internal-my-callback grob fn1 fn2)
 (let* (
;; have we been split?
(orig (ly:grob-original grob))

;; if yes, get the split pieces (our siblings)
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig)
  '(

   (if (and (= (length siblings) 2)
(not (eq? (car (reverse siblings)) grob)))
 (fn1 grob)
 (fn2 grob

#(define (change-ends grob)
  (let* ((st (ly:hairpin::print grob))
 (gd (ly:grob-property grob 'grow-direction))
 (w (ly:stencil-extent st X))
 (thick (* (ly:grob-property grob 'thickness)
(ly:staff-symbol-line-thickness grob)))
 (h (ly:stencil-extent st Y))
 (bar-pos (last-bar grob))
 (add (interval-length (cons (cdr w) bar-pos)))
 (ylu (if (eqv? gd RIGHT) (interval-center (cons (interval-center h)
(cdr h))) (cdr h)))
 (yru (if (eqv? gd RIGHT) (cdr h) (interval-center (cons
(interval-center h) (cdr h)
 (yld (if (eqv? gd RIGHT) (interval-center (cons (car h)
(interval-center h))) (car h)))
 (yrd (if (eqv? gd RIGHT) (car h) (interval-center (cons (car h)
(interval-center h))
(ly:stencil-add
  ;(make-line-stencil thick (car w) ylu (cdr w) yru)
  ;(make-line-stencil thick (car w) yld (cdr w) yrd)
  (make-line-stencil thick (car w) ylu (+ add (cdr w)) yru)
  (make-line-stencil thick (car w) yld (+ add (cdr w)) yrd)
  )))

#(define (my-callback grob)
  (internal-my-callback grob change-bound values)
  (if (eqv? LEFT (ly:grob-property grob 'grow-direction))
 (internal-my-callback grob change-ends ly:hairpin::print)
 (ly:hairpin::print grob)))

{
% 1
a1\break
\override Hairpin #'stencil = #my-callback
\override Hairpin #'bound-padding = #my-callback 
% 2
a\ \repeat unfold 2 { a } \break
% 5
\repeat unfold 8 { a } \break \key fis \major
% 13
\repeat unfold 2 { a } \break \key ees \major
% 15
\repeat unfold 17 {a} a\! \break \key ces\major
% 33 with new hairpin
a1\ a1 \break \key cis\major
% 35
a a\!
} 


-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32381317.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread Mike Solomon
On Sep 1, 2011, at 7:42 PM, harm6 wrote:

 
 
 Mike Solomon-2 wrote:
 
 More control over the length is always achievable by overriding the
 stencil, as is the solution to the problem you pose above regarding the
 closing diminuendi.
 
 
 
 Hi Mike,
 
 great work on the closing diminuendi!!
 
 One point left: I want each diminuendo of the broken siblings to be
 increased up to the barline.
 Using David's last-bar-Definition I came up with this Definition.
 Problem: Some lines are fine, some not. Don't know why!
 
 Any hint to proceed?
 
 Cheers,
  Harm
 
 \version 2.14.2
 
 #(define (has-interface? grob interface)
 (member interface
(assoc-get 'interfaces
   (ly:grob-property grob 'meta
 
 #(define (find-system grob)
 (if (has-interface? grob 'system-interface)
grob
(find-system (ly:grob-parent grob X
 
 #(define (first-musical-column grobl)
 (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
(car grobl)
(first-musical-column (cdr grobl
 
 #(define (change-bound grob)
 (let* ((system (find-system grob))
   (cols (ly:grob-array-list (ly:grob-object system 'columns)))
   (musical-column (first-musical-column (reverse cols
  (ly:spanner-set-bound! grob RIGHT musical-column)))
 
 % by David Nalesnik:
 
 #(define (last-bar grob)
   ;; return the X-coordinate of the last barline on a line
   (let* ((sys (ly:grob-system grob))
 (array (ly:grob-object sys 'all-elements))
 (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
 (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
   (ly:grob-array-list array)))
 (bar-coords (sort (map (lambda (x) (ly:grob-relative-coordinate x sys 
 X))
 lst) )))
 
 (define (find-last-bar bar-coords)
   (if (null? (cdr bar-coords))
  (car bar-coords)
  (find-last-bar (cdr bar-coords
  
  (find-last-bar bar-coords)))
 
 
 
 #(define (internal-my-callback grob fn1 fn2)
 (let* (
;; have we been split?
(orig (ly:grob-original grob))
 
;; if yes, get the split pieces (our siblings)
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig)
  '(
 
   (if (and (= (length siblings) 2)
(not (eq? (car (reverse siblings)) grob)))
 (fn1 grob)
 (fn2 grob
 
 #(define (change-ends grob)
  (let* ((st (ly:hairpin::print grob))
 (gd (ly:grob-property grob 'grow-direction))
 (w (ly:stencil-extent st X))
 (thick (* (ly:grob-property grob 'thickness)
 (ly:staff-symbol-line-thickness grob)))
 (h (ly:stencil-extent st Y))
 (bar-pos (last-bar grob))
 (add (interval-length (cons (cdr w) bar-pos)))
 (ylu (if (eqv? gd RIGHT) (interval-center (cons (interval-center h)
 (cdr h))) (cdr h)))
 (yru (if (eqv? gd RIGHT) (cdr h) (interval-center (cons
 (interval-center h) (cdr h)
 (yld (if (eqv? gd RIGHT) (interval-center (cons (car h)
 (interval-center h))) (car h)))
 (yrd (if (eqv? gd RIGHT) (car h) (interval-center (cons (car h)
 (interval-center h))
(ly:stencil-add
  ;(make-line-stencil thick (car w) ylu (cdr w) yru)
  ;(make-line-stencil thick (car w) yld (cdr w) yrd)
  (make-line-stencil thick (car w) ylu (+ add (cdr w)) yru)
  (make-line-stencil thick (car w) yld (+ add (cdr w)) yrd)
  )))
 
 #(define (my-callback grob)
  (internal-my-callback grob change-bound values)
  (if (eqv? LEFT (ly:grob-property grob 'grow-direction))
 (internal-my-callback grob change-ends ly:hairpin::print)
 (ly:hairpin::print grob)))
 
 {
 % 1
   a1\break
   \override Hairpin #'stencil = #my-callback
   \override Hairpin #'bound-padding = #my-callback 
 % 2
   a\ \repeat unfold 2 { a } \break
 % 5
   \repeat unfold 8 { a } \break \key fis \major
 % 13
   \repeat unfold 2 { a } \break \key ees \major
 % 15
   \repeat unfold 17 {a} a\! \break \key ces\major
 % 33 with new hairpin
   a1\ a1 \break \key cis\major
 % 35
   a a\!
} 
 

Hey Harm,

Unfortunately, I won't be checking my mail for a couple weeks and I won't have 
time to verify it tonight.  Sorry!  There are several heavy-overriders on the 
list, and I'm hoping one of them will be able to help you out :)

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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread David Nalesnik
Hi Harm,


 Using David's last-bar-Definition [ . . . ]


I just wanted to point out that my definition can be shortened a little (by
sorting in order from largest coordinate to smallest):

#(define (last-bar grob)
   ;; return the X-coordinate of the last barline on a line
   (let* ((sys (ly:grob-system grob))
  (array (ly:grob-object sys 'all-elements))
  (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
  (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
   (ly:grob-array-list array)))
  (bar-coords (sort (map (lambda (x) (cdr (ly:grob-extent x sys X))) lst)
)))

 (car bar-coords)))

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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread harm6

Hi Mike, hi David,

thanks a lot for all your help! You're great.

Best,
  Harm

-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32381613.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread David Nalesnik
Hi again, Harm --


 One point left: I want each diminuendo of the broken siblings to be
 increased up to the barline.


Keep your fingers crossed, but I think I've located the problem...

You need to take into account the origin of the hairpin.  So:

 \version 2.14.2

#(define (has-interface? grob interface)
   (member interface
  (assoc-get 'interfaces
 (ly:grob-property grob 'meta

#(define (find-system grob)
   (if (has-interface? grob 'system-interface)
   grob
   (find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
   (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
   (car grobl)
   (first-musical-column (cdr grobl

#(define (change-bound grob)
   (let* ((system (find-system grob))
  (cols (ly:grob-array-list (ly:grob-object system 'columns)))
  (musical-column (first-musical-column (reverse cols
 (ly:spanner-set-bound! grob RIGHT musical-column)))

% by David Nalesnik:

#(define (last-bar grob)
  ;; return the X-coordinate of the last barline on a line
  (let* ((sys (ly:grob-system grob))
 (array (ly:grob-object sys 'all-elements))
 (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta)
'name)))
 (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
  (ly:grob-array-list array)))
 (bar-coords (sort (map (lambda (x) (ly:grob-relative-coordinate x
sys X)) lst) )))

 (car bar-coords)))



#(define (internal-my-callback grob fn1 fn2)
 (let* (
   ;; have we been split?
   (orig (ly:grob-original grob))

   ;; if yes, get the split pieces (our siblings)
   (siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig)
 '(

  (if (and (= (length siblings) 2)
   (not (eq? (car (reverse siblings)) grob)))
(fn1 grob)
(fn2 grob

#(define (change-ends grob)
 (let* ((st (ly:hairpin::print grob))
(gd (ly:grob-property grob 'grow-direction))
(w (ly:stencil-extent st X))
(thick (* (ly:grob-property grob 'thickness)
  (ly:staff-symbol-line-thickness grob)))
(h (ly:stencil-extent st Y))
(bar-pos (last-bar grob))
(hairpin-origin (ly:grob-relative-coordinate grob (ly:grob-system
grob) X))
(add (interval-length (cons (cdr w) bar-pos)))
(ylu (if (eqv? gd RIGHT)
 (interval-center (cons (interval-center h)(cdr h)))
 (cdr h)))
(yru (if (eqv? gd RIGHT)
 (cdr h)
 (interval-center (cons (interval-center h) (cdr h)
(yld (if (eqv? gd RIGHT)
 (interval-center (cons (car h)(interval-center h)))
 (car h)))
(yrd (if (eqv? gd RIGHT)
 (car h)
 (interval-center (cons (car h)(interval-center h))
   (ly:stencil-add
 ;(make-line-stencil thick (car w) ylu (cdr w) yru)
 ;(make-line-stencil thick (car w) yld (cdr w) yrd)
 (make-line-stencil thick (car w) ylu (- (+ add (cdr w)) hairpin-origin)
yru)
 (make-line-stencil thick (car w) yld (- (+ add (cdr w)) hairpin-origin)
yrd)
 )))

#(define (my-callback grob)
 (internal-my-callback grob change-bound values)
 (if (eqv? LEFT (ly:grob-property grob 'grow-direction))
(internal-my-callback grob change-ends ly:hairpin::print)
(ly:hairpin::print grob)))

{
% 1
   a1\break
   \override Hairpin #'stencil = #my-callback
   \override Hairpin #'bound-padding = #my-callback
% 2
   a\ \repeat unfold 2 { a } \break
% 5
   \repeat unfold 8 { a } \break \key fis \major
% 13
   \repeat unfold 2 { a } \break \key ees \major
% 15
   \repeat unfold 17 {a} a\p \break \key ces\major



% 33 with new hairpin
   a1\ a1 \break \key cis\major
% 35
   a a2. a4\p
   }

Hope this does the trick!

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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread David Nalesnik
On Thu, Sep 1, 2011 at 2:22 PM, David Nalesnik david.nales...@gmail.comwrote:


 Hi again, Harm --


In my eagerness, I did a rather poor job of cutting and pasting, so I'm
attaching the file :)

David


new-hairpin1.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread harm6


David Nalesnik-2 wrote:
 
 On Thu, Sep 1, 2011 at 2:22 PM, David Nalesnik
 david.nales...@gmail.comwrote:
 
 I'm attaching the file :)
 
 David
 
 

Hi David,

that's it !! 

I had experimented with the hairpin-origin, but I didn't manage to introduce
it correct.

Once more: thanks a lot!

Harm



-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32382183.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-09-01 Thread David Nalesnik
On Thu, Sep 1, 2011 at 2:52 PM, harm6 thomasmorle...@googlemail.com wrote:



 Hi David,

 that's it !!

 I had experimented with the hairpin-origin, but I didn't manage to
 introduce
 it correct.

 Once more: thanks a lot!


You're very welcome!
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: shorten a broken hairpin at a linebreak?

2011-08-31 Thread harm6


Mike Solomon-2 wrote:
 
 Hmm...I thought that after-line-breaking would be called after the bounds
 were set, but I was wrong.
 
 Try:
 
 #(define (has-interface? grob interface)
  (member interface
  (assoc-get 'interfaces
 (ly:grob-property grob 'meta
 
 #(define (find-system grob)
  (if (has-interface? grob 'system-interface)
  grob
  (find-system (ly:grob-parent grob X
 
 #(define (first-musical-column grobl)
  (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
  (car grobl)
  (first-musical-column (cdr grobl
 
 #(define (change-bound grob)
  (let* ((system (find-system grob))
 (cols (ly:grob-array-list (ly:grob-object system 'columns)))
 (musical-column (first-musical-column (reverse cols
(ly:spanner-set-bound! grob RIGHT musical-column)))
 
 #(define (internal-my-callback grob)
   (let* (
  ;; have we been split?
  (orig (ly:grob-original grob))
 
  ;; if yes, get the split pieces (our siblings)
  (siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig)
'(
 
 (if (and (= (length siblings) 2)
  (not (eq? (car (reverse siblings)) grob)))
   (change-bound grob
 
 #(define (my-callback grob)
  (internal-my-callback grob)
  (ly:hairpin::print grob))
 
 {
 a1\break
 \override Hairpin #'stencil = #my-callback
 a\ \repeat unfold 31 { a } \break \key fis \major
 \repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p
 }
 
 It may result in oddities with other grobs that rely on spanner bounds,
 but it should be tame in most situations.
 
 Cheers,
 MS
 


Hi Mike,

now it works as expected, but I found another problem:
Using \ instead of \ looks like succeeding decrescendos and not one
continuous one.

One more question: Would it be possible to increase the control of the
length of the hairpin?
Doing the following at the end of a hairpin allows some more control on
the length of the hairpin. Not so for anywhere in the middle of it..

\relative c' {
  \override Hairpin #'stencil = #my-callback
   c'1\ c1*5/8 s1*3/8
   \break
   \key cis\major
  d2 e e1*7/8 s1*1/8\!
}

Would any such increased / improved control be feasible in the context
of the solution you developed so far?


Best,
Harm

-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32373099.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-08-31 Thread Mike Solomon

On Aug 31, 2011, at 5:30 PM, harm6 wrote:

 
 
 Mike Solomon-2 wrote:
 
 Hmm...I thought that after-line-breaking would be called after the bounds
 were set, but I was wrong.
 
 Try:
 
 #(define (has-interface? grob interface)
 (member interface
 (assoc-get 'interfaces
(ly:grob-property grob 'meta
 
 #(define (find-system grob)
 (if (has-interface? grob 'system-interface)
 grob
 (find-system (ly:grob-parent grob X
 
 #(define (first-musical-column grobl)
 (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
 (car grobl)
 (first-musical-column (cdr grobl
 
 #(define (change-bound grob)
 (let* ((system (find-system grob))
(cols (ly:grob-array-list (ly:grob-object system 'columns)))
(musical-column (first-musical-column (reverse cols
   (ly:spanner-set-bound! grob RIGHT musical-column)))
 
 #(define (internal-my-callback grob)
  (let* (
 ;; have we been split?
 (orig (ly:grob-original grob))
 
 ;; if yes, get the split pieces (our siblings)
 (siblings (if (ly:grob? orig)
   (ly:spanner-broken-into orig)
   '(
 
(if (and (= (length siblings) 2)
 (not (eq? (car (reverse siblings)) grob)))
  (change-bound grob
 
 #(define (my-callback grob)
 (internal-my-callback grob)
 (ly:hairpin::print grob))
 
 {
 a1\break
 \override Hairpin #'stencil = #my-callback
 a\ \repeat unfold 31 { a } \break \key fis \major
 \repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p
 }
 
 It may result in oddities with other grobs that rely on spanner bounds,
 but it should be tame in most situations.
 
 Cheers,
 MS
 
 
 
Hi Mike,
 
now it works as expected, but I found another problem:
Using \ instead of \ looks like succeeding decrescendos and not one
 continuous one.
 
One more question: Would it be possible to increase the control of the
 length of the hairpin?
Doing the following at the end of a hairpin allows some more control on
 the length of the hairpin. Not so for anywhere in the middle of it..
 
\relative c' {
  \override Hairpin #'stencil = #my-callback
   c'1\ c1*5/8 s1*3/8
   \break
   \key cis\major
  d2 e e1*7/8 s1*1/8\!
}
 
Would any such increased / improved control be feasible in the context
 of the solution you developed so far?
 
 
Best,
Harm
 

More control over the length is always achievable by overriding the stencil, as 
is the solution to the problem you pose above regarding the closing diminuendi.
Try:

#(define (has-interface? grob interface)
(member interface
(assoc-get 'interfaces
   (ly:grob-property grob 'meta

#(define (find-system grob)
(if (has-interface? grob 'system-interface)
grob
(find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
(if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
(car grobl)
(first-musical-column (cdr grobl

#(define (change-bound grob)
(let* ((system (find-system grob))
   (cols (ly:grob-array-list (ly:grob-object system 'columns)))
   (musical-column (first-musical-column (reverse cols
  (ly:spanner-set-bound! grob RIGHT musical-column)))

#(define (internal-my-callback grob fn1 fn2)
 (let* (
;; have we been split?
(orig (ly:grob-original grob))

;; if yes, get the split pieces (our siblings)
(siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig)
  '(

   (if (and (= (length siblings) 2)
(not (eq? (car (reverse siblings)) grob)))
 (fn1 grob)
 (fn2 grob

#(define (change-ends grob)
  (let* ((st (ly:hairpin::print grob))
 (gd (ly:grob-property grob 'grow-direction))
 (w (ly:stencil-extent st X))
 (thick (* (ly:grob-property grob 'thickness) 
(ly:staff-symbol-line-thickness grob)))
 (h (ly:stencil-extent st Y))
 (ylu (if (eqv? gd RIGHT) (interval-center (cons (interval-center h) 
(cdr h))) (cdr h)))
 (yru (if (eqv? gd RIGHT) (cdr h) (interval-center (cons 
(interval-center h) (cdr h)
 (yld (if (eqv? gd RIGHT) (interval-center (cons (car h) 
(interval-center h))) (car h)))
 (yrd (if (eqv? gd RIGHT) (car h) (interval-center (cons (car h) 
(interval-center h))
(ly:stencil-add
  (make-line-stencil thick (car w) ylu (cdr w) yru)
  (make-line-stencil thick (car w) yld (cdr w) yrd

#(define (my-callback grob)
  (internal-my-callback grob change-bound values)
  (if (eqv? LEFT (ly:grob-property grob 'grow-direction))
 (internal-my-callback grob change-ends ly:hairpin::print)
 (ly:hairpin::print grob)))

{
a1\break
\override Hairpin #'stencil = #my-callback
\override Hairpin #'bound-padding = #my-callback
a\ \repeat unfold 31 { a } \break \key fis \major
\repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p
}

{

Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread Mike Solomon

On Aug 29, 2011, at 11:56 PM, David Nalesnik wrote:

 
 
 On Mon, Aug 29, 2011 at 4:50 PM, David Nalesnik david.nales...@gmail.com 
 wrote:
 
 \relative c' {
\override Hairpin #'color = #red
\key ces\major
\eraseBrokenHairpin #(list  41 23  15 0  13 0) ;; recast as offsets 
 from line-width
 
 Oops, sorry -- above comment should use %% instead of ;;
 
 David

How about:

\version 2.14.0

#(define (has-interface? grob interface)
  (member interface
  (assoc-get 'interfaces
 (ly:grob-property grob 'meta

#(define (find-system grob)
  (if (has-interface? grob 'system-interface)
  grob
  (find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
  (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
  (car grobl)
  (first-musical-column (cdr grobl

#(define (change-bound grob)
  (let* ((system (find-system grob))
 (cols (ly:grob-array-list (ly:grob-object system 'columns)))
 (musical-column (first-musical-column (reverse cols
(ly:spanner-set-bound! grob RIGHT musical-column)))
 
#(define (my-callback grob)
   (let* (
  ;; have we been split?
  (orig (ly:grob-original grob))

  ;; if yes, get the split pieces (our siblings)
  (siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig)
'(

 (if (and (= (length siblings) 2)
  (not (eq? (car (reverse siblings)) grob)))
   (change-bound grob
{
 \override Hairpin #'after-line-breaking = #my-callback
 a\ \repeat unfold 31 { a } \break \key fis \major \repeat unfold 74 { a } a\p
}

Cheers,
MS

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


Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread David Nalesnik
On Tue, Aug 30, 2011 at 1:59 AM, Mike Solomon mike...@ufl.edu wrote:


 How about:


Mike --

Wow.  So that's how it's done!

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


Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread harm6


David Nalesnik-2 wrote:
 
 
 OK, this should do it!
 
 Now all you have to do is call \eraseBrokenHairpin -- no arguments needed
  -- and it should handle positioning of the whiteout box.  I'm guessing
 that
 this would be easily extensible to other spanners?
 
 Best,
 David
 

Hi David,

thanks for your work on my function. I will study the additions and I can
confirm the tiny trace of hairpins even if using your hairpin-1.ly 

Best,
  Harm



-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32364640.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread David Nalesnik
On Tue, Aug 30, 2011 at 9:02 AM, harm6 thomasmorle...@googlemail.comwrote:



 David Nalesnik-2 wrote:
 
 
  OK, this should do it!
 
  Now all you have to do is call \eraseBrokenHairpin -- no arguments needed
   -- and it should handle positioning of the whiteout box.  I'm guessing
  that
  this would be easily extensible to other spanners?
 
  Best,
  David
 

 Hi David,

 thanks for your work on my function. I will study the additions and I can
 confirm the tiny trace of hairpins even if using your hairpin-1.ly

 Best,
  Harm


Hi Harm,

These actually disappear if, instead of using line-width, you use the extent
of the hairpin:
(cdr (ly:grob-extent grob (ly:grob-system grob) X))

But Mike's solution is definitely the way to go!  (For one thing, it
preserves the rounded ends of the hairpin pieces.)

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


Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread harm6


Mike Solomon-2 wrote:
 
 How about:
 
 \version 2.14.0
 
 #(define (has-interface? grob interface)
   (member interface
   (assoc-get 'interfaces
  (ly:grob-property grob 'meta
 
 #(define (find-system grob)
   (if (has-interface? grob 'system-interface)
   grob
   (find-system (ly:grob-parent grob X
 
 #(define (first-musical-column grobl)
   (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
   (car grobl)
   (first-musical-column (cdr grobl
 
 #(define (change-bound grob)
   (let* ((system (find-system grob))
  (cols (ly:grob-array-list (ly:grob-object system 'columns)))
  (musical-column (first-musical-column (reverse cols
 (ly:spanner-set-bound! grob RIGHT musical-column)))
  
 #(define (my-callback grob)
(let* (
   ;; have we been split?
   (orig (ly:grob-original grob))
 
   ;; if yes, get the split pieces (our siblings)
   (siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig)
 '(
 
  (if (and (= (length siblings) 2)
   (not (eq? (car (reverse siblings)) grob)))
(change-bound grob
 {
  \override Hairpin #'after-line-breaking = #my-callback
  a\ \repeat unfold 31 { a } \break \key fis \major \repeat unfold 74 { a
 } a\p
 }
 
 Cheers,
 MS
 

Hi Mike,

thanks a lot for your work. Your approach to the problem is completely
beyond my knowledge. I'm trying my definitions with a plethora of manuels
around me. But I can copy, paste and test.

So I noticed some problems:

Your own testing works fine, but it doesn't adding a line in the beginning.

{
a1 \break
\override Hairpin #'after-line-breaking = #my-callback
a4\ \repeat unfold 31 { a } \break \key fis \major \repeat unfold
74 { a } a\p
}

In my eyes the hairpin is to short, when using whole notes.

\relative c' {
%c1 d e \break
\override Hairpin #'color = #red
\override Hairpin #'after-line-breaking = #my-callback
\key ces\major
c'1\  c 
\break
\key cis\major
d2  e e1
\break
\key es\major
\time 2/2
f2 g
\break
\key e\major
\time 4/4
a b\!
}

I will try to play around with your settings, hoping to stumble across a
solution.

Best,
  Harm
-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32364846.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-08-30 Thread Mike Solomon
On Aug 30, 2011, at 4:28 PM, harm6 wrote:

 
 
 Mike Solomon-2 wrote:
 
 How about:
 
 \version 2.14.0
 
 #(define (has-interface? grob interface)
 (member interface
 (assoc-get 'interfaces
(ly:grob-property grob 'meta
 
 #(define (find-system grob)
 (if (has-interface? grob 'system-interface)
 grob
 (find-system (ly:grob-parent grob X
 
 #(define (first-musical-column grobl)
 (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
 (car grobl)
 (first-musical-column (cdr grobl
 
 #(define (change-bound grob)
 (let* ((system (find-system grob))
(cols (ly:grob-array-list (ly:grob-object system 'columns)))
(musical-column (first-musical-column (reverse cols
   (ly:spanner-set-bound! grob RIGHT musical-column)))
 
 #(define (my-callback grob)
  (let* (
 ;; have we been split?
 (orig (ly:grob-original grob))
 
 ;; if yes, get the split pieces (our siblings)
 (siblings (if (ly:grob? orig)
   (ly:spanner-broken-into orig)
   '(
 
(if (and (= (length siblings) 2)
 (not (eq? (car (reverse siblings)) grob)))
  (change-bound grob
 {
 \override Hairpin #'after-line-breaking = #my-callback
 a\ \repeat unfold 31 { a } \break \key fis \major \repeat unfold 74 { a
 } a\p
 }
 
 Cheers,
 MS
 
 
 Hi Mike,
 
 thanks a lot for your work. Your approach to the problem is completely
 beyond my knowledge. I'm trying my definitions with a plethora of manuels
 around me. But I can copy, paste and test.
 
 So I noticed some problems:
 
 Your own testing works fine, but it doesn't adding a line in the beginning.
 
 {
   a1 \break
   \override Hairpin #'after-line-breaking = #my-callback
   a4\ \repeat unfold 31 { a } \break \key fis \major \repeat unfold
 74 { a } a\p
 }

Hmm...I thought that after-line-breaking would be called after the bounds were 
set, but I was wrong.

Try:

#(define (has-interface? grob interface)
 (member interface
 (assoc-get 'interfaces
(ly:grob-property grob 'meta

#(define (find-system grob)
 (if (has-interface? grob 'system-interface)
 grob
 (find-system (ly:grob-parent grob X

#(define (first-musical-column grobl)
 (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
 (car grobl)
 (first-musical-column (cdr grobl

#(define (change-bound grob)
 (let* ((system (find-system grob))
(cols (ly:grob-array-list (ly:grob-object system 'columns)))
(musical-column (first-musical-column (reverse cols
   (ly:spanner-set-bound! grob RIGHT musical-column)))

#(define (internal-my-callback grob)
  (let* (
 ;; have we been split?
 (orig (ly:grob-original grob))

 ;; if yes, get the split pieces (our siblings)
 (siblings (if (ly:grob? orig)
   (ly:spanner-broken-into orig)
   '(

(if (and (= (length siblings) 2)
 (not (eq? (car (reverse siblings)) grob)))
  (change-bound grob

#(define (my-callback grob)
 (internal-my-callback grob)
 (ly:hairpin::print grob))

{
a1\break
\override Hairpin #'stencil = #my-callback
a\ \repeat unfold 31 { a } \break \key fis \major
\repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p
}

It may result in oddities with other grobs that rely on spanner bounds, but it 
should be tame in most situations.

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


Re: shorten a broken hairpin at a linebreak?

2011-08-29 Thread harm6


harm6 wrote:
 
 Hi,
 
 how can I shorten the first part of a broken hairpin to avoid the printing
 under a new KeySignature (or KeyCancellation, TimeSignature etc) at a
 linebreak?
 
 Thanks!
   Harm 
 

It could be done this way:

\version 2.14.2

eraseBrokenHairpin =
#(define-music-function (parser location extent)(list?)
#{
#(define ((hairpin-eraser extent) grob)
   (ly:stencil-add
 (ly:hairpin::print grob)  
   ;(stencil-with-color (ly:round-filled-box extent (cons -1 1)
0.0) red)))
   (stencil-with-color (ly:round-filled-box extent (cons -1 1)
0.0) white)))

  
#(define (hairpin-callback grob)
  (let* ((orig (ly:grob-original grob))
 (siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig) 
 '() )))
 
  (define (recursion-helper ls1 ls2 ls3)
(if (or (null? ls1) (null? ls2))
ls3
(append ls3
   (list
 (if (and (= (length ls1) 1)(eq? (car ls1) grob))
  (if (equal? (cons 0 0) (cons (car ls2)
(cadr ls2)))
  (car ls1)
  (ly:grob-set-property! grob 'stencil 
(hairpin-eraser (cons (car ls2) 
(cadr
ls2))
 (recursion-helper (cdr ls1) (cddr ls2) ls3 )
 
  (define (recursion lst1 lst2)
(recursion-helper lst1 lst2 '()))

(recursion siblings $extent)))

 \once \override Voice.Hairpin #'after-line-breaking =
#hairpin-callback
  #})

%--- Test
--

\relative c' {
\override Hairpin #'color = #red
\key ces\major
\eraseBrokenHairpin #(list  67 85  93 108  95 108)
c'1\ 
\break
\key cis\major
d2  e
\break
\key es\major
\time 2/2
f g
\break
\key e\major
\time 4/4
a b\!
} 

Anyone with a better idea?

Cheers,
  Harm
http://old.nabble.com/file/p32359910/brokenHairpinErase.pdf
brokenHairpinErase.pdf 
-- 
View this message in context: 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--tp32343028p32359910.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


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


Re: shorten a broken hairpin at a linebreak?

2011-08-29 Thread David Nalesnik
On Mon, Aug 29, 2011 at 3:25 PM, harm6 thomasmorle...@googlemail.comwrote:



 harm6 wrote:
 Anyone with a better idea?


Hi, Harm --

I've been playing around with your function and experimenting with ways to
automate calculation of the whiteout box extents.  I recast it to accept
offsets from the current line-width, so I think there is more flexibility,
less need to guess.  Leave a number in the input list at 0 and the function
will use, in this case, 108.120472440945 -- you could see tiny traces of the
hairpin at the line ends :)

Not sure about calculating the other end of the whiteout box (from position
of the barline, I suppose).

Hope this is helpful --

David

\version 2.14.2

eraseBrokenHairpin =
#(define-music-function (parser location extent)(list?)
#{
   #(define ((hairpin-eraser extent) grob)
  (ly:stencil-add
(ly:hairpin::print grob)
  ;(stencil-with-color (ly:round-filled-box extent (cons -1 1) 0.0) red)))
  (stencil-with-color (ly:round-filled-box extent (cons -1 1) 0.0) white)))

   #(define (hairpin-callback grob)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig)
'() ))
(line-width (ly:output-def-lookup (ly:grob-layout grob) 'line-width)))

 (define (recursion-helper ls1 ls2 ls3)
   (if (or (null? ls1) (null? ls2))
   ls3
   (append ls3
  (list
(if (and (= (length ls1) 1)(eq? (car ls1) grob))
 (if (equal? (cons 0 0) (cons (car ls2) (cadr ls2)))
 (car ls1)
 (ly:grob-set-property! grob 'stencil
   (hairpin-eraser (cons (- line-width (car ls2)) (- line-width (cadr
ls2)))
(recursion-helper (cdr ls1) (cddr ls2) ls3 )

 (define (recursion lst1 lst2)
   (recursion-helper lst1 lst2 '()))

   (recursion siblings $extent)))

\once \override Voice.Hairpin #'after-line-breaking =
#hairpin-callback
 #})

%--- Test
%--

\relative c' {
   \override Hairpin #'color = #red
   \key ces\major
   \eraseBrokenHairpin #(list  41 23  15 0  13 0) ;; recast as offsets
from line-width
   c'1\
   \break
   \key cis\major
   d2  e
   \break
   \key es\major
   \time 2/2
   f g
   \break
   \key e\major
   \time 4/4
   a b\!
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: shorten a broken hairpin at a linebreak?

2011-08-29 Thread David Nalesnik
On Mon, Aug 29, 2011 at 4:50 PM, David Nalesnik david.nales...@gmail.comwrote:


 \relative c' {
\override Hairpin #'color = #red
\key ces\major
\eraseBrokenHairpin #(list  41 23  15 0  13 0) ;; recast as offsets
 from line-width


Oops, sorry -- above comment should use %% instead of ;;

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


Re: shorten a broken hairpin at a linebreak?

2011-08-29 Thread David Nalesnik


 Not sure about calculating the other end of the whiteout box (from position
 of the barline, I suppose).


Hi, again --

More experimenting yielded this, which automates the calculation of the
width of the whiteout stencil.  I'm not sure how to handle the positioning
on the first line, hence the list of offsets in the input.  (A number moves
the stencil that far to the left.)  I changed the line-width and added some
measures as a test.  Seems to work OK -- except that there is still a tiny
trace of hairpins at the line ends :(

Best,
David

\version 2.14.2

\paper {
  line-width = 6\in
}
#(define (last-bar grob)
   ;; return the X-coordinate of the last barline on a line
   (let* ((sys (ly:grob-system grob))
  (array (ly:grob-object sys 'all-elements))
  (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
  (lst (filter (lambda (x) (eq? 'BarLine (grob-name x)))
   (ly:grob-array-list array)))
  (bar-coords (sort (map (lambda (x) (ly:grob-relative-coordinate x sys X))
lst) )))

 (define (find-last-bar bar-coords)
   (if (null? (cdr bar-coords))
(car bar-coords)
   (find-last-bar (cdr bar-coords

  (find-last-bar bar-coords)))

eraseBrokenHairpin =
#(define-music-function (parser location extent)(list?)
#{
   #(define ((hairpin-eraser extent) grob)
  (ly:stencil-add
(ly:hairpin::print grob)
  ;(stencil-with-color (ly:round-filled-box extent (cons -1 1) 0.0) red)))
  (stencil-with-color (ly:round-filled-box extent (cons -1 1) 0.0) white)))

   #(define (hairpin-callback grob)
 (let* ((orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig)
'() ))
(line-width (ly:output-def-lookup (ly:grob-layout grob) 'line-width))
(bar-pos (last-bar grob)))

 (define (recursion-helper ls1 ls2 ls3)
   (if (or (null? ls1) (null? ls2))
   ls3
   (append ls3
  (list
(if (and (= (length ls1) 1)(eq? (car ls1) grob))
 (ly:grob-set-property! grob 'stencil
   (hairpin-eraser (cons (- bar-pos (car ls2)) (- line-width (car ls2))
(recursion-helper (cdr ls1) (cdr ls2) ls3 )

 (define (recursion lst1 lst2)
   (recursion-helper lst1 lst2 '()))
   (display bar-pos) (newline)
   (recursion siblings $extent)))

\once \override Voice.Hairpin #'after-line-breaking =
#hairpin-callback
 #})

%--- Test
%--

\relative c' {
   \override Hairpin #'color = #red
   \key ces\major
   \eraseBrokenHairpin #(list 24 0 0) %% offsets to whiteout stencil
   c'1\ ~ c
   \break
   \key cis\major
   d2  e e1
   \break
   \key es\major
   \time 2/2
   f2 g
   \break
   \key e\major
   \time 4/4
   a b\!
}
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: shorten a broken hairpin at a linebreak?

2011-08-29 Thread David Nalesnik

 Hi, again --

  I'm not sure how to handle the positioning on the first line, hence the
 list of offsets in the input.


OK, this should do it!

Now all you have to do is call \eraseBrokenHairpin -- no arguments needed
 -- and it should handle positioning of the whiteout box.  I'm guessing that
this would be easily extensible to other spanners?

Best,
David


hairpin-1.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user