[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: synchronizing other parts w/cadenza
From: |
Gilles |
Subject: |
Re: synchronizing other parts w/cadenza |
Date: |
Fri, 20 Jan 2012 10:58:17 +0100 |
User-agent: |
Opera Mail/11.60 (Win32) |
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
>>
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cadenzaToMusic.png
Description: PNG image