[Reviving a pretty ancient thread]
Hi Abraham and Harm (and others),
Am 22.01.15 um 14:17 schrieb tisimst:
Harm,
Thomas Morley-2 wrote
Maybe:
\version "2.19.15"
printTimeSignatureFraction =
\applyContext #(lambda (ctx)
(let* ((context
(ly:context-property-where-defined ctx 'timeSignatureFraction))
(time-sig-frac
(ly:context-property context 'timeSignatureFraction)))
(display time-sig-frac)))
\relative c' {
\time 3/2
\printTimeSignatureFraction % => (3 . 2)
c''1
\compoundMeter #'((1 4) (3 8))
\printTimeSignatureFraction % => (5 . 8) !!
\repeat unfold 5 c8 \repeat unfold 10 c16
}
Though the compound TimeSig will return "summarized"
Cheers,
Harm
That works great! Thanks so much for your help. Perhaps I should have
mentioned it in the original post, but I'd like to be able to use the values
in time-sig-frac to automatically make a MultiMeasureRest with the duration
of the full measure, but when I attempt to do so, nothing gets added to my
score. Here's my latest and greatest:
%<------------------------------
\version "2.18.2"
autoMMR =
\applyContext #(lambda (ctx)
(let* ((context
(ly:context-property-where-defined ctx 'timeSignatureFraction))
(time-sig-frac
(ly:context-property context 'timeSignatureFraction))
(num (car time-sig-frac))
(den (cdr time-sig-frac)))
(make-music 'MultiMeasureRestMusic
'duration
(ly:make-duration 0 0 num den)
'articulations
'())
))
\relative c' {
\time 3/2
\autoMMR
c'1.
\compoundMeter #'((1 4)(3 8))
\autoMMR
\repeat unfold 5 c8 \repeat unfold 10 c16
}
%<------------------------------
I know that applyContext creates its own "(make-music ..." block, so maybe
there's some scoping issue I'm not aware of. Any further help would be
greatly appreciated!
-Abraham
I've just run into the very same issue (also trying to create a MMR for
the current measure's duration.
Looking at the code examples above I'm pretty sure the problem is not a
"scoping" but a "timing" issue - I think \applyContext performs the
context lookup long after the MMR has been created. This seems pretty
clear because at the time a music-function is interpreted (and the
duration would be needed to create the MMR) it is not clear where this
music will end up. Consider the case when you define this in a variable
which you'll then reuse multiple times (possibly starting at different
moments in a measure or wrapped in \scaleDurations or \tuplet-s).
So while I get why this doesn't work that way, is there any chance to
create a one-measure MMR from a music-function?
My use case is that I want to align an arbitrary markup (or music of
arbitrary length) with a measure by (ab)using the MMR, I don't want to
require a duration argument to the music function, and making it
optional seems to interfere with the rest of the function signature.
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user