[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fractional Meter Help.
From: |
Aaron Hill |
Subject: |
Re: Fractional Meter Help. |
Date: |
Sat, 25 Apr 2020 21:47:12 -0700 |
User-agent: |
Roundcube Webmail/1.4.2 |
On 2020-04-25 9:09 pm, melophobic wrote:
But currently, I have to implement it very awkwardly by putting:
\once \override Staff.TimeSignature #'stencil =
#(fractional-time-signature
"2" "2" "3" "4")
To get it to display something like 2⅔/4. I am still new at scheme in
general, is there a way that I can write the function to be able to put
something like what is used for displaying an alternate time signature?
Such
as:
\fractionalMeter { 2 2 3 4 }
You could define a music function to do this. Here is my attempt:
%%%%
\version "2.20.0"
fractionalMeter =
#(define-music-function
(numerator-whole numerator-fraction denominator)
(number? number-pair? number?)
(define (proc grob)
(grob-interpret-markup grob
#{ \markup \override #'(baseline-skip . 0.1)
\number \center-column {
\concat {
#(number->string numerator-whole)
\fontsize #-6 \raise #1 \center-column {
#(number->string (car numerator-fraction))
#(number->string (cdr numerator-fraction))
}
}
#(number->string denominator)
} #}))
#{ \once \override Staff.TimeSignature.stencil = #proc
\time #(cons (+ (* numerator-whole (cdr numerator-fraction))
(car numerator-fraction))
(* (cdr numerator-fraction) denominator)) #})
{
#(ly:expect-warning "strange time signature found")
\fractionalMeter 2 2/3 4
\repeat unfold 3 { | b'4 4 \tuplet 3/2 { b'8 8 } }
}
%%%%
-- Aaron Hill
fractional-time-sig.cropped.png
Description: PNG image