natt
Junior Member
Posts: 248
Registered: 05-11 |
shadow1013 said:
i mean i understand, but my needs are simplistic. the least i would like is a direction to be pointed to to convert midi delta times to the mus time events
An increment of 1 in a mus timecode represents 1/140 SECONDS.
Treat the "time division" flag in the midi header as a 16 bit unsigned integer. if you're loading off of disk, remember that it's big endian. If the top bit is set, you're using smpte timings; which it's unlikely that you'll see. Otherwise, "time division" gives MIDI CLOCKS per QUARTERNOTE. When I say "MIDI CLOCK" I mean that one MIDI CLOCK is equal to an increment of 1 in a midi timecode.
Whenever you get a midi meta event of type tempo change (0x51), the data field should be 3 bytes long. treat those bytes as a 24 bit unsigned integer (big endian again). Call this number "tempo"; it is in MICROSECONDS PER QUARTERNOTE. At the beginning of the track, before you get to any tempo event (which you might never even get to), assume a tempo of 500000; you should be able to see that this is the same as 120 QUARTERNOTES PER MINUTE.
Note that if you're reading a type 1 file, tempo events should only occur in the first track, and they apply to all tracks.
Remember that midi timecodes specify the time before an event, but mus timecodes specify the time after an event.
|