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
Subject: Re: cadenzaToMusic function, odd behavior causing barcheck failures
Date: Tue, 29 Jul 2014 12:29:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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