On 2021-11-12 5:03 pm, David Kastrup wrote:
Kieren MacMillan <kieren_macmil...@sympatico.ca> writes:
At that point, the only issue is to turn
\time #'(4 . "4.")
into an number num and a *duration* (not number) denom… which again
doesn’t required parser-fiddling, correct?
Utterly incorrect. #'(4 . "4.") does not consult the LilyPond parser
beyond the # and there is absolutely nothing that would magically turn
"4." into a duration. Nor should there be in my book.
Yeah, at this point, you'd have to manually write:
%%%%
\time #'(4 . #{ 4. #})
%%%%
And that's pretty ugly... so you might write a helper function:
%%%%
foo = #(define-scheme-function
(numer denom) (number? ly:duration?)
(cons numer denom))
\time \foo 4 4.
%%%%
It's a little better; but with proper parser support, a number-duration
fraction format would be best:
%%%%
\time 4/4.
%%%%
That does presume, though, that TimeSignatureMusic would be refactored
to support a non-numeric denominator. At the moment, it requires
numbers. You could try to convert durations to numbers...
%%%%
timeFraction =
#(define-scheme-function
(scalar duration)
(number? ly:duration?)
(let* ((moment (ly:duration-length duration))
(numerator (ly:moment-main-numerator moment))
(denominator (ly:moment-main-denominator moment)))
(cons (* scalar numerator) denominator)))
\fixed c' {
| \time \timeFraction 3 4. b4. a g
| \time \timeFraction 2 2. b2 a4 g2 a4
}
%%%%
...but this conversion is inherently lossy. The stencil procedure would
have no idea what the original rhythmic denominator was.
-- Aaron Hill