Music Software Development

MIDI test files

Each file below tests one part of the Standard MIDI File format, from the simplest possible file to running status, SMPTE timing and four-byte delta times. Each comes with a plain description of its contents and the values a correct parser should report: format, track count, time division, number of notes and duration. Duration is the time of the last End of Track event, and a note is a Note On (with velocity above 0) paired with the next Note Off, or Note On with velocity 0, for the same channel and key.

License: these files are generated by this project and are free to use for any purpose, including commercial software and test suites, with no attribution required.

The files are generated by code in this site's build, and the project's test suite parses every file and checks it against the values on this page. To see what your own files contain, load them into the MIDI file analyzer. For the byte layout behind these examples, read how to write a Standard MIDI File.

Middle C for one beat

The smallest useful file: format 0, one track, 480 ticks per quarter note, a 120 BPM tempo event and a single middle C (note 60, velocity 100) that lasts one quarter note. Its 42 bytes are exactly the worked example in the Standard MIDI File guide, so you can compare your parser against the annotated hex dump there.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
1
Duration
0.5 seconds
Also check
One note: C4 (60) from 0 to 0.5 s; Track chunk length 20 bytes
Size
42 bytes

Download middle-c-one-beat.mid

Show all 42 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 01 E0 4D 54
72 6B 00 00 00 14 00 FF 51 03 07 A1 20 00 90 3C
64 83 60 80 3C 00 00 FF 2F 00

Format 1 with a conductor track

Two tracks that play at the same time. Track 1 is a conductor track with only a track name, a 120 BPM tempo and a 4/4 time signature. Track 2 is named "Melody", selects program 0 (Acoustic Grand Piano) and plays C4, D4, E4 and F4 as quarter notes. A player must apply the tempo from track 1 to the notes in track 2.

What a correct parser reports

Format
1
Tracks
2
Time division
480 ticks per quarter note
Notes
4
Duration
2 seconds
Also check
Notes start at 0, 0.5, 1 and 1.5 s; Track 1 has no channel events
Size
116 bytes

Download format-1-two-tracks.mid

Show all 116 bytes in hex
4D 54 68 64 00 00 00 06 00 01 00 02 01 E0 4D 54
72 6B 00 00 00 21 00 FF 03 09 43 6F 6E 64 75 63
74 6F 72 00 FF 51 03 07 A1 20 00 FF 58 04 04 02
18 08 8F 00 FF 2F 00 4D 54 72 6B 00 00 00 35 00
FF 03 06 4D 65 6C 6F 64 79 00 C0 00 00 90 3C 64
83 60 80 3C 00 00 90 3E 64 83 60 80 3E 00 00 90
40 64 83 60 80 40 00 00 90 41 64 83 60 80 41 00
00 FF 2F 00

Format 2 with two independent patterns

Format 2 stores independent patterns rather than tracks that play together. Pattern A (track 1) climbs C4–E4–G4–C5 and pattern B (track 2) falls C5–G4–E4–C4, each as quarter notes with its own 120 BPM tempo event. Each pattern lasts 1,920 ticks (2 seconds). Played one after the other they take 4 seconds; a player that mixes them as if they were format 1 will play both at once in 2 seconds.

What a correct parser reports

Format
2
Tracks
2
Time division
480 ticks per quarter note
Notes
8
Duration
2 seconds
Also check
Each track ends at tick 1,920; Each track has its own tempo event (120 BPM)
Size
150 bytes

Download format-2-two-patterns.mid

Running status

Hand-encoded bytes that rely on running status: after a status byte, later events of the same type and channel leave it out and start directly with their data bytes. The file plays a C major triad (C4 E4 G4) for one beat, releasing it with Note Off (80) messages, then an F major triad (F4 A4 C5) for one beat, releasing it with Note On velocity 0. Twelve channel events use only three status bytes. At 120 BPM it lasts 1 second.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
6
Duration
1 second
Also check
12 channel events, 9 of them without a status byte; Two chords of 3 notes, each 0.5 s long
Size
74 bytes

Download running-status.mid

Show all 74 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 01 E0 4D 54
72 6B 00 00 00 34 00 FF 51 03 07 A1 20 00 90 3C
64 00 40 64 00 43 64 83 60 80 3C 40 00 40 40 00
43 40 00 90 41 64 00 45 64 00 48 64 83 60 41 00
00 45 00 00 48 00 00 FF 2F 00

Note On with velocity 0 as Note Off

