Re: BendSpanner-engraver

2016-10-08 Thread Federico Bruni
Il giorno mar 4 ott 2016 alle 10:37, Thomas Morley 
 ha scritto:
 Thanks Harm, indeed it's faster. These are the times I got in 5 
(small)

 pieces:

 1st version --> 2nd version
 2,2" --> 1,8"
 2,3" --> 2,1"
 3,3" --> 2,3"
 2,0" --> 1,7"
 1,7" --> 1,5"


On my not so powerful laptop compiling whole bend-test.ly decresed
from >60' down to 16'


Well, I guess that it depends on the number of bends in the file.
If I compile the same file, bend-demo.ly, it's 3 times faster:

- old version: 5"
- new version: 1,6"




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


applying a tweak or callback to an \after-ed grob

2016-10-08 Thread Kieren MacMillan
Hi all,

I’ve been using David K’s lovely \after function (which should, IMO, be 
polished up and rolled into the distro!) to great effect in my recent 
engravings.

However, I’m having difficulty figuring out how to apply tweaks to the grobs 
that are \after-ed.
For example, see the snippet included below.

Any hints would be appreciated.

Thanks,
Kieren.



%%%  SNIPPET BEGINS
\version "2.19"

\paper { ragged-right = ##f }

hairpinWithCenteredText =
#(define-music-function (parser location text) (markup?)
   #{
 \once \override Voice.Hairpin.after-line-breaking =
 #(lambda (grob)
(let* ((stencil (ly:hairpin::print grob))
   (par-y (ly:grob-parent grob Y))
   (dir (ly:grob-property par-y 'direction))
   (new-stencil (ly:stencil-aligned-to
 (ly:stencil-combine-at-edge
  (ly:stencil-aligned-to stencil X CENTER)
  Y dir
  (ly:stencil-aligned-to (grob-interpret-markup 
grob text) X CENTER))
 X LEFT))
   (staff-space (ly:output-def-lookup (ly:grob-layout grob) 
'staff-space))
   (staff-line-thickness
(ly:output-def-lookup (ly:grob-layout grob) 'line-thickness))
   (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 
'name)))
   (par-x (ly:grob-parent grob X))
   (dyn-text (eq? (grob-name par-x) 'DynamicText ))
   (dyn-text-stencil-x-length
(if dyn-text
(interval-length
 (ly:stencil-extent (ly:grob-property par-x 'stencil) X))
0))
   (x-shift
(if dyn-text
(-
 (+ staff-space dyn-text-stencil-x-length)
 (* 0.5 staff-line-thickness)) 0))
   (original (ly:grob-original grob))
   (pieces (if (ly:grob? original)
   (ly:spanner-broken-into original)
   '(

  (ly:grob-set-property! grob 'Y-offset 0) ;; ensure correct alignment
  (ly:grob-set-property! grob 'stencil
(ly:stencil-translate-axis
 (if (or (null? pieces)
 (and (pair? pieces)
  (eq? grob (car pieces
 new-stencil
 stencil)
 x-shift X
   #})

hairpinPoco = \hairpinWithCenteredText \markup { \italic poco }

after =
#(define-music-function (parser location t e m)
 (ly:duration? ly:music? ly:music?)
 #{
 \context Bottom <<
 #m
 { \skip $t <> -\tweak extra-spacing-width #empty-interval $e }
 >>
 #})

test = {
\once \hairpinPoco g1\< g\!
\once \hairpinPoco \after 2 \< g1 g\!
}

\score { \test }
%%%  SNIPPET ENDS


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


Re: applying a tweak or callback to an \after-ed grob

2016-10-08 Thread David Kastrup
Kieren MacMillan  writes:

> Hi all,
>
> I’ve been using David K’s lovely \after function (which should, IMO, be 
> polished up and rolled into the distro!) to great effect in my recent 
> engravings.
>
> However, I’m having difficulty figuring out how to apply tweaks to the grobs 
> that are \after-ed.
> For example, see the snippet included below.
>
> Any hints would be appreciated.
>
> Thanks,
> Kieren.
>
> 
>
> %%%  SNIPPET BEGINS
> \version "2.19"
>
> \paper { ragged-right = ##f }
>
> hairpinWithCenteredText =
> #(define-music-function (parser location text) (markup?)
>#{
>  \once \override Voice.Hairpin.after-line-breaking =

[...]

That's not a tweak.

_That's_ a tweak:

%%%  SNIPPET BEGINS
\version "2.19"

\paper { ragged-right = ##f }

hairpinWithCenteredText =
#(define-event-function (parser location text ev) (markup? ly:event?)
   #{
 -\tweak Hairpin.after-line-breaking
 #(lambda (grob)
(let* ((stencil (ly:hairpin::print grob))
   (par-y (ly:grob-parent grob Y))
   (dir (ly:grob-property par-y 'direction))
   (new-stencil (ly:stencil-aligned-to
 (ly:stencil-combine-at-edge
  (ly:stencil-aligned-to stencil X CENTER)
  Y dir
  (ly:stencil-aligned-to (grob-interpret-markup grob text) X CENTER))
 X LEFT))
   (staff-space (ly:output-def-lookup (ly:grob-layout grob) 'staff-space))
   (staff-line-thickness
(ly:output-def-lookup (ly:grob-layout grob) 'line-thickness))
   (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
   (par-x (ly:grob-parent grob X))
   (dyn-text (eq? (grob-name par-x) 'DynamicText ))
   (dyn-text-stencil-x-length
(if dyn-text
(interval-length
 (ly:stencil-extent (ly:grob-property par-x 'stencil) X))
0))
   (x-shift
(if dyn-text
(-
 (+ staff-space dyn-text-stencil-x-length)
 (* 0.5 staff-line-thickness)) 0))
   (original (ly:grob-original grob))
   (pieces (if (ly:grob? original)
   (ly:spanner-broken-into original)
   '(

  (ly:grob-set-property! grob 'Y-offset 0) ;; ensure correct alignment
  (ly:grob-set-property! grob 'stencil
(ly:stencil-translate-axis
 (if (or (null? pieces)
 (and (pair? pieces)
  (eq? grob (car pieces
 new-stencil
 stencil)
 x-shift X
   #ev
   #})

hairpinPoco = \hairpinWithCenteredText \markup \italic poco \etc

after =
#(define-music-function (parser location t e m)
 (ly:duration? ly:music? ly:music?)
 #{
 \context Bottom <<
 #m
 { \skip $t <> -\tweak extra-spacing-width #empty-interval $e }
 >>
 #})

test = {
 g1\hairpinPoco\< g\!
 \after 2 \hairpinPoco\< g1 g\!
}

\score { \test }
%%%  SNIPPET ENDS


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


Re: applying a tweak or callback to an \after-ed grob

2016-10-08 Thread Thomas Morley
2016-10-08 20:02 GMT+02:00 David Kastrup :
> Kieren MacMillan  writes:
>
>> Hi all,
>>
>> I’ve been using David K’s lovely \after function (which should, IMO, be 
>> polished up and rolled into the distro!) to great effect in my recent 
>> engravings.
>>
>> However, I’m having difficulty figuring out how to apply tweaks to the grobs 
>> that are \after-ed.
>> For example, see the snippet included below.
>>
>> Any hints would be appreciated.
>>
>> Thanks,
>> Kieren.
>>
>> 
>>
>> %%%  SNIPPET BEGINS
>> \version "2.19"
>>
>> \paper { ragged-right = ##f }
>>
>> hairpinWithCenteredText =
>> #(define-music-function (parser location text) (markup?)
>>#{
>>  \once \override Voice.Hairpin.after-line-breaking =
>
> [...]
>
> That's not a tweak.
>
> _That's_ a tweak:
>
>
>
>
> --
> David Kastrup


Or transform the override into a tweak:

test = {
%% no need for second once, it's already in `hairpinWithCenteredText'
\hairpinPoco g1\< g\!
\after 2 \single \hairpinPoco \< g1 g\!
}

\score { \test }

Cheers,
  Harm

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


Re: applying a tweak or callback to an \after-ed grob

2016-10-08 Thread David Kastrup
Kieren MacMillan  writes:

> Hi all,
>
> I’ve been using David K’s lovely \after function (which should, IMO, be 
> polished up and rolled into the distro!) to great effect in my recent 
> engravings.
>
> However, I’m having difficulty figuring out how to apply tweaks to the grobs 
> that are \after-ed.
> For example, see the snippet included below.

Actually, let's do a tweak _without_ changing a lot of code:

> test = {
> \once \hairpinPoco g1\< g\!
> \once \hairpinPoco \after 2 \< g1 g\!
> }

test = {
  \once \hairpinPoco g1\< g\!
  \after 2 \single \hairpinPoco \< g1 g\!

Which is more or less the point of having \single: being able to convert
an override into a tweak when nothing else will do.

-- 
David Kastrup

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


Re: applying a tweak or callback to an \after-ed grob

2016-10-08 Thread David Kastrup
Thomas Morley  writes:

> Or transform the override into a tweak:
>
> test = {
> %% no need for second once, it's already in `hairpinWithCenteredText'
> \hairpinPoco g1\< g\!
> \after 2 \single \hairpinPoco \< g1 g\!
> }
>
> \score { \test }

Hoisted by my own petard.

-- 
David Kastrup

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


Re: applying a tweak or callback to an \after-ed grob

2016-10-08 Thread Kieren MacMillan
Hi Harm and David,

Thank you!

>>%% no need for second once, it's already in `hairpinWithCenteredText’

Yes… I’ve altered that now, so that hairpinWithCenteredText is a non-\once 
\override.
(Now that we have \temporary, \single, etc., I think I will make sure that all 
such functions in my library are non-\once, and then add syntactic sugar as 
appropriate.)

>>\after 2 \single \hairpinPoco \< g1 g\!

> Which is more or less the point of having \single: being able to convert
> an override into a tweak when nothing else will do.


I clearly didn’t understand that, but this does exactly what I want it to — 
thank you.

For archive readers: The page 
http://lilypond.org/doc/v2.19/Documentation/learning/tweaking-methods does a 
pretty good job of explaining the purpose of \single (and other tweaking 
methods).

For developers/users: Should that page include a description of [the effect of] 
\temporary, and/or a link to 

 (where there is such a description)?

Thanks,
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


status 1 error question

2016-10-08 Thread Kieren MacMillan
Hello all,

Until a few minutes ago, my score was compiling fine (2.19,46). Now I am 
getting the following error:

> /home/gub/NewGub/gub/target/darwin-x86/src/lilypond-git.sv.gnu.org--lilypond.git-release-unstable/flower/include/drul-array.hh:35:
>  failed assertion `d == 1 || d == -1’
> Exited with exit status 1.

The code

  | %  pFU 17-18
  \split
{ df'''4 ~ 16 g''( a'' bf'') c'''4 ~ 16 f''( bf'' c''') }
{ \pfLOne bf16 \pfUTwo f' df'' ef'' f''4 \pfLOne a16 \pfUTwo f' c'' 
df'' ef''4 }
  s1

[in which \split is a macro/shorthand for creating simultaneous voices, and the 
\pfX functions are shorthand for changing staves/voices, both of which are 
workhorses in my code and have not caused problems before] works just fine, 
whereas the code

  | %  pFU 17-18
  \split
{ df'''4 ~ 16 g''( a'' bf'') c'''4 ~ 16 f''( bf'' c''') }
{ \pfLOne bf16 \pfUTwo f' df'' ef'' f''4 \pfLOne a16 \pfUTwo f' c'' 
df'' ef''4 }
  \split
{ df'''4 ~ 16 bf''( c''' df''') ef'''8( df'''16 ef''' e''' ds''' 
e''' fs''') }
{ \pfLOne af16 \pfUTwo f' c'' df'' ef''4 \pfLOne g16 \pfUTwo f' bf' 
c'' fs' c'' cs'' ds'’ }

throws the error copied above.

Short of sending someone my very-non-M RWE [real world example] to work with on 
their own system, is there something I can do to chase down exactly what is 
causing this error?

Thanks,
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


Re: status 1 error question

2016-10-08 Thread David Kastrup
Kieren MacMillan  writes:

> Hello all,
>
> Until a few minutes ago, my score was compiling fine (2.19,46). Now I
> am getting the following error:
>
>> /home/gub/NewGub/gub/target/darwin-x86/src/lilypond-git.sv.gnu.org--lilypond.git-release-unstable/flower/include/drul-array.hh:35:
>> failed assertion `d == 1 || d == -1’
>> Exited with exit status 1.
>
> The code
>
>   | %  pFU 17-18
>   \split
> { df'''4 ~ 16 g''( a'' bf'') c'''4 ~ 16 f''( bf'' c''') }
> { \pfLOne bf16 \pfUTwo f' df'' ef'' f''4 \pfLOne a16 \pfUTwo f' 
> c'' df'' ef''4 }
>   s1
>
> [in which \split is a macro/shorthand for creating simultaneous voices, and 
> the \pfX functions are shorthand for changing staves/voices, both of which 
> are workhorses in my code and have not caused problems before] works just 
> fine, whereas the code

With regard to "have not caused problems before": after version 2.19.22,
assertions were enabled for the default compilations.  The given
assertion triggers when a definite direction is required but 0 or
#CENTER given.  "changing staves/voices" sounds like something where one
could have settings like that.

Previous to 2.19.22, this ended up doing "something", now it aborts
instead.  So depending on what "not caused problems before" means, this
could simply mean that you have some settings which would need to be
either #UP or #DOWN (if set at all) but are 0 or #CENTER for some
reason.

-- 
David Kastrup

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


Re: status 1 error question

2016-10-08 Thread Kieren MacMillan
Hi all,

The error turned out to be caused by the fact that the lower staff already 
contained a rest at the moment where I was [accidentally, via my \pfUTwo 
function] trying to also have a sixteenth note g.

Unless this quick mention/report turns out to be interesting to the developers 
in terms of bug-chasing, my apologies for the noise.

Sincerely,
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


Re: status 1 error question

2016-10-08 Thread Kieren MacMillan
Hi David,

> With regard to "have not caused problems before": after version 2.19.22,
> assertions were enabled for the default compilations.  The given
> assertion triggers when a definite direction is required but 0 or
> #CENTER given.  "changing staves/voices" sounds like something where one
> could have settings like that.

Yes: both the notes (stems, flags, etc.) and rests would have definite 
directions.

> Previous to 2.19.22, this ended up doing "something", now it aborts
> instead.  So depending on what "not caused problems before" means, this
> could simply mean that you have some settings which would need to be
> either #UP or #DOWN (if set at all) but are 0 or #CENTER for some
> reason.

Ah! Very interesting — thank you for the details.

I’ll try to whip up a MWE of what I was encountering, so that the development 
team can determine whether it’s a bug, and/or if there’s some more graceful way 
of handling the resulting situation.

Best,
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


Re: status 1 error question

2016-10-08 Thread David Kastrup
Kieren MacMillan  writes:

> Hi all,
>
> The error turned out to be caused by the fact that the lower staff
> already contained a rest at the moment where I was [accidentally, via
> my \pfUTwo function] trying to also have a sixteenth note g.
>
> Unless this quick mention/report turns out to be interesting to the
> developers in terms of bug-chasing, my apologies for the noise.

Failed assertions are not something to be taken lightly, so if you have
a nice minimal example here doing the equivalent of what you are doing
with your functions and failing in the same manner, that would help
figuring out what LilyPond should rather do here.  The input may or may
not be invalid, but short of having used overrides/tweaks on internals
with very strange settings, an assertion failure is not an appropriate
reaction.  This should be caught before that judging from your
description of the code triggering the problem.

-- 
David Kastrup

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


Re: Long Compile time with version 2.19.44

2016-10-08 Thread francisperea
Hi all,

I'm just writing to confirm that under macOS Sierra (10.12) Lilypond 2.19.48
is extremely slow.

I've downgraded to 2.19.47 and finally to 2.19.46.

2.19.47 was also terribly slow but 2.19.46 worked as usual.

As a sample, a simple file took 1.2 seconds to compile under 2.19.46 and
51.4 seconds under 2.19.48.

Just to provide some reference for those in the same situation and perhaps
to help developers locate the problem.

Regards,

Francis Perea





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Long-Compile-time-with-version-2-19-44-tp192343p195236.html
Sent from the User mailing list archive at Nabble.com.

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