lilypond-devel
[Top][All Lists]

## Re: TimeSignature with note in denominator

 From: Flaming Hakama by Elaine Subject: Re: TimeSignature with note in denominator Date: Fri, 26 Nov 2021 20:18:27 -0800

```On Mon, Nov 15, 2021 at 11:11 AM David Kastrup <dak@gnu.org> wrote:

> Carl Sorensen <c_sorensen@byu.edu> writes:
>
> > ﻿On 11/15/21, 10:21 AM, "lilypond-devel on behalf of Flaming Hakama by
> Elaine" <lilypond-devel-bounces+carl.d.sorensen+digest=gmail.com@gnu.org
> on behalf of elaine@flaminghakama.com> wrote:
> >
> >
> >     According to the semantics quoted several times, the denominator
> describes
> >     the length/duration of the unit, the numerator describes how many
> units are
> >     in the measure.
> >
> > There is some space for confusion in the LilyPond world.  Moments
> represent a musical moment, an instant in time.  But a moment is also used
> to represent a time interval between the current moment and the zero moment
> (such as the beginning of  a measure).  So a moment also can be used to
> represent an interval, as is applied in the time signature.  I should have
> been more sensitive to this, because I created the BaseMoment property to
> be used in autobeaming; this property represents and interval starting at 0
> and ending at the moment BaseMoment.
> >
> >     In terms of semantics, numerals and note representation operate
> exactly the
> >     same.  There is  a 1-1 mapping between numbers interpreted as
> fractions of
> >     a whole note, and the graphical symbols used to represent those
> >     durations/lengths.
>
> That is simply untrue.
>

First of all, thanks for the considered response.

> \tuplet 2/3 { 4 } and 4. are different graphical symbols representing
> exactly the same length.  Similarly \tuplet 3/2 ... and \tuplet 6/4
> ... represent the exactly the same length but have different graphical
> representations, note durations and musical semantics.
>
> Claiming that there is a 1-1 mapping and that one can exchange on for
> the other in the internals without consequences is just not going to
> help.
>
> And there is a huge tendency here to conflate that the existence of an
> n->1 mapping for durations/graphics to a moment length with the
> existence of a 1-1 mapping and to build lots of strawmen based on
> claiming I deny the existence of the n->1 mapping and "proving" in that
> manner that I don't know what I am talking about.
>
>
Regarding 1 => 1, vs N => 1, vs 1 => N,
yes I agree I was hand wavy and incorrect.

What I meant to say was that there is a reliable way to find a default.

If you want 1 ==> 1, but have 1 ==> N, that means you can always find at
least one value in that range, and you can construct a 1 ==> 1 mapping.  I
am suggesting that we can find the most reasonable value to
use, that mapping will be a good default.

> > Now, music expressions also have a length, even if they don't have a
> > lilypond duration.  And it is possible to get the length of a music
> > expression and return it as a Moment using ly:music-length.  So if it
> > were possible to have the parser (or a music function) take two
> > arguments for a time signature, with the first being an integer and
> > the second being a music expression, it would be relatively
> > straightforward to convert this into a reasonable time signature.
>
> Where "convert this into a reasonable time signature" would imply the
> ability to convert this into the two separate components, a functional
> and a visual one.  At the current point of time, something like
> 2/4. (for what is commonly referred to as 6/8 in standard notation) has
> no natural conversion to the functional components
> numerator/denominator.  One could do this "more naturally" by allowing
> the "denominator" to be a rational number instead of just an integer.
>

In general, I agree that there are distinct things, the functional and
visual.

However, it is worth pointing out that, In all cases, there can be more
than one visual representation for a length.

So, this issue seems to be general, and not related to these more modern
time signatures under proposal.  The questions should be more like, can we
come up with useful and meaningful defaults for given time sigs, like we
have for standard sigs?

In particular, it is not clear what you mean about 6/8 being a case where
it is not clear how to interpret it.  Certainly, in all cases, the length
part is uniquely determined.  So, it is either the visual representation,
or the beaming that you are referring to.

In 6/8, the visual representation is clear, if we wanted to show a note,
we'd show an 8th note.

Since I think we all agree that beaming subdivisions are just about
conventions, and there is no way to determine them based on values, 6/8 is
an example where we have rules to help supply default conventions since it
is not implicit in the value.

> The _visual_ component still needs a separate expression that probably
> sticks best with being actual music once one puts out note images.  That
> would allow for example a meter of 4 times \tuplet 3/2 { 4 8 } for some
> weird swing time indication, or 3 times { 8 8 8 } for a different
> representation of 9/8 meter.

> With regard to meters, obviously there are also numeric variations like
> writing 3+2 in the numerator.  The amount of visual possibilities is
> large enough that forcing visual and functional components to be
> interchangeable seems like a bad idea.
>
> --
> David Kastrup
>

to support arbitrary musical content as the denominator,
might be the best approach in practice.

Since even using a default musical representation,
people will want to fiddle with the tuplet font, size, bracket, placement,
etc.,
and that is likely easier done in the music expression than in time
signature properties or defaults.

While I do think that your suggestion to use arbitrary music as the
denominator has merit, I don't think that most of the use cases motivated
by signatures based on common tuplets like 1/6 or 1/12 require that.

Perhaps the best approach would be to allow supplying either a music
expression as the denominator, or a number.

Here is an example of an algo that could provide a reasonable default
representation.

I would guess that this would satisfy the actual use cases that are
motivating this.

Step 1) Determine N = how many times the length of the denominator goes
into a whole note.
For cases where the time sig is of the form */N, this is simply N.

For cases like "4.", we would have to determine that "4." corresponds to 3/8
then divide 1 by 3/8 and get 8/3, or N = 2.66...

Step 2) Find D = the (integer) power of 2 that is closest to N, with ties
going to the lower power.
To find the candidates, we take the integers above and below log2(N), which
we'll call x and x+1.
Then compare (N - 2^x) and (2^(x+1) - N), and find the smaller value, then
use D = 2^x or 2^(x+1), whichever was closer.

Example: N is 17
log2(17) = 4.08....
we see if 17 is closer to 2^4 or 2^5
Since (17 - 2^4) < (2^5 - 17), we use x=4 or D = 2^4 = 16

Example: N is 12
log2(12) = 3.58....
we see if 12 is closer to 2^3 or 2^4
In this case, (12 - 2^3) = (2^4 - 12), so we go with the lower x=3 or D =
2^3 = 8

Example: N is 6
log2(6) = 2.58....
we see if 6 is closer to 2^2 or 2^3
In this case, (6 - 2^2) = (2^3 - 6), so we go with the lower x=2 or D = 2^2
= 4

Example N is 20
log2(20) = 4.32..
we see if 20 is closer to 2^4 or 2^5
In this case, (20 - 2^4) < (2^5 - 20), so we go with the lower x=4 or D =
2^4 = 16

Step 3) This value D corresponds to:
* The duration to use for the note in the tuplet
* One of the inputs into determining the tuplet number

Step 4) Determine if there is a need for a tuplet.
If N is a power of 2, there is no need for a tuplet number,
and our representation is the note for duration N.

Otherwise, reduce the ratio N:D ==> n:d
The default representation would be  \tuplet n/d { D }

To check how this would work for a few example values:

For 4/17:
N=17 is between 2^4 and 2^4 (16 and 32), and is closer to 16, so we use D=16
N:D is 17:16, and does not reduce
denominator: \tuplet 17/16 { 16 }

For 5/12:
N=12 is midway between 2^3 and 2^4 (8 and 16), so we go with the smaller D=8
N:D is 12:8, which reduces to 3:2
denominator: \tuplet 3/2 { 8 }

For 2/6:
N=6 is midway between 2^2 and 2^3 (4 and 8), so we go with the smaller D=4
N:D is 6:4, which reduces to 3:2
denominator: \tuplet 3/2 { 4 }

For 4/20:
N=20 is between 2^4 and 2^5 (16 and 32), and is closer to 16, so we use D=16
N:D is 20:16 which reduces to 5:4
denominator: tuplet 5/4 { 16 }

HTH,

Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
elaine@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

```