Hi Giles, 2012/1/23 Gilles <gilles.thiba...@free.fr>: > >>> It is possible with ly:music-compress , to make a function that fit all >>> kind of music >>> cadenzaToMusic = [...] > > > Oops ! Rethinking of the function cadenzaToMusic, I realized that i forgot > the case of the user entering a 0 length music ( s1*0 for example). > This version should really work for all musics > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \layout { > \context { > \Staff > \remove "Time_signature_engraver" > } > } > > 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)) > ; (return <mom 0> for mlen = <mom 0>) > (compressed (if (equal? mlen (ly:make-moment 0 1)) ; 0 length > (make-sequential-music (list music (skip-of-length cadenzaMusic))) > (ly:music-compress music factor)))) > ;;(format #t "factor : ~a\n" factor) > > #{ > \set Timing.measureLength = $clen > $compressed > \unset Timing.measureLength > #})) > > cadenzaText = \markup \box "cadenza!" > cnotes = \relative c'' { c8[ d e f g] } > snotes = \cadenzaToMusic \cnotes s1_\cadenzaText > mnotes = \cadenzaToMusic \cnotes R1^\fermataMarkup_\cadenzaText > nnotes = \cadenzaToMusic \cnotes \relative c'' > { c2^\fermata _\cadenzaText d^\fermata } > zeroLength = \cadenzaToMusic \cnotes s1*0_\cadenzaText > > > \score { > << > \new Staff \cnotes > \new Staff \mnotes > \new Staff \snotes > \new Staff \nnotes > \new Staff \zeroLength > >> > } > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Thanks a lot, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user