[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Number Repeated Measures
From: |
Gilles THIBAULT |
Subject: |
Re: Number Repeated Measures |
Date: |
Mon, 19 May 2008 14:28:24 +0200 |
I would like to use the length of the variable "theMusic" instead, so it
would work with an arbitrary time signature.
The "ly:music-length" can do that.
But you get a length as a "moment" type. So you have to transform it into a
"duration" type
This function seems to work :
%%%%%%%%%%%%%%%%%%%%%%%%%
numberedRepeats = #(define-music-function (parser location numberRpts
theMusic ) ( integer? ly:music?)
(let* (
(mom (ly:music-length theMusic))
(num (ly:moment-main-numerator mom ))
(denom (ly:moment-main-denominator mom))
(dur (ly:make-duration 0 0 num denom))
(skipmusic (make-music 'SequentialMusic 'elements (list
(make-music 'EventChord 'elements
(list
(make-music 'SkipEvent 'duration dur ))))))
)
#{
<<
\repeat unfold $numberRpts $theMusic
{
\set countPercentRepeats = ##t
\override PercentRepeatCounter #'Y-offset = 3
\override PercentRepeatCounter #'font-size = 1
\override PercentRepeat #'transparent = ##t
\repeat percent $numberRpts $skipmusic
}
>> #}
))
\new Staff
{ \time 3/4
\numberedRepeats #10 { c'4 c' c'}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
Gilles