MIDI File Format
SMF stores events in MThd and MTrk chunks, and formats 0 and 1 serve different jobs.
Related
The format decides how events queue and how easily tempo can be edited.
The problem
Storing the same performance as one track or many changes editing completely. A file that will not open, plays at the wrong tempo or crams parts together points to the header.
Protocol or message
A file begins with MThd, a 6-byte field holding format, ntrks and division, so the header is 14 bytes. Format 0 has one MTrk. Format 1 has several synchronised MTrk chunks, usually with tempo and time signature first. Format 2 holds independent patterns and is rare. Each MTrk holds delta times and events, with delta as a variable-length number. Division gives ticks per quarter note, or an SMPTE value. Meta events start with 0xFF, where 0x51 is tempo, 0x58 is time signature and 0x2F ends the track.
Settings and practice
Use format 1 for arranging and exchange, since tracks stay separate and compatibility is best. Small players may prefer format 0. When changing tempo, edit the tempo track.
What to listen for
Both formats should sound identical. A difference usually means a tempo track or channel problem. After splitting tracks, listen one by one and check that velocity and pedal stayed put.
Common misunderstandings
Track count is not channel count. Every track in format 1 shares one timeline. The same extension does not guarantee GM.
Listen in the library
All tracks from midicn-lib — inline badge is the license tier (C1 commercial / C2 non-commercial / C3 study only).
Sources
- SMF 1.0 规范对 MThd 与 MTrk 的结构定义,依 MMA 公开规范核查,未抄文本
- format 0、1、2 与 division 的用法,依通行音序器文档核查,未抄文本
Used for fact-checking only; all prose is original.