Four quarter notes, C4 D4 E4 F4 at 120 BPM, where every note ends with a Note On message whose velocity is 0 instead of a Note Off message. The file contains no 8n status bytes at all. A parser that treats velocity 0 as a new note will report 8 notes or notes that never end; the correct answer is 4 notes of 0.5 seconds each.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
4
Duration
2 seconds
Also check
8 Note On events, 4 with velocity 0; No Note Off (8n) events
Size
69 bytes

Download zero-velocity-note-off.mid

Show all 69 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 01 E0 4D 54
72 6B 00 00 00 2F 00 FF 51 03 07 A1 20 00 90 3C
64 83 60 90 3C 00 00 90 3E 64 83 60 90 3E 00 00
90 40 64 83 60 90 40 00 00 90 41 64 83 60 90 41
00 00 FF 2F 00

Tempo changes

Format 1, three bars of 4/4. The conductor track sets 120 BPM at bar 1 (tick 0), 60 BPM at bar 2 (tick 1,920) and 240 BPM at bar 3 (tick 3,840). Track 2 plays C5 as an eighth note on every beat, 12 notes in all. Bar 1 lasts 2 seconds, bar 2 lasts 4 seconds and bar 3 lasts 1 second, so the file is 5,760 ticks and exactly 7 seconds long. Notes start at 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 6.25, 6.5 and 6.75 seconds.

What a correct parser reports

Format
1
Tracks
2
Time division
480 ticks per quarter note
Notes
12
Duration
7 seconds
Also check
Tempo changes at ticks 0, 1,920 and 3,840 (120, 60, 240 BPM); Bars last 2 s, 4 s and 1 s
Size
212 bytes

Download tempo-changes.mid

SMPTE time division, 25 fps

Uses SMPTE timing instead of ticks per quarter note: the division bytes are E7 28, meaning 25 frames per second and 40 ticks per frame, so one tick is exactly 1 millisecond. There is no tempo event, because tempo does not affect SMPTE timing. Four notes (C4 E4 G4 C5) last 500 ticks each, back to back, for 2,000 ticks or 2 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
SMPTE: 25 frames per second, 40 ticks per frame
Notes
4
Duration
2 seconds
Also check
Division word 0xE728; Each note lasts 0.5 s
Size
78 bytes

Download smpte-division-25fps.mid

Show all 78 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 E7 28 4D 54
72 6B 00 00 00 38 00 FF 03 0C 53 4D 50 54 45 20
32 35 20 66 70 73 00 90 3C 64 83 74 80 3C 00 00
90 40 64 83 74 80 40 00 00 90 43 64 83 74 80 43
00 00 90 48 64 83 74 80 48 00 00 FF 2F 00

All 128 MIDI notes

Every note number from 0 (C−1) to 127 (G9) in rising order, each a sixteenth note (120 ticks) at 120 BPM and velocity 100 on channel 1. Useful for checking range handling, note naming and keyboard displays. 128 notes in 16 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
128
Duration
16 seconds
Also check
Lowest note 0, highest note 127; Each note lasts 0.125 s
Size
1,074 bytes

Download all-128-notes.mid

General MIDI percussion, notes 35–81

All 47 sounds of the General MIDI Level 1 percussion map on channel 10, from 35 (Acoustic Bass Drum) to 81 (Open Triangle), one every eighth note at 120 BPM. Each hit is a sixteenth note long and is preceded by a Text event naming the sound. A GM player should produce a different drum or percussion sound for every note. The file lasts 11.75 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
47
Duration
11.75 seconds
Also check
All notes on channel 10 (status 99 and 89); 47 Text events naming the sounds
Size
1,284 bytes

Download gm-percussion-35-81.mid

Mod wheel sweep (CC 1)

One C4 held for a 4/4 bar at 120 BPM while Control Change 1 (modulation wheel) rises from 0 to 127 in steps of 1, one value every 15 ticks, reaching 127 at tick 1,905. After the note ends at tick 1,920, CC 1 is reset to 0. That is 129 Control Change events and 1 note over 2 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
1
Duration
2 seconds
Also check
129 CC 1 events: 0 to 127, then 0; Highest CC 1 value 127 at tick 1,905
Size
570 bytes

Download cc-mod-wheel-sweep.mid

Pitch bend sweep

Sets the pitch bend range to ±2 semitones with RPN 0 (CC 101 = 0, CC 100 = 0, CC 6 = 2, CC 38 = 0, then CC 101 and CC 100 = 127 to close the RPN). Then A4 (note 69) is held for one bar at 120 BPM while 33 pitch bend messages move from the lowest value (−8192, bytes 00 00) to the highest (+8191, bytes 7F 7F) in steps of 512, one every 60 ticks. The note glides from G4 up to B4. After the note ends, a 34th message returns the bend to the centre (0, bytes 00 40). Lasts 2 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
1
Duration
2 seconds
Also check
34 pitch bend events: −8192 to +8191, then 0; 6 Control Change events (RPN 0 = 2 semitones)
Size
221 bytes

