Skip to content

midi: rework MThd resolution field FPS #4

@transcriptaze

Description

@transcriptaze

Decode MThd SMPTE timecode resolution FPS as int8 rather than uint8.

The third word, , specifies the meaning of the delta-times. It has two formats,
one for metrical time, and one for time-code-based time:
0 ticks per quarter-note
1
15 14 8 7 0
ticks per frame negative
SMPTE format

If bit 15 of is a zero, the bits 14 thru 0 represent the number of delta-time "ticks"
which make up a quarter-note. For instance, if is 96, then a time interval of an
eighth-note between two events in the file would be 48.
If bit 15 of is a one, delta-times in a file correspond to subdivisions of a second, in
a way consistent with SMPTE and MIDI time code. Bits 14 thru 8 contain one of the four
values -24, -25, -29, or -30, corresponding to the four standard SMPTE and MIDI time code
formats (-29 corresponds to 30 drop frame), and represents the number of frames per second.
These negative numbers are stored in two's complement form. The second byte (stored
positive) is the resolution within a frame: typical values may be 4 (MIDI time code resolution),
8, 10, 80 (bit resolution), or 100. This system allows exact specification of time-code-based
tracks, but also allows millisecond-based tracks by specifying 25 frames/sec and a resolution of
40 units per frame. If the events in a file are stored with bit resolution of thirty-frame time
code, the division word would be E250 hex.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions