Musical Instrument Digital Interface
MIDI files store musical instructions — notes, timing, velocity, and instrument selections — not audio waveforms. Musicians compose and arrange with MIDI in DAWs, while developers parse the binary MThd/MTrk structure to build music software and interactive applications.
MIDI contains sequencer instructions, not audio samples. Converting MIDI to audio requires a synthesizer and soundfont library not available in browser WASM.
Common questions
Can FileDex convert MIDI to audio?
No. MIDI contains musical instructions, not audio data. Converting MIDI to MP3 or WAV requires a synthesizer with instrument samples (SoundFont). Use FluidSynth or a DAW like GarageBand to render MIDI to audio with your preferred instrument sounds.
Why does my MIDI file sound different on different devices?
MIDI files specify instrument numbers (Program Change), not actual sounds. Each device or software synthesizer uses its own instrument samples. A piano patch on a Roland synthesizer sounds different from the same patch number on a Yamaha or a software SoundFont.
What is the difference between MIDI Type 0, 1, and 2?
Type 0 stores all channels in a single track — simplest format, most compatible. Type 1 stores each instrument in a separate track with synchronized playback — standard for multi-track editing. Type 2 stores independent patterns (rarely used, mainly for drum machines).
How do I view the contents of a MIDI file?
MuseScore opens MIDI as notation. For raw event data, use midicsv to convert to CSV, or the Python mido library to iterate events programmatically. DAWs like FL Studio and Ableton show MIDI as piano-roll note blocks.
What is General MIDI?
General MIDI (GM) is a standardized mapping of 128 instrument patches (Program 0 = Acoustic Grand Piano, Program 73 = Flute, etc.) and a percussion key map on channel 10. GM ensures a MIDI file sounds approximately correct on any GM-compatible synthesizer.
What makes .MIDI special
What is a MIDI file?
MIDI (Musical Instrument Digital Interface) files contain musical instructions — notes, timing, instrument selections, and dynamics — rather than actual audio waveforms. A MIDI file is like sheet music for computers, telling synthesizers which notes to play, when, and how.
Continue reading — full technical deep dive
How to open MIDI files
- Windows Media Player (Windows) — Built-in playback
- GarageBand (macOS, iOS) — Free, Apple's music tool
- VLC Media Player (Windows, macOS, Linux) — Free
- MuseScore (Windows, macOS, Linux) — Free, visual notation
- FL Studio (Windows, macOS) — DAW with MIDI editing
Technical specifications
| Property | Value |
|---|---|
| Type | Instruction data (not audio) |
| Channels | 16 standard channels |
| Resolution | Up to 960 PPQN |
| File Types | Type 0 (single track), Type 1 (multi-track) |
| Events | Note, Control Change, Program Change |
| General MIDI | 128 standard instruments |
Programs that open MIDI files
- MuseScore — Free music notation
- FL Studio — Digital audio workstation
- Ableton Live — Music production
- Logic Pro — macOS music production
- LMMS — Free open-source DAW
Common use cases
- Music composition: Writing and arranging music
- Karaoke: Background music tracks
- Game music: Adaptive game soundtracks
- Music education: Visualizing musical structure
.MIDI compared to alternatives
| Formats | Criteria | Winner |
|---|---|---|
| .MIDI vs .MP3 | File size A 5-minute MIDI file is typically 20-100 KB because it stores only note instructions. The same duration as MP3 at 192 kbps is approximately 7 MB. MIDI is 100-300x smaller but requires a synthesizer for playback. | MIDI wins |
| .MIDI vs .MUSICXML | Notation support MusicXML explicitly encodes notation layout, dynamics markings, articulations, and score formatting. MIDI captures performance data (note timing and velocity) but loses notation-specific information like beam groupings and stem directions. | MUSICXML wins |
| .MIDI 1.0 vs .MIDI 2.0 | Controller resolution MIDI 2.0 uses 32-bit values for velocity, controllers, and pitch bend versus 7-bit (128 steps) in MIDI 1.0. This 16,000x increase in resolution eliminates the staircase artifacts audible in gradual controller sweeps. | MIDI 2.0 wins |
Technical reference
- MIME Type
audio/midi- Magic Bytes
4D 54 68 64MThd (MIDI Track Header) signature.- Developer
- MIDI Manufacturers Association
- Year Introduced
- 1983
- Open Standard
- Yes — View specification
MThd (MIDI Track Header) signature.
Binary Structure
A Standard MIDI File begins with a 14-byte header chunk: 4-byte chunk ID MThd (4D 54 68 64), 4-byte big-endian chunk length (always 00 00 00 06), 2-byte format type (0, 1, or 2), 2-byte number of tracks, and 2-byte timing division (ticks per quarter note or SMPTE frames). Following the header, one or more track chunks appear, each starting with MTrk (4D 54 72 6B), a 4-byte big-endian length, and a sequence of MIDI events. Each event is prefixed by a variable-length delta-time (1-4 bytes using 7-bit encoding with continuation bit). Events include Note On/Off (0x9n/0x8n), Control Change (0xBn), Program Change (0xCn), Pitch Bend (0xEn), Meta events (0xFF followed by type and length), and SysEx events (0xF0/0xF7). Running status allows omitting the status byte when consecutive events share the same type.
| Offset | Length | Field | Example | Description |
|---|---|---|---|---|
0x00 | 4 bytes | Chunk ID | 4D 54 68 64 (MThd) | MIDI header chunk identifier. All SMF files start with these bytes. |
0x04 | 4 bytes | Header Length | 00 00 00 06 | Big-endian length of header data (always 6 bytes for standard SMF). |
0x08 | 2 bytes | Format Type | 00 01 | 0 = single multi-channel track, 1 = multiple simultaneous tracks, 2 = multiple independent tracks. |
0x0A | 2 bytes | Number of Tracks | 00 0A (10 tracks) | Count of MTrk chunks in the file. Type 0 files always have 1 track. |
0x0C | 2 bytes | Timing Division | 01 E0 (480 PPQN) | If bit 15 = 0: ticks per quarter note (PPQN). If bit 15 = 1: SMPTE frames (negative frame rate in upper byte, ticks per frame in lower byte). |
0x0E | 4 bytes | Track Chunk ID | 4D 54 72 6B (MTrk) | Start of first track data chunk. Contains delta-time prefixed MIDI events. |
Attack Vectors
- Malformed variable-length delta-time values without termination can cause parsers to read beyond track boundaries into arbitrary file data
- Extremely large SysEx messages (0xF0) with crafted length fields can trigger heap allocation overflow in MIDI libraries that allocate based on declared size
Mitigation: FileDex presents MIDI as a reference-only format. No MIDI processing or synthesis is performed in the browser. The format page provides documentation and links to external tools.