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

Reply via email to