Track chunk (of a MIDI file)

5

MIDI files begin with a header chunk. The MIDI header chunk is a piece of information that describes the whole MIDI song. The chunks that follow the MIDI header chunk are called track chunks.

The track chunk of a MIDI file is a piece of information in the MIDI file that: 1) identifies itself as track chunk; 2) shows that it has a certain size; and 3) contains the actual MIDI events.

In other words, the track chunk has the following structure.


Description Length in bytes Starts at byte in the chunk Value
Chunk ID 4 bytes 0x00 The character string "MTrk"
Size 4 bytes 0x04 1-65,535
Data variable 0x08 Various

The "chunk ID" for the track chunk is always the text "MTrk", which signifies that this is a track chunk.

The "size" of the track chunk varies, but it is the number of bytes used to represent the MIDI events that follow.

The "data" are the track event data, or in other words, the MIDI events.

There could be one or more tracks in the MIDI file (in principle, between 1 and 65,535 tracks). This is specified by the "number of tracks" bytes of the header chunk of the MIDI file, which are the eleventh and twelfth bytes of the header chunk.

How many tracks there can be in the MIDI file also depends somewhat on the format type of the MIDI file, which could be 0, 1, or 2. A value of 0 means that the MIDI file contains one track chunk with all relevant MIDI events, including meta events that contain meta information about the MIDI song as well as musical MIDI events that actually do something. A value of 1 means that the MIDI file contains two or more track chunks. In such a case by convention the first chunk will contain meta events with the song information and the second and other chunks will contain the musical MIDI events. A value of 2 also means multiple track chunks, but in this case each track represents a separate MIDI sequence, which may or may not be played simultaneously, and which may contain its own meta and musical events. The "format type" of the MIDI file is carried by the ninth and tenth byte of the MIDI file header chunk.

See also:
Musical Instrument Digital Interface (MIDI)



  Rating
Rate This Page: Poor Great   |  Rate Content |
Average rating:  5   
00001
12345
Number of Ratings : 1
  Comments
Add Comment
No Comments Yet


Copyright 2006 by Kaliopa Publishing, LLC