OggMIDI

From XiphWiki

(Difference between revisions)
Jump to: navigation, search
(Document granulepos based on the oggmerge code)
(cat)
 
Line 38: Line 38:
The granulepos field used for the Ogg page timestamps records microseconds since the beginning of the stream.
The granulepos field used for the Ogg page timestamps records microseconds since the beginning of the stream.
 +
 +
[[Category:Ogg Mappings]]

Latest revision as of 21:03, 5 November 2008

Mapping for embedding MIDI data streams in Ogg.

This mapping was designed by Jack Moffitt. See this mailing list post for documentation of his scheme.

Header packet

OggMIDI streams have a single header packet for codec identification.

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1| Byte
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identifier 'OggMIDI\0'                                        | 0-3
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               | 4-7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        version number         |         time format           | 8-11
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           timebase            |                                 12-13
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The header packet begins with the character sequence 'OggMIDI\0' for codec identification.

This is followed by an 8 bit version field. The version must be 0 for the mapping described here.

The time format field is also 8 bits, and describes the timestamp format used by the midi data. It is interpreted as follows:

  • 1 one beat per quarter note
  • 24, 25, 29, 30, (50, 59, 60?) corresponding smpte frame
  • other values are undefined

The timebase occupies the final 16 bits and gives the number of ticks per time format unit.

Data packets

The header packet is followed by a series of data packets, each of which contains an integral number of midi events.

Granulepos

The granulepos field used for the Ogg page timestamps records microseconds since the beginning of the stream.

Personal tools


Main Page

Xiph.Org Projects

Audio—

Video—

Text—

Container—

Streaming—