lilypond-devel
[Top][All Lists]
Advanced

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

Re: TimeSignature with note in denominator


From: Aaron Hill
Subject: Re: TimeSignature with note in denominator
Date: Fri, 12 Nov 2021 22:00:59 -0800
User-agent: Roundcube Webmail/1.4.9

On 2021-11-12 5:57 pm, Kieren MacMillan wrote:
so I again (perhaps naïvely) hope that
    \time \note-denom 3/4
and
    \time \note-denom #'(3 . 4)
could both work.

As David said, those are precisely the same thing. A fraction is one of the primitive tokens our lexer presents to the parser. This becomes a number pair in the Scheme world. So for all intents, it is simply too late in the process to distinguish 3/4 and #'(3 . 4).

The point of the helper I proposed is that it makes it clear that the user is to provide a number followed by a duration. In this way, there is no confusion (for the user or the program), although it means you cannot use a slash to separate the fraction as one might want to do.

It should be possible for the helper to accept a single fraction as well, so both of these usages could work:

%%%%
\time \note-denom 6/8   ;; slash means simple numeric fraction
\time \note-denom 2 4.  ;; no slash means scalar and duration
%%%%

Consider the following function signature:

%%%%
#(define (fraction-or-duration? arg) (or (fraction? arg) (ly:duration? arg)))

note-denom =
#(define-scheme-function
  (scalar fraction-or-duration)
  ((number? 1) fraction-or-duration?)
  ; ...
)
%%%%

But is \note-denom doing anything useful for the simple case? Users would probably just want to say \time 6/8 directly and cut out the middle man. The only need for something like \note-denom would be in the 2/4. scenario where we cannot, at the moment, input 2/4. as a fraction and need some syntactic wrapping.


Follow-up question: Is there any reason it can’t be a prefixed helper
function? i.e.

   \note-denom \time #'(3 . 4)

which takes the time-signature-music as its input, and outputs
adjusted time-signature music?

Functions can accept ly:music? and you can drill down to determine if it contains TimeSignatureMusic and modify its properties. The only issue is that currently \time (and TimeSignatureMusic) require the denominator to be a number. You can convert 2/4. to its logical equivalent of 6/8 but key information is lost. \note-denom cannot magically recover the original intention to be able to render the signature as the user wanted.


-- Aaron Hill



reply via email to

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