[vorbis-dev] Ogg MIDI proposal

Jack Moffitt jack at xiph.org
Sat Aug 25 21:24:22 PDT 2001



> You also don't mention how the granule_pos field of the ogg page will be set (called 'pcm absolute position' in framing.html). I propose it contain the accumulated tick number in the timebase units the midi data uses. That means the multiplexer has to read the timebase header of the midi stream *and* keep track of the current tempo to maintain sync. 

Exactly like Vorbis.  You need the granulepos (sample number) AND the
samplerate.

Maybe we should instead specify (only) that the midi data must come *before* the corresponding vorbis data. That way the decoder needn't worry about midi underflow, and a dumb encoder can just stick the whole midi stream at the beginning. The head ordering requirement will remain in place, and the page flush requirement will ensure this arrangement is possible.

I've little objection to being dumb about midi encoding.  A typical midi
file is going to be 8-10k I suppose. Typical being that it doesn't
contain synth specific SysEx messages, etc.

> 'OggMIDI\000'
> version (1 byte) - this is the OggMIDI version supported, starts from 0
>
> Is the \000 part of the magic string, or the value of the version byte?

OggMidi\000 makes file magic easier, yes?  I think we should make the
version and the \000 separate.

> time format (1 byte) - this is the time format, 1 for ticks per
> 	quarternote; 24,25,29,30 for SMTPE time
> 
> 0 is a better flag for 'per quarternote'.

Agreed.

> This field is written little-endian, like the rest of ogg. The midi format itself is big endian. We won't muck with the ordering within the event stream (data packets) itself.

There's also no need, since it's byte oriented past the header.

> Note that the midi data packets are sections of the raw event bytestream chopped at an event boundary, and have no OggMIDI-specific header. You  just concatenate them to get the midi track back again. We rely on ogg for all framing and sync. I proposed that the packet boundaries should also occur before a non-zero timestamp.

Agreed on teh timestamp issue.

Getting a midi file back out is only slightly more complicated than you
describe.  You do need to create hte header, and the MTrk chunk, plus
relevant chunk lengths.  Still trivial, but not a straight copy.

jack.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list