lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: synchronizing other parts w/cadenza


From: Thomas Morley
Subject: Re: synchronizing other parts w/cadenza
Date: Sat, 21 Jan 2012 22:40:28 +0100

Hi Gilles,

2012/1/20 Gilles <address@hidden>:
>
>> 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



reply via email to

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