Re: cadenzaToMusic function, odd behavior causing barcheck failures
On 29/07/14 04:46, James Harkins wrote: Hi, Some time ago, a user here gave me a cadenzaToMusic function, which could stretch rests in non-cadenza parts to match the duration of a cadenza. (That's because I was having problems with compressing the cadenza music to fit in a normal-length bar.) More for information to the list really@ Part of the original thread you had it seems was from 2012 - it's only fair when you say 'sometime ago' as this will make a difference on the version of LP you were using at the time. http://lists.gnu.org/archive/html/lilypond-user/2012-04/msg00125.html I think is that thread. Which seems to imply this was originally written for \version 2.14.x and you're now using 2.18.x - again just to confirm so that the dev who helped (Thomas Morely by the looks of it) has a chance ;) I've used it in a couple of pieces and it's worked beautifully so far,... In those 'so far' pieces, were they all for LP 2.14.x or was it working in a case for LP 2.18.2 (i.e. is this the first time you are using 2.18.2 and find it no longer works as expected)? James (whole rest, fermata) | 2/4 R2 | 6/8 (next section) Instead, I get (whole rest, fermata) | 2/4 R2 ... ... and here, the 6/8 appears in the middle of the bar. It looks like the barlines are calculated as if the 2/4 bar contained three quarters. The issue doesn't reproduce in two cases: - If I replace the \cadenzaToMusic in the \score block with rests adding up to the right duration, or - If I put the part with the cadenza notes (with *no* \cadenzaToMusic) in the lowest staff. (I can't do that b/c it's a clarinet cadenza and the piece also uses bassoon.) I'm really quite perplexed why this is happening. Can someone take a look? Thanks, hjh \language english \version 2.18.2 cadenzaToMusic = #(define-music-function (parser location cadenzaMusic music) (ly:music? ly:music?) Adjust the length of `music and the measureLength, to fit the length of `cadenzaMusic (let* ((clen (ly:music-length cadenzaMusic)) (mlen (ly:music-length music)) (factor (ly:moment-div clen mlen)) (compressed (ly:music-compress music factor))) ;; (format #t factor : ~a\n factor) #{ \set Timing.measureLength = $clen $compressed \unset Timing.measureLength #})) clarCadenzaC = { \cadenzaOn \repeat unfold 31 r8 \cadenzaOff } globalB = { \time 4/4 \cadenzaOn \cadenzaToMusic \clarCadenzaC s1 \cadenzaOff \bar | \time 2/4 s2 \time 6/8 s2. } \score { \new Staff \globalB \relative c' { \cadenzaOn % use the following line: barcheck failed, and 6/8 meter is in the wrong place \cadenzaToMusic \clarCadenzaC r1\fermata % use the following line instead (comment the previous one), no problem %r8 \repeat unfold 15 { r4 } % = 31 eighth notes \cadenzaOff R2 cs8 d e cs4. } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: cadenzaToMusic function, odd behavior causing barcheck failures
On Jul 29, 2014 7:29 AM, James pkx1...@gmail.com wrote: On 29/07/14 04:46, James Harkins wrote: Some time ago, a user here gave me a cadenzaToMusic function, which could stretch rests in non-cadenza parts to match the duration of a cadenza. (That's because I was having problems with compressing the cadenza music to fit in a normal-length bar.) More for information to the list really@ Part of the original thread you had it seems was from 2012 - it's only fair when you say 'sometime ago' as this will make a difference on the version of LP you were using at the time. http://lists.gnu.org/archive/html/lilypond-user/2012-04/msg00125.html I think is that thread. Which seems to imply this was originally written for \version 2.14.x and you're now using 2.18.x - again just to confirm so that the dev who helped (Thomas Morely by the looks of it) has a chance Good point. I just double-checked the source for the 2012 piece. I used 2.15.36 for it. (And thanks for tracking down the old thread -- now I can give proper credit in the new piece's acknowledgments!) I also used a modified version of the function, which skips setting the measureLength, for a 2013 piece that I compiled with 2.16.2. In those 'so far' pieces, were they all for LP 2.14.x or was it working in a case for LP 2.18.2 (i.e. is this the first time you are using 2.18.2 and find it no longer works as expected)? I had never used it with 2.18.x before -- first try with 2.18, first time it failed. It's got to be something with the set Timing.measureLength -- the time signature engraver puts 6/8 in the right place rhythmically, but the barlines appear as if the 2/4 bar were actually 3 beats. Will play with it some more in a little while. Thanks, hjh ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: cadenzaToMusic function, odd behavior causing barcheck failures
James pkx1...@gmail.com writes: \language english \version 2.18.2 cadenzaToMusic = #(define-music-function (parser location cadenzaMusic music) (ly:music? ly:music?) Adjust the length of `music and the measureLength, to fit the length of `cadenzaMusic (let* ((clen (ly:music-length cadenzaMusic)) (mlen (ly:music-length music)) (factor (ly:moment-div clen mlen)) (compressed (ly:music-compress music factor))) ;; (format #t factor : ~a\n factor) #{ \set Timing.measureLength = $clen $compressed \unset Timing.measureLength #})) Uh, \unset Timing.measureLength? I don't think that LilyPond is going to be happy with an unset measure length. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: cadenzaToMusic function, odd behavior causing barcheck failures
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 ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
cadenzaToMusic function, odd behavior causing barcheck failures
Hi, Some time ago, a user here gave me a cadenzaToMusic function, which could stretch rests in non-cadenza parts to match the duration of a cadenza. (That's because I was having problems with compressing the cadenza music to fit in a normal-length bar.) I've used it in a couple of pieces and it's worked beautifully so far, but failed in the case below. I expect to get: (whole rest, fermata) | 2/4 R2 | 6/8 (next section) Instead, I get (whole rest, fermata) | 2/4 R2 ... ... and here, the 6/8 appears in the middle of the bar. It looks like the barlines are calculated as if the 2/4 bar contained three quarters. The issue doesn't reproduce in two cases: - If I replace the \cadenzaToMusic in the \score block with rests adding up to the right duration, or - If I put the part with the cadenza notes (with *no* \cadenzaToMusic) in the lowest staff. (I can't do that b/c it's a clarinet cadenza and the piece also uses bassoon.) I'm really quite perplexed why this is happening. Can someone take a look? Thanks, hjh \language english \version 2.18.2 cadenzaToMusic = #(define-music-function (parser location cadenzaMusic music) (ly:music? ly:music?) Adjust the length of `music and the measureLength, to fit the length of `cadenzaMusic (let* ((clen (ly:music-length cadenzaMusic)) (mlen (ly:music-length music)) (factor (ly:moment-div clen mlen)) (compressed (ly:music-compress music factor))) ;; (format #t factor : ~a\n factor) #{ \set Timing.measureLength = $clen $compressed \unset Timing.measureLength #})) clarCadenzaC = { \cadenzaOn \repeat unfold 31 r8 \cadenzaOff } globalB = { \time 4/4 \cadenzaOn \cadenzaToMusic \clarCadenzaC s1 \cadenzaOff \bar | \time 2/4 s2 \time 6/8 s2. } \score { \new Staff \globalB \relative c' { \cadenzaOn % use the following line: barcheck failed, and 6/8 meter is in the wrong place \cadenzaToMusic \clarCadenzaC r1\fermata % use the following line instead (comment the previous one), no problem %r8 \repeat unfold 15 { r4 } % = 31 eighth notes \cadenzaOff R2 cs8 d e cs4. } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user