[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to extract the current time signature
From: |
Thomas Morley |
Subject: |
Re: How to extract the current time signature |
Date: |
Thu, 22 Jan 2015 03:00:23 +0100 |
2015-01-22 2:09 GMT+01:00 tisimst <address@hidden>:
> I'd like to extract the current numerator and denominator of the time
> signature at any point in time. How can I do this in scheme? A robust
> solution (i.e., one that can handle compound time signatures) is always
> preferred, but I can settle for "normal" time signatures with a single
> numerator and denominator.
>
> Thanks,
> Abraham
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