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:25:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Kieren MacMillan <address@hidden> writes:

> Hello again,
>
> So I was able to work out the following function:
>
> \version "2.15.29"
>
> tsFunky =
>   #(define-music-function
>     (parser location numerNum denomNote)
>     (string? string?)
>     #{
>       \once \override Staff.TimeSignature #'stencil = 
> #ly:text-interface::print
>       \once \override Staff.TimeSignature #'text =
>         \markup \override #'(baseline-skip . 0.5) \center-column { \number 
> #numerNum \note #denomNote #DOWN }
>     #})
>
> theMusic = {
>   \tsFunky #"7" #"16." \time 21/32 R16.*7 |
> }
>
> \score { \theMusic }
>
> 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 }

-- 
David Kastrup



reply via email to

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