lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time signature question


From: David Kastrup
Subject: Re: time signature question
Date: Sun, 26 Feb 2012 16:37:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:

> Kieren MacMillan <address@hidden> writes:

>> It works resonably well… However, I would *LOVE* to be able to replace
>>
>>     \tsFunky #"7" #"16." \time 21/32
>>
>> with something more like
>>
>>     \tsFunky s16.*7
>>
>> and have the function figure out the correct measure length for me (in this 
>> case, 21 thirty-second notes), and then display the correct 
>> "number-over-note" time signature (in this case, a '7' over a 
>> dotted-sixteenth note). Is this possible?
>
> Hey, this is almost cute enough for a bounty:
>
> \version "2.15.29"
>
> tsFunky =
>   #(define-music-function
>     (parser location dur)
>     (ly:duration?)
>     #{
>       \once \override Staff.TimeSignature #'stencil = 
> #ly:text-interface::print
>       \once \override Staff.TimeSignature #'text =
>         \markup \override #'(baseline-skip . 0.5) \center-column {
>      \number #(number->string (car (ly:duration-factor dur)))
>      \note-by-number #(ly:duration-log dur) #(ly:duration-dot-count dur) 
> #DOWN }
>    \time #(cons (ly:moment-main-numerator (ly:duration-length dur))
>                (ly:moment-main-denominator (ly:duration-length dur)))
>       #})
>
> theMusic = {
>   \tsFunky 16.*7 R16.*7 |
> }
>
> { \theMusic }

And if you think a bounty is exaggerated because that was a 5 minute
job:

The music function can take a duration argument because of work I did.
\number can take a normal Scheme argument because of work I did
(admittedly, using $ instead of # would have been easy enough).  \time
is a music function that can take its value as a computed cons because
of work I did.  Using dur throughout the #{ ... #} is as straightforward
because of work I did (admittedly, juggling with the right kind of $
would have worked as well).

In short, it was a five-minute job because of work I did, and you have a
reasonable chance to get similar jobs done yourself if needed: the
construct is not really significantly more complex than what you already
came up with.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]