Standard MIDI File
A Standard MIDI File (SMF, usually with the extension .mid) stores MIDI data with timing, so that it can be exchanged between programs. A file contains one or more streams of MIDI messages, with timing information for each event.[1:1] Compact representation was one of the design goals, making the format well suited to disk storage though not necessarily to quick access by a sequencer, and it was not meant to replace programs' own file formats.[1:2] The MIDI Association publishes it as recommended practice RP-001, and it is defined within the Complete MIDI 1.0 Detailed Specification.[1:2][2:1]
Structure
The Library of Congress describes the SMF as a wrapper format for MIDI data. It is built of chunks, like the Electronic Arts IFF format, but has no nested chunks. A header chunk identifies the track chunks that follow, and every file begins with the four bytes "MThd".[2:1] Files can hold song, sequence and track structures, tempo and time signature information and track names, and can contain several tracks and several sequences.[1:2]
Each track is a sequence of MIDI events on one of 16 channels. Note-on and note-off messages give each note's start and end, control events such as pitch bends refine playback, and program changes choose the instrument.[3:1]
Timing
Timing in a MIDI file comes from two things. Each event gives the number of "ticks" since the previous event, and the file's resolution, stored in the header, sets how many ticks make a beat. Tempo events, which specify microseconds per quarter note, set how long a beat lasts. At 220 ticks per beat and 120 beats per minute, for example, an event 330 ticks after the previous one comes 0.75 seconds later. The default tempo is 120 beats per minute. In Colin Raffel's collection of scraped files most had a single tempo, but some used many tempo changes so that the file followed the timing of a particular recording.[3:1]
Meta-events
Besides MIDI messages, files carry meta-events: sequence information, text, copyright notices, track names and more.[2:1] Lyrics meta-events add timestamped text, which makes MIDI files common for karaoke; files with lyrics often take the extension .kar.[3:2][2:1] Later recommended practices define how to use lyric meta-events and add meta-events naming devices, so that one file can address more than 16 channels.[1:2] The copyright meta-event gives a mechanism for attribution but is used inconsistently.[4:1]
Use
Music for General MIDI devices is commonly distributed as Standard MIDI Files.[5:1] Played on a GM synthesizer, a whole song needs only a few kilobytes, which made MIDI files a pervasive way of storing songs before MP3 and kept them in karaoke machines and ringtones.[3:3] Because many are transcriptions of songs, they are used in music research as training data for transcription, for score-informed source separation and for onset detection, as in the Lakh MIDI Dataset.[3:4]
For MIDI 2.0, the MIDI Clip File defines a file format for sequences in the Universal MIDI Packet format.[1:2]
- ^ ↗ smf ^a ^b ^c ^d ^e ↗ sm-design Standard MIDI Files. MIDI.org. The MIDI Association. https://midi.org/standard-midi-files.
- ^a ^b ^c ^d ↗ lc-smf Library of Congress (2025-06-10). Standard MIDI File Format (fdd000119). Sustainability of Digital Formats: Planning for Library of Congress Collections. https://www.loc.gov/preservation/digital/formats/fdd/fdd000119.shtml.
- ^a ^b ↗ rt-timing ^ ↗ rt-lyrics ^ ↗ rt-gm ^ ↗ rt-uses Raffel, Colin (2016). Learning-Based Methods for Comparing Sequences, with Applications to Audio-to-MIDI Alignment and Matching. Columbia University. https://colinraffel.com/publications/thesis.pdf.
- ^ ↗ lm-dataset Raffel, Colin. The Lakh MIDI Dataset v0.1. https://colinraffel.com/projects/lmd/.
- ^ ↗ mg-levels General MIDI. MIDI.org. The MIDI Association. https://midi.org/general-midi.