OggMIDI

From XiphWiki

(Difference between revisions)
Jump to: navigation, search
(roughly document the encapsulation structure)
(Document granulepos based on the oggmerge code)
Line 3: Line 3:
This mapping was designed by Jack Moffitt. See [http://lists.xiph.org/pipermail/vorbis-dev/2001-August/004501.html this mailing list post] for documentation of his scheme.
This mapping was designed by Jack Moffitt. See [http://lists.xiph.org/pipermail/vorbis-dev/2001-August/004501.html this mailing list post] for documentation of his scheme.
-
= Header packet
+
== Header packet ==
OggMIDI streams have a single header packet for codec identification.
OggMIDI streams have a single header packet for codec identification.
Line 31: Line 31:
The timebase occupies the final 16 bits and gives the number of ticks per time format unit.
The timebase occupies the final 16 bits and gives the number of ticks per time format unit.
-
= Data packets
+
== Data packets ==
The header packet is followed by a series of data packets, each of which contains an integral number of midi events.
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.

Revision as of 19:47, 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—