MIDI type 0 vs type 1
Every Standard MIDI File declares a format, also called a type: 0, 1 or 2. Most software reads both 0 and 1, but some players, keyboards, karaoke machines and drum pedals only accept type 0, and some editors work better with type 1. This page explains the difference and converts between the two in your browser. Files are never uploaded.
Convert a MIDI file
Or drag a file onto this box, or try a sample:
Choose a file to see its format.
The three formats
| Format | Tracks | How they play | Typical use |
|---|---|---|---|
| 0 | Exactly one | All 16 channels are mixed in a single track | Hardware song players, arranger keyboards, karaoke, ringtones, drum pedals |
| 1 | One or more | All tracks start together and share one tempo map | DAW and notation exports: one track per instrument, with tempo and time signatures in the first track |
| 2 | One or more | Each track is a separate pattern with its own timing | Rare: pattern-based sequencers and drum machines |
Format 0 does not lose information that matters for playback. Every channel message keeps its channel, so the same piano, bass and drums play either way. What it loses is organization: there is one track name, and all instruments sit in one list of events. Format 1 keeps instruments apart, which is what a DAW shows as separate tracks.
How to tell which format a file is
The format is the 16-bit number after the header length. Every MIDI file begins with the 14-byte header chunk:
4D 54 68 64 "MThd"
00 00 00 06 header length: 6
00 01 format: 1 (00 00 = format 0, 00 02 = format 2)
00 03 number of tracks: 3
01 E0 division: 480 ticks per quarter note
In code: const format = (bytes[8] << 8) | bytes[9]. A format 0 file must say 1 track. You can also open the file in the MIDI file analyzer, which shows the format, every track and the header bytes. The Standard MIDI File guide explains the rest of the header and the track chunks.
Converting type 1 to type 0
Merging is lossless for playback. The converter takes every event from every track, keeps its absolute time in ticks, and writes them into one track in time order. Events that happen at the same tick keep their track order, so the tempo and time signature from the first track come before the first notes. Only the first track name is kept, and the End of Track markers are replaced by one at the end. The result is the same length and plays the same notes on the same channels.
Converting type 0 to type 1
Splitting needs a rule for where each event goes, because a type 0 file has no tracks to keep. The usual rule, used here and by most DAWs when they import a type 0 file, is one track per MIDI channel:
- Track 1 is the conductor track: the file’s name, tempo, time and key signatures, markers, lyrics and other text, and System Exclusive messages.
- Every channel that is used gets its own track, named after the channel and its first General MIDI program, such as “Channel 2 (Electric Bass (finger))”. Channel 10 is named as drums.
Channel prefix and port meta events are dropped, because each new track holds one channel. A type 1 file can also be split this way, which is useful when one track holds several channels.
Format 2
A format 2 file is a set of independent patterns, each with its own tempo, meant to be played one at a time or arranged by the software that made it. Merging the patterns into format 0 or 1 would make them play at the same time, which changes the music, so the converter declines. The format 2 test file shows what a player should do with one.
When a converted file still will not load
- The device only reads short names. Some players need 8.3 file names (
SONG01.MID). - Too many events. Older hardware has small memory; remove controller data in a DAW.
- SMPTE timing. Most hardware expects ticks per quarter note; check the division in the analyzer.
- It is not a MIDI file. RIFF (
.rmi) and karaoke files wrap or extend MIDI; the analyzer reads both and shows what is inside.
More fixes are in MIDI troubleshooting. To turn a file into notation instead, use the MIDI to MusicXML converter. The conversion code is the tested module midi-format-core.mjs.