Download pitch-bend-sweep.mid

General MIDI program changes

Plays middle C for two beats on each of five General MIDI instruments in turn, with a Program Change before each note: 0 Acoustic Grand Piano, 24 Acoustic Guitar (nylon), 40 Violin, 56 Trumpet, 73 Flute. Program numbers in the file count from 0; instrument lists that count from 1 show them as 1, 25, 41, 57, 74. Five notes over 5 seconds at 120 BPM.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
5
Duration
5 seconds
Also check
Program Changes 0, 24, 40, 56, 73 at 0, 1, 2, 3 and 4 s; Each note lasts 1 s
Size
115 bytes

Download program-changes-gm.mid

Show all 115 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 01 E0 4D 54
72 6B 00 00 00 5D 00 FF 03 12 47 4D 20 70 72 6F
67 72 61 6D 20 63 68 61 6E 67 65 73 00 FF 51 03
07 A1 20 00 C0 00 00 90 3C 64 87 40 80 3C 00 00
C0 18 00 90 3C 64 87 40 80 3C 00 00 C0 28 00 90
3C 64 87 40 80 3C 00 00 C0 38 00 90 3C 64 87 40
80 3C 00 00 C0 49 00 90 3C 64 87 40 80 3C 00 00
FF 2F 00

System exclusive: GM System On

Starts with the universal non-real-time System Exclusive message GM System On (F0 7E 7F 09 01 F7), which resets a General MIDI device to its defaults. In the file the event is stored as F0, the length 05, then 7E 7F 09 01 F7. Half a beat later a C4 plays for one beat. 1 note, 1 SysEx event, 0.75 seconds at 120 BPM.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
1
Duration
0.75 seconds
Also check
One F0 event with data 7E 7F 09 01 F7; Note C4 from 0.25 s to 0.75 s
Size
51 bytes

Download sysex-gm-system-on.mid

Show all 51 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 01 E0 4D 54
72 6B 00 00 00 1D 00 FF 51 03 07 A1 20 00 F0 05
7E 7F 09 01 F7 81 70 90 3C 64 83 60 80 3C 00 00
FF 2F 00

Four-byte delta time

Exercises the longest variable-length delta time. The division is 16,384 ticks per quarter note and the tempo 240 BPM. A C4 starts at tick 0 and its Note Off follows after a delta of 2,097,152 ticks, encoded as 81 80 80 00: the smallest number that needs all four bytes. That is 128 quarter notes, so the single note lasts exactly 32 seconds. A parser that reads only three bytes, or mishandles the continuation bits, will lose sync here.

What a correct parser reports

Format
0
Tracks
1
Time division
16,384 ticks per quarter note
Notes
1
Duration
32 seconds
Also check
Delta bytes 81 80 80 00 = 2,097,152 ticks; Note length 32 s
Size
44 bytes

Download long-delta.mid

Show all 44 bytes in hex
4D 54 68 64 00 00 00 06 00 00 00 01 40 00 4D 54
72 6B 00 00 00 16 00 FF 51 03 03 D0 90 00 90 3C
64 81 80 80 00 80 3C 00 00 FF 2F 00

Common meta events

One track with the meta events a parser is most likely to meet: Track Name ("Meta event test"), Copyright, Text, Time Signature 3/4, Key Signature B♭ major (stored as FE 00: two flats, major), Set Tempo 120 BPM, Markers "Start" and "End", and a Lyric on each of three quarter notes (B♭3 "Do", D4 "re", F4 "mi"). The bar of 3/4 lasts 1.5 seconds.

What a correct parser reports

Format
0
Tracks
1
Time division
480 ticks per quarter note
Notes
3
Duration
1.5 seconds
Also check
Key signature B♭ major, time signature 3/4; Lyrics "Do", "re", "mi" at 0, 0.5 and 1 s
Size
256 bytes

Download meta-events.mid

Using the files in tests

Keep the expected values next to the files in your own test suite: parse each file, then compare the track count, the number of notes and the end time with the list above. Timing files are the most revealing. A parser that ignores tempo events after the first will get the wrong length for tempo-changes.mid, one that assumes ticks per quarter note will misread smpte-division-25fps.mid, and one that forgets running status will stop on the second byte of running-status.mid.