Hi Gilles, 2012/1/20 Gilles <[email protected]>: > >> But I was annoyed by having two functions with very similiar code. > > It is possible with ly:music-compress , to make a function that fit all kind > of music > NB > I have tested this snippet only with 2.14 but it should work with 2.15 > > %%%%%%%%%%%%%%%%%%%%%%%%% > > \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)) > (compressed (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 } > > \score { > << > \new Staff \cnotes > \new Staff \mnotes > \new Staff \snotes > \new Staff \nnotes > >> > } > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
that's much better! Many thanks, Harm _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
