lilypond-devel
[Top][All Lists]
Advanced

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

MIDI time signature


From: David Kastrup
Subject: MIDI time signature
Date: Sun, 06 Jun 2021 23:32:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Ok, I have a problem here.  Our MIDI time signature codes are wrong.
The problem that I have in fixing this is that part of the information
in a MIDI time signature is actually (typically) specified in \tempo
instead.

Here is how this works: a MIDI time signature contains numerator (fine),
denominator (coded like our duration-log), midi clocks (of which there
are 24 per quarter note) per beat, and 8 (32nd notes per quarter which
we keep constant).

The midi clocks per beat is basically what we could get from the closest
\tempo ... = duration specification, by taking duration in terms of
whole notes and dividing by 96.

This value is hardcoded as 18, corresponding to 8. (3 16th notes).  That
does not make a whole lot of sense.

The sane way would be to take the information from the currently valid
\tempo (if specified) or otherwise apply a time signature specific
default (for 6/8, we don't want 6 beats per measure but 2, for example).

I'd argue that if we have

\tempo 60
\time 6/8

then we should likely interpret this (regarding the MIDI playing speed)
as

\tempo 60 = 4.
\time 6/8

which would produce a different MIDI file rendition speed than what we
have now, because that would be the most reasonable interpretation for
the _visual_ rendition of
\tempo 60
\time 6/8

In other words: looks like a long-standing mess in some need of cleaning
up.  Another possible information source may be the beat grouping
information for a time signature (used for beaming patterns).  That one
will turn out to be a puzzler for things like

\time 3,2 5/4

However, we could try to pick the gcd from the beat groupings and use
that as a multiplier for the beat length (typically the time signature
denominator).  That would be tempo-independent and probably correct more
often than not.

And tempo-independent would leave us with a quite smaller head-ache.

-- 
David Kastrup



reply via email to

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