lilypond-user
[Top][All Lists]
Advanced

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

Re: cadenzaToMusic function, odd behavior causing barcheck failures


From: James Harkins
Subject: Re: cadenzaToMusic function, odd behavior causing barcheck failures
Date: Tue, 29 Jul 2014 13:40:20 -0400
User-agent: Trojita/v0.4.1-obs-7c442be; Qt/4.8.1; X11; Linux; Ubuntu 12.04.4 LTS

On Tuesday, July 29, 2014 11:15:50 AM EDT, David Kastrup wrote:
Uh, \unset Timing.measureLength?  I don't think that LilyPond is going
to be happy with an unset measure length.

That makes sense, but does it apply to this case? There's a meter change just after the \cadenzaToMusic call; wouldn't that reset the measure length to that of the new time signature?

That is, if we have:

someMoment:
        \set Timing.measureLength = $clen
        music...

someMoment + music's duration:
        \unset Timing.measureLength
        \time 2/4

Will LilyPond unset the measure length, and then set it to a moment of "1 2"? Or will the unset somehow override what \time is doing? (It seems to be more like the latter, by observation, but this makes no sense.)

In any case, I found a solution for my score: instead of stretching rests in other parts to match the cadenzas' durations, compress the cadenza notes to match the duration of the other parts' rests.

squeezeCadenza =
#(define-music-function (parser location targetDur music)
                                                 (ly:moment? ly:music?)
"Adjust the length of `music and the measureLength, to fit the length of
`cadenzaMusic"
(let* ((mlen (ly:music-length music))
      (factor (ly:moment-div targetDur mlen))
      (compressed (ly:music-compress music factor)))
 #{
   $compressed
 #}))

Resting part: \cadenzaOn R1 \cadenzaOff

Solo part: \cadenzaOn \squeezeCadenza #(ly:make-moment 1 1) \cadenzaNotes \cadenzaOff

... and the subsequent meter changes behave as they should.

hjh



reply via email to

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