Skip to content
FastTool

MIDI File Inspector

See exactly what’s inside a MIDI file (tracks, instruments, tempo changes and every event), spot what will cause trouble, and download a fixed copy.

Runs in your browser. Nothing is uploaded.

Your MIDI file

What’s inside appears here: format, tracks, timing, length, tempo and notes.

Problems and fixes

Open a MIDI file or choose “Try an example”. We list what can make it play wrong here, each with a fix.

Inside the file

Tracks and instruments, a piano roll, every event, the tempo map and lyrics appear here.

More changes

Open a file to change its tempo or length, transpose it, set instruments, move channels, scale velocities and rename tracks.

How to use

  1. The page opens with an example song, so you can see the tool at work. Choose your own .mid file, or drop it anywhere on the page.
  2. Read “Problems and fixes”. Each problem says what you’ll hear and how to fix it. Choose a fix, or “Fix all”. Anything marked “Check by hand” is left out of “Fix all”: listen first, then use its own button if it’s right.
  3. Look inside with the tabs: tracks and instruments, a piano roll, every event, the tempo map, and text and lyrics. Press Play for a quick preview.
  4. Under “More changes”, change the tempo or length, transpose, set instruments, move channels, scale velocities or rename tracks.
  5. Choose format 1 or format 0 and download the fixed MIDI file. You can also download the notes as CSV or the event list as text.

Worked example

Input

demo-song.mid: format 1, 480 ticks per quarter note, 5 tracks. A tempo track (120 BPM, slowing to 90 BPM at bar 33), piano on channel 1, bass on channel 2, strings on channel 3, and drums wrongly on channel 1. 793 notes in all.

What the inspector finds

Length: 32 bars at 120 BPM (64 s) plus 4 bars at 90 BPM (10.67 s) = 1:14.7. Three problems: the drums play on channel 1 (388 notes, so they sound like piano), 3 piano notes never end (C4, E4 and G4 at bar 35), and track 3 has no end-of-track marker.

Result

“Fix all”, then Format 0 and Download: demo-song-fixed.mid has one track, all 793 notes, the drums on channel 10 and the last piano chord ending with the song. Length is still 1:14.7 and no problems are left.

How it works

What’s in a MIDI file

A Standard MIDI File starts with a header chunk, MThd, that gives the format, the number of tracks and the timing. Then come the tracks, each in an MTrk chunk: a list of events, each after a delta time, the number of ticks since the event before it.

  • Format 0: one track that holds every channel. Some keyboards and arrangers need it.
  • Format 1: several tracks played together. The first track holds the tempo map: tempo and time signature changes.
  • Format 2: separate patterns, each with its own timing. Few apps play it.

The timing field is either ticks per quarter note (PPQ, such as 96, 480 or 960) or SMPTE time: frames per second and ticks per frame.

Delta times and running status

Delta times are variable-length quantities: 7 bits per byte, with the top bit set on every byte except the last, up to 4 bytes. Running status lets a file leave out a status byte that repeats. The inspector reads both. Its downloads write every status byte in full, which every app reads.

Variable-length quantities (examples from the Standard MIDI Files specification)
Value (hex)Bytes in the fileValue (hex)Bytes in the file
0000400081 80 00
4040100000C0 80 00
7F7F1FFFFFFF FF 7F
8081 0020000081 80 80 00
2000C0 008000000C0 80 80 00
3FFFFF 7FFFFFFFFFF FF FF 7F

Meta events

Meta events (FF, type, length, data)
TypeNameHolds
00Sequence numberA number for the sequence or pattern
01TextAny text (karaoke .kar files keep their words here)
02CopyrightA copyright line
03Track nameThe track’s name; in format 0 or the first track, the song’s name
04Instrument nameA description of the instrument
05LyricA syllable or word of the lyrics
06MarkerA section name such as “Verse”
07Cue pointA cue for film or stage
20Channel prefixThe channel that later meta and SysEx events belong to
21MIDI portThe output port for the track
2FEnd of trackRequired at the end of every track
51TempoMicroseconds per quarter note (3 bytes)
54SMPTE offsetWhere the track starts, in hours, minutes, seconds and frames
58Time signatureTop number, bottom number as a power of 2, metronome clocks, 32nd notes per quarter
59Key signatureSharps (positive) or flats (negative), and major or minor
7FSequencer-specificData for one maker’s software

From ticks to seconds

A tempo event gives microseconds per quarter note: 500,000 µs is 120 BPM, and a file without a tempo plays at 120 BPM. The inspector adds up each stretch between tempo changes:

seconds = Σ (ticks in the stretch × µs per quarter note) ÷ (ticks per quarter note × 1,000,000) BPM = 60,000,000 ÷ µs per quarter note

In the example, 61,440 ticks × 500,000 ÷ (480 × 1,000,000) = 64 s, then 7,680 ticks × 666,667 ÷ (480 × 1,000,000) = 10.667 s, so the song lasts 74.667 s (1:14.7). With SMPTE timing, seconds = ticks ÷ (frames per second × ticks per frame), where 29 means 29.97 frames per second.

Bars and beats follow the time signatures. A beat is the bottom number’s note: a quarter note in 4/4, an eighth note in 6/8. Positions read bar:beat:tick and start at 1:1:000.

Drums, instruments and channels

General MIDI plays drum sounds only on channel 10, where each key is one drum, from 35 Acoustic Bass Drum to 81 Open Triangle. General MIDI 2, GS and XG kits add more, from 27 High Q to 87 Open Surdo, such as 82 Shaker and 33 Metronome Click. On the other channels a program change picks one of 128 instruments; a channel without one plays 1 Acoustic Grand Piano. Channels and programs show as 1–16 and 1–128, as in the General MIDI list; the file stores them as 0–15 and 0–127.

SysEx set-up messages get their names when we recognize them: GM System On (F0 7E 7F 09 01 F7), GM2 System On (F0 7E 7F 09 03 F7), Roland’s GS Reset (F0 41 10 42 12 40 00 7F 00 41 F7) and Yamaha’s XG System On (F0 43 10 4C 00 00 7E 00 F7), with any device number.

How problems are found

  • Stuck notes: a note-on with no note-off of its own in the same track, key and channel. A note-off ends the oldest sounding note of its key (first in, first out), and a note-on with velocity 0 counts as a note-off. When a note starts again before the first one ends and only one note-off follows, that note-off goes to the first note; many players stop both there.
  • Overlaps: a note that starts again while the same key is still sounding on that channel.
  • Drums on the wrong channel: a track named like a drum part (drums, kit, percussion and so on) on a channel other than 10, with its notes on the drum keys. A part whose notes are mostly kick, snare and hi-hat keys but whose name doesn’t say drums is marked “Check by hand”, because bass lines in the lowest octaves use the same keys. A track named like an instrument (bass, piano and so on) is never called drums.
  • A melodic part on channel 10: a track named like an instrument (piano, bass, strings and so on). A part with many notes outside the drum keys 27 to 87 is marked “Check by hand”. A track named like drums or percussion (shaker, congas, click and so on) stays on channel 10.
  • No tempo: the file has notes but no tempo event, so players use 120 BPM. It’s listed as good to know.
  • File structure: end-of-track markers, chunk lengths, the track count, running status and stray bytes, checked against the specification.

What the fixes do

  • Add note-offs: a stuck note ends at the next note-off of its key or where the same key plays again later on that channel, whichever comes first, as many players already stop it there; with neither, at the end of the track. When that note-off comes at the moment the note starts, the note gets a 32nd note.
  • Trim the overlaps: a note still sounding when its key plays again ends at that moment, and the note-off it no longer needs goes to the next note of that key that has none. Two notes that start together become one, as long as the longer, and the other note-off can still end a later note of that key that has none.
  • Give them a short length: zero-length notes last a 32nd note, or until the key plays again. One that the same key restarts at the same moment is removed, because no length fits before it. A note-off with no matching note that would cut the new length short is removed too; players ignore such note-offs anyway.
  • Move to channel 10: every event of that part on its old channel moves to channel 10.
  • Format 0: all tracks merge in time order. At the same moment, meta events come first, then note-offs, then the rest, so no note is cut short. Format 1 from a format 0 file: a tempo track plus one track per channel.
  • Change tempo: scaling keeps every tempo change in proportion; one tempo replaces them all; fitting a length works out the scale or the tempo for the time you enter. Notes keep their bars and beats.
  • Every download writes each event with its full status byte and ends every track with an end-of-track marker. Events you didn’t change are written as they were, and we read the new file back to check it opens.

Preview sound

Play uses a simple synth, one voice per note shaped by the General MIDI instrument family, and the drum sounds from the Drum Pattern Maker. It follows volume, expression, pan and the sustain pedal, but not pitch bend or effects, so it’s a quick check rather than the real sound. Where your browser supports Web MIDI, you can play the file on a connected keyboard or synth instead.

Sources

FAQ

How can I see which instruments a MIDI file uses?

Open the file here and look at the Tracks tab. It lists every track with its channel and General MIDI instrument, and “Instruments by channel” shows what each channel plays. A channel with no program change plays 1 Acoustic Grand Piano, and channel 10 plays drums.

Why do my drums play as piano?

General MIDI plays drum sounds only on channel 10. When a drum part sits on another channel, players give it that channel’s instrument, usually a piano. The inspector spots drum tracks on other channels, and “Move to channel 10” fixes them.

How do I convert a MIDI file from type 1 to type 0?

Open the file, choose “Format 0 (one track)” next to the download button and download. Every track is merged into one, and every event keeps its time and channel. Type and format mean the same thing here.

How do I change the tempo of a MIDI file?

Use “Change tempo” under More changes. Scale every tempo by a percentage (tempo changes stay in proportion), set one tempo for the whole song, or fit the song to a length such as 2:30. Notes keep their bars and beats; only the speed changes.

What does PPQ mean?

Pulses (ticks) per quarter note: the timing resolution in the file’s header. At 480 PPQ a quarter note is 480 ticks and a 16th note is 120. The tempo sets how long a tick lasts: at 120 BPM and 480 PPQ, one tick is about 1.04 ms.

Why does my player show the wrong song length?

The length depends on the tempo map and on where each track ends. A file without a tempo plays at 120 BPM, an end-of-track marker long after the last note adds silence, and a stuck note can keep a track going. The summary shows the file’s length, and the tempo map shows every change.

Can I edit notes here?

This page fixes whole files rather than single notes: format, channels, instruments, tempo and length, key, velocities and track names. To move or edit single notes, use your DAW or a MIDI editor, then open the result here to check it.

Are my files uploaded?

No. Your file is read and fixed by this page in your browser and never leaves your device. The downloads are made on your device too.

Step by step: fix MIDI drums that play as piano, or compare MIDI Type 0 and Type 1 files.

Updated