Table of Contents
MIDI File Format
License
The bulk of information for this article comes from public domain sources, in particular Standard MIDI File Format by Dustin Caldwell. The rest was filled in through various sources and contributions. As such, even though most articles on this site are licensed under the Creative Commons Attribution license, this article is here by released into the public domain.
File Structure
MIDI sequence files are made up of chunks of data. The header chunk describes information about the MIDI file as a whole. The header chunk is followed by one or more track chunks, each of which contain a sequence of MIDI events. MIDI events consist of some kind of command or status with associated data plus a time-stamp for each message. Each track may contain information for up to 16 MIDI channels. Events and data are stored big-endian which is the most significant byte first. Events are stored in a variable-length format which may use one or more bytes. The high-order bit is used to determine the last byte in a sequence. If the high-order bit is set to 1 then another byte follows, if the high-order bit is 0 then this is the last byte in the sequence. The lower 7 bits of each byte are used to store the actual data. As the commands are read the data must be reformatted for the specific platform.
Header Chunk
The first chunk in the file is the header chunk. The header chunk always starts with a magic value 'MThd'. This is stored in the first 4 bytes of the file. The next four bytes is the size of the header in bytes. This size does not count the magic value or the size field of the header. As such, this value will always be 6.
4D 54 68 64 00 00 00 06 ff ff nn nn dd dd
Following the size field is a 16-bit field specifying the file format (ff ff
above). This will be one of three values:
0 - single-track
1 - multiple tracks, synchronous
2 - multiple tracks, asynchronous
Single track is only one track that contains all of the MIDI events for the entire file, including the song title, time signature, tempo and music events. Synchronous multiple tracks contains more than one track each of which start at the same time. The first track typically contains song information such as the title and copyright information, time signature, tempo, etc. The following tracks contain a title, musical event data, etc. specific to that track. Asynchronous multiple tracks also contains multiple tracks however they do not have to start at the same time.
The next field is a 16-bit value specifying the number of tracks in the file (nn nn
above). For single-track this value is 1. For multiple track files this can be up to 65535.
The last field is a 16-bit value specifying the number of delta-time ticks per quarter note (dd dd
above) or frames per second. If the most significant bit is 0 the remaining bits specify the delta-time ticks per beat. If the most significant bit is 1 the remaining bits specify the delta-time in frames per second. For ticks per beat, common values range from 48 to 960.
Frames per second is defined by breaking the remaining 15 bits into two values. The top 7 bits define a value for the number of SMPTE frames and can be 24, 25, 29 (for 29.97 fps) or 30. The remaining 8 bits define how many ticks there are per frame.
In C the header structure looks something like this:
#define MID_ID 'dhTM' #define MID_HDR_SIZE 0x06000000 #define MID_FMT_SINGLE 0x0000 // single track #define MID_FMT_MULTIS 0x0100 // multiple tracks, synchronous #define MID_FMT_MULTIA 0x0200 // multiple tracks, asynchronous #pragma pack(push, 1) struct mid_header { unsigned int id; // identifier "MThd" unsigned int size; // always 6 in big-endian format unsigned short format; // big-endian format unsigned short tracks; // number of tracks, big-endian unsigned short ticks; // number of ticks per quarter note, big-endian }; #pragma pack(pop)
Track Chunks
Following the header is one or more track chunks. Each track has one header followed by a stream of MIDI event. Similar to the file header, the track header always starts with a magic value 'MTrk'. This is stored in the first 4 bytes of the track header. The next four bytes is the size of the size of the track in bytes. This size does not count the magic value or the size field of the header.
4D 54 72 6B xx xx xx xx
In C the header structure looks something like this:
#define MID_TRK_ID 'krTM' struct mid_track { unsigned int id; // identifier "MTrk" unsigned int length; // track length, big-endian };
Following the header are the actual MIDI events. MIDI events consist of a delta-time followed by a MIDI event. The delta-time is the number of ticks after which the MIDI event should be executed. The delta-time is a variable length encoded value. Each byte of the value contains 7 bits of data and 1 bit for continuation. The first byte is read and the 7 least significant bits are extracted. If the most significant bit is 1, the next byte is read. The 7 least significant bits are extracted. The previous value is multiplied by 128 and the new value is added. If the most significant bit is 0, the process is done. The delta-time should never be more than 4 bytes long.
The delta-time is relative to the last event. If two or more events should be executed simultaneously, the first event specifies the delta-time to wait since the previous event, the following events have a delta-time of 0. Simply put, wait 0 ticks from the previous event to execute this event.
Example:
Play note A followed by note B 100 ticks later, stop A after 200 ticks, stop B at the same time as A. Ticks Event Description -------------------------------------------------------------- 0 Note A on event Note A starts playing immediately 100 Note B on event Note B starts playing 100 ticks after A 100 Note A off event Note A stops playing after 200 total ticks 0 Note B off event Note B stops at the same time as A (after 100 ticks)
MIDI Event Commands
Each midi event has a command byte followed by one or more data bytes. The command byte will always have a most significant bit of 1. Each command has different parameters and lengths, but the data that follows the command will have a most significant bit of 0. The exception to this is a meta-event, which may contain data with a most significant bit of 1. However, meta-events require a length parameter which alleviates confusion.
For all of these messages, a convention called the "running status byte" or "running mode" may be used. If the transmitter wishes to send another message of the same type on the same channel, thus the same status byte, the status byte need not be resent. Running mode is identified by checking the most significant bit of the next "event byte". If the most significant bit is 0, the "event byte" is not really the next event but the first parameter to the event. The actual event byte was omitted and the previous event byte is used.
+--7----6----5----4----3----2----1----0-+ | 1 | Event type | Channel number | +---------------------------------------+
Each command byte has 2 parts. The left nibble (4 bits) contains the actual command, and the right nibble (xxxx
) contains the midi channel number on which the command will be executed. There are 16 midi channels and 8 midi commands. The data bytes that follow the command will have a most significant bit of 0.
Hex | Binary | Data | Description |
---|---|---|---|
8x | 1000xxxx | nn vv | Note off event. This message is sent when a note is released (ended).nn = note number vv = velocity |
9x | 1001xxxx | nn vv | Note on event. This message is sent when a note is depressed (start). A "note on" event with a velocity of zero is equivalent to a "note off" event.nn = note number vv = velocity |
Ax | 1010xxxx | nn vv | Polyphonic Key Pressure (After-touch). This message is sent when the pressure (velocity) of a previously triggered note changes.nn = note number vv = velocity |
Bx | 1011xxxx | cc vv | This message is sent when a controller value changes. Controllers include devices such as pedals and levers. Certain controller numbers are reserved for specific purposes. See Channel Mode Messages.cc = controller number vv = new value |
Cx | 1100xxxx | pp | Program (patch) change. This message sent when the patch number changes. pp = new program number |
Dx | 1101xxxx | cc | Channel Pressure (After-touch). This message is sent when the channel pressure changes. Some velocity-sensing keyboards do not support polyphonic after-touch. Use this message to send the single greatest velocity.cc = channel number |
Ex | 1110xxxx | bb tt | Pitch wheel change. This message is sent to indicate a change in the pitch wheel. The pitch wheel is measured by a fourteen bit value. Center (no pitch change) is 2000H. Sensitivity is a function of the transmitter.bb = bottom (least sig) 7 bits of value tt = top (most sig) 7 bits of value |
FF | 11111111 | xx nn dd .. | Meta-event. This message indicates a meta-event which is described below. |
Channel Mode Messages
Hex | Binary | Data | Description |
---|---|---|---|
Bx | 1011xxxx | cc vv | This the same code as the Control Change (above), but implements Mode control by using reserved controller numbers. The numbers are: Local Control. When Local Control is Off, all devices on a given channel will respond only to data received over MIDI. Played data, etc. will be ignored. Local Control On restores the functions of the normal controllers. cc = 122, vv = 0: Local Control Offcc = 122, vv = 127: Local Control OnAll Notes Off. When an All Notes Off is received, all oscillators will turn off. cc = 123, vv = 0: All Notes Off(See text for description of actual mode commands.) cc = 124, vv = 0: Omni Mode Offcc = 125, vv = 0: Omni Mode Oncc = 126, vv = M : Mono Mode On (Poly Off) where M is the number of channels (Omni Off) or 0 (Omni On)cc = 127, vv = 0: Poly Mode On (Mono Off)(Note: These four messages also cause All Notes Off) |
Meta-Events
The following table lists meta-events which have no midi channel number. They are of the format:
FF xx nn dd
All meta-events start with FF
followed by the command (xx
), the length, or number of bytes that will contain data (nn
), and the actual data (dd
).
Hex | Binary | Data | Description |
---|---|---|---|
00 | 00000000 | nn ssss | Sets the track's sequence numbernn = 02 (length of 2-byte sequence number).ssss = sequence number |
01 | 00000001 | nn tt … | Text event - any text you want.nn = length in bytes of text.tt = text characters |
02 | 00000010 | nn tt … | Same as text event, but used for copyright info.nn tt = same as text event. |
03 | 00000011 | nn tt … | Sequence or Track name.nn tt = same as text event. |
04 | 00000100 | nn tt … | Track instrument name.nn tt = same as text event. |
05 | 00000101 | nn tt … | Lyric. Defines the lyrics in a song by syllable or group of words per quarter note.nn tt = same as text event. |
06 | 00000110 | nn tt … | Marker. Marks a significant point in time for the sequence (e.g. beginning of a new verse). nn tt = same as text event. |
07 | 00000111 | nn tt … | Cue point. Marks the start of some type of new sound or action.nn tt = same as text event. |
20 | 00100000 | ?? | MIDI channel prefix assignment. |
21 | 00100001 | 01 pp | Has been used, though unofficially, for a MIDI port or cable number. (deprecated) |
2F | 00101111 | 00 | End of Track. This event must come at the end of each track. |
51 | 01010001 | 03 tttttt | Set tempotttttt = microseconds/quarter note. (microseconds/beat)MICROSECONDS_PER_MINUTE = 60000000 BPM = MICROSECONDS_PER_MINUTE / MPQN MPQN = MICROSECONDS_PER_MINUTE / BPM If no tempo is specified, the default is 120 beats-per-minute. (500,000 microseconds/beat) TODO: How does this relate to delta-time ticks per quarter note specified in the header chunk? |
54 | 01010100 | 05 hh mm ss ff sf | SMPTE offset. SMPTE starting point from the beginning of the track. hh = hours (0-23), mm = minutes (0-59), ss = seconds (0-59), ff = frames (0-30) and sf = sub-frames (0-99) (always 100 sub-frames per frame, no matter what sub-division is specified in the MIDI header chunk).The byte used to specify the hour offset also specifies the frame rate in the following format: 0rrhhhhh where rr is two bits for the frame rate where 00 = 24 fps, 01 = 25 fps, 10 = 30 fps (drop frame), 11 = 30 fps and hhhhh is 5 bits for the hour (0-23). The hour byte's top bit is always 0. The frame byte's possible range depends on the encoded frame rate in the hour byte. A 25 fps frame rate means that a maximum value of 24 may be set for the frame byte. |
58 | 01011000 | 04 nn dd cc bb | Time Signaturenn = numerator of time sig. dd = denominator of time sig. 2 = quarter 3 = eighth, etc.cc = number of MIDI clocks in metronome click. (MIDI clocks per beat) bb = number of 32nd notes to the quarter noteMIDI clock bytes are used to synchronize playback of multiple MIDI devices. The MIDI clock ticks 24 times per quarter note. For example, 6/8 time with a metronome click every 3 eighth notes and 24 clocks per quarter note, the cc value would be set to 36 MIDI clocks per beat. |
59 | 01011001 | 02 sf mi | Key signaturesf = sharps/flats (-7 = 7 flats, 0 = key of C, 7 = 7 sharps).mi = major/minor (0 = major, 1 = minor) |
7F | 01111111 | xx dd … | Sequencer specific informationxx = number of bytes to be sent.dd = data |
bpm = beats per minute. 60000000 / bpm = tt tt tt. nn = delta-time ticks per beat. (specified in the header chunk) tt tt tt = microseconds per beat. (specified by the tempo event) tt tt tt / nn = microseconds per delta-time tick. (PPQN Clock) 96 delta-time ticks per beat. (header) 120 beats per minute = 500000 microseconds per beat. (tempo event) 500000 / 96 = 5208.3 microseconds per delta-time tick. 500000 / 48 = 10416.7 microseconds per delta-time tick.
System Messages
The following are system messages which control the entire system. These commands are used to control physical MIDI devices and are not typically found in MIDI files. They have no midi channel number. (They will generally only apply to controlling a midi keyboard, etc.)
System Common Messages
Hex | Binary | Data | Description |
---|---|---|---|
F0 | 11110000 | ii dd … dd F7 | System Exclusive. This message makes up for all that MIDI doesn't support. (ii) is a seven bit Manufacturer's I.D. code. If the synthesizer recognizes the I.D. code as its own, it will listen to the rest of the message (dd). Otherwise, the message will be ignored. System Exclusive is used to send bulk dumps such as patch parameters and other non-spec data. (Note: Real-Time messages ONLY may be interleaved with a System Exclusive.) |
F1 | 11110001 | Undefined. | |
F2 | 11110010 | ll mm | Song Position Pointer. This is an internal 14 bit register that holds the number of MIDI beats (1 beat = six MIDI clocks) since the start of the song. ll is the least significant byte, mm the most significant byte. |
F3 | 11110011 | ss | Song Select. The Song Select specifies which sequence or song is to be played. ss is the song number. |
F4 | 11110100 | Undefined. | |
F5 | 11110101 | Undefined. | |
F6 | 11110110 | Tune Request. Upon receiving a Tune Request, all analog synthesizers should tune their oscillators. | |
F7 | 11110111 | End of Exclusive. Used to terminate a System Exclusive dump (see above). |
Divided System Exclusive Events
A large amount of System Exclusive data in a Normal System Exclusive Event could cause following MIDI Channel Events to be transmitted after the time they should be played. This will cause an unwanted delay in play back of the following events. The second type of System Exclusive Events solve this problem by allowing a large amount of System Exclusive data to be divided into smaller blocks, transmitted with a delay between each division to allow the transmission of other MIDI events in order to prevent congesting of the limited MIDI bandwidth. The initial Divided System Exclusive Event follows the same format as a Normal System Exclusive Event with the exception that the last data byte is not 0xF7. This indicates the the System Exclusive data is not finished and will be continued in an upcoming Divided System Exclusive Event. Any following Divided System Exclusive Events before the final one use the a similar format as the first, only the start byte is 0xF7 instead of 0xF0 to signal continuation of System Exclusive data. The final block follows the same format as the continuation blocks, except the last data byte is 0xF7 to signal the completion of the divided System Exclusive data.
Authorization System Exclusive Events
The last type of System Exclusive Event authorizes and enables the transmission of special messages such as Song Position Pointer, MIDI Time Code and Song Select messages. These System Exclusive Events use the event type value 0xF7.
System Real-Time Messages
Hex | Binary | Data | Description |
---|---|---|---|
F8 | 11111000 | Timing clock used when synchronization is required. Sent 24 times per quarter note when synchronization is required (see text). | |
F9 | 11111001 | Undefined. | |
FA | 11111010 | Start the current sequence playing. (This message will be followed with Timing Clocks). | |
FB | 11111011 | Continue at the point the sequence was stopped. | |
FC | 11111100 | Stop the current sequence. | |
FD | 11111101 | Undefined. | |
FE | 11111110 | Active Sensing. Use of this message is optional. When initially sent, the receiver will expect to receive another Active Sensing message each 300ms (max), or it will be assume that the connection has been terminated. At termination, the receiver will turn off all voices and return to normal (non-active sensing) operation. | |
FF | 11111111 | Reset. In terms of MIDI devices, this command is to reset all receivers in the system to power-up status. This should be used sparingly, preferably under manual control. In particular, it should not be sent on power-up. The MIDI file format redefines this command for meta-events as described above. |
Controller Codes
This table lists the controller codes used in the controller setting change command above.
Hex | Decimal | Description | ||
---|---|---|---|---|
00 | 0 | Bank Select (Controller # 32 more commonly used) | 0-127 | MSB |
01 | 1 | Modulation Wheel | 0-127 | MSB |
02 | 2 | Breath Controller | 0-127 | MSB |
03 | 3 | Continuous Controller #3 | 0-127 | MSB |
04 | 4 | Foot Controller | 0-127 | MSB |
05 | 5 | Portamento Time | 0-127 | MSB |
06 | 6 | Data Entry MSB | 0-127 | MSB |
07 | 7 | Main Volume | 0-127 | MSB |
08 | 8 | Balance | 0-127 | MSB |
09 | 9 | Continuous controller #9 | 0-127 | MSB |
0A | 10 | Pan | 0-127 | MSB |
0B | 11 | Expression Controller | 0-127 | MSB |
0C | 12 | Effect Control 1 | 0-127 | MSB |
0D | 13 | Effect Control 2 | 0-127 | MSB |
0E | 14 | Continuous controller #14 | 0-127 | MSB |
0F | 15 | Continuous controller #15 | 0-127 | MSB |
10 | 16 | General Purpose Controllers (No. 1) | 0-127 | MSB |
11 | 17 | General Purpose Controllers (No. 2) | 0-127 | MSB |
12 | 18 | General Purpose Controllers (No. 3) | 0-127 | MSB |
13 | 19 | General Purpose Controllers (No. 4) | 0-127 | MSB |
14 | 20 | Continuous controller #20 | 0-127 | MSB |
15 | 21 | Continuous controller #21 | 0-127 | MSB |
16 | 22 | Continuous controller #22 | 0-127 | MSB |
17 | 23 | Continuous controller #23 | 0-127 | MSB |
18 | 24 | Continuous controller #24 | 0-127 | MSB |
19 | 25 | Continuous controller #25 | 0-127 | MSB |
1A | 26 | Continuous controller #26 | 0-127 | MSB |
1B | 27 | Continuous controller #27 | 0-127 | MSB |
1C | 28 | Continuous controller #28 | 0-127 | MSB |
1D | 29 | Continuous controller #29 | 0-127 | MSB |
1E | 30 | Continuous controller #30 | 0-127 | MSB |
1F | 31 | Continuous controller #31 | 0-127 | MSB |
20 | 32 | Bank Select | 0-127 | LSB |
21 | 33 | Modulation Wheel | 0-127 | LSB |
22 | 34 | Breath Controller | 0-127 | LSB |
23 | 35 | Continuous controller #3 | 0-127 | LSB |
24 | 36 | Foot Controller | 0-127 | LSB |
25 | 37 | Portamento Time | 0-127 | LSB |
26 | 38 | Data Entry LSB | 0-127 | LSB |
27 | 39 | Main Volume | 0-127 | LSB |
28 | 40 | Balance | 0-127 | LSB |
29 | 41 | Continuous controller #9 | 0-127 | LSB |
2A | 42 | Pan | 0-127 | LSB |
2B | 43 | Expression Controller | 0-127 | LSB |
2C | 44 | Effect Control 1 | 0-127 | LSB |
2D | 45 | Effect Control 2 | 0-127 | LSB |
2E | 46 | Continuous controller #14 | 0-127 | LSB |
2F | 47 | Continuous controller #15 | 0-127 | LSB |
30 | 48 | General Purpose Controllers (No. 1) | 0-127 | LSB |
31 | 49 | General Purpose Controllers (No. 2) | 0-127 | LSB |
32 | 50 | General Purpose Controllers (No. 3) | 0-127 | LSB |
33 | 51 | General Purpose Controllers (No. 4) | 0-127 | LSB |
34 | 52 | Continuous controller #20 | 0-127 | LSB |
35 | 53 | Continuous controller #21 | 0-127 | LSB |
36 | 54 | Continuous controller #22 | 0-127 | LSB |
37 | 55 | Continuous controller #23 | 0-127 | LSB |
38 | 56 | Continuous controller #24 | 0-127 | LSB |
39 | 57 | Continuous controller #25 | 0-127 | LSB |
3A | 58 | Continuous controller #26 | 0-127 | LSB |
3B | 59 | Continuous controller #27 | 0-127 | LSB |
3C | 60 | Continuous controller #28 | 0-127 | LSB |
3D | 61 | Continuous controller #29 | 0-127 | LSB |
3E | 62 | Continuous controller #30 | 0-127 | LSB |
3F | 63 | Continuous controller #31 | 0-127 | LSB |
40 | 64 | Damper pedal on/off (Sustain) | 0=off | 127=on |
41 | 65 | Portamento on/off | 0=off | 127=on |
42 | 66 | Sustenuto on/off | 0=off | 127=on |
43 | 67 | Soft Pedal on/off | 0=off | 127=on |
44 | 68 | Legato Footswitch on/off | 0=off | 127=on |
45 | 69 | Hold 2 on/off | 0=off | 127=on |
46 | 70 | Sound Controller 1 (default: Sound Variation) on/off | 0=off | 127=on |
47 | 71 | Sound Controller 2 (default: Timbre/Harmonic Content) on/off | 0=off | 127=on |
48 | 72 | Sound Controller 3 (default: Release Time) on/off | 0=off | 127=on |
49 | 73 | Sound Controller 4 (default: Attack Time) on/off | 0=off | 127=on |
4A | 74 | Sound Controller 5 (default: Brightness) on/off | 0=off | 127=on |
4B | 75 | Sound Controller 6 (no defaults) on/off | 0=off | 127=on |
4C | 76 | Sound Controller 7 (no defaults) on/off | 0=off | 127=on |
4D | 77 | Sound Controller 8 (no defaults) on/off | 0=off | 127=on |
4E | 78 | Sound Controller 9 (no defaults) on/off | 0=off | 127=on |
4F | 79 | Sound Controller 10 (no defaults) on/off | 0=off | 127=on |
50 | 80 | General Purpose Controllers (No. 5) on/off | 0=off | 127=on |
51 | 81 | General Purpose Controllers (No. 6) on/off | 0=off | 127=on |
52 | 82 | General Purpose Controllers (No. 7) on/off | 0=off | 127=on |
53 | 83 | General Purpose Controllers (No. 8) on/off | 0=off | 127=on |
54 | 84 | Portamento Control on/off | 0=off | 127=on |
55 | 85 | Undefined on/off | 0=off | 127=on |
56 | 86 | Undefined on/off | 0=off | 127=on |
57 | 87 | Undefined on/off | 0=off | 127=on |
58 | 88 | Undefined on/off | 0=off | 127=on |
59 | 89 | Undefined on/off | 0=off | 127=on |
5A | 90 | Undefined on/off | 0=off | 127=on |
5B | 91 | Effects 1 Depth (previously External Effects Depth) on/off | 0=off | 127=on |
5C | 92 | Effects 2 Depth (previously Tremolo Depth) on/off | 0=off | 127=on |
5D | 93 | Effects 3 Depth (previously Chorus Depth) on/off | 0=off | 127=on |
5E | 94 | Effects 4 Depth (previously Celeste Detune Depth) on/off | 0=off | 127=on |
5F | 95 | Effects 5 Depth (previously Phaser Depth) on/off | 0=off | 127=on |
60 | 96 | Data Entry Increment (+1) | 127 | |
61 | 97 | Data Entry Decrement (-1) | 127 | |
62 | 98 | Non-Registered Parameter Number LSB | ? | |
63 | 99 | Non-Registered Parameter Number MSB | ? | |
64 | 100 | Registered Parameter Number LSB | ? | |
65 | 101 | Registered Parameter Number MSB | ? | |
66 | 102 | Undefined | ? | |
67 | 103 | Undefined | ? | |
68 | 104 | Undefined | ? | |
69 | 105 | Undefined | ? | |
6A | 106 | Undefined | ? | |
6B | 107 | Undefined | ? | |
6C | 108 | Undefined | ? | |
6D | 109 | Undefined | ? | |
6E | 110 | Undefined | ? | |
6F | 111 | Undefined | ? | |
70 | 112 | Undefined | ? | |
71 | 113 | Undefined | ? | |
72 | 114 | Undefined | ? | |
73 | 115 | Undefined | ? | |
74 | 116 | Undefined | ? | |
75 | 117 | Undefined | ? | |
76 | 118 | Undefined | ? | |
77 | 119 | Undefined | ? | |
78 | 120 | Undefined | ? | |
79 | 121 | Reset All Controllers | ? | |
7A | 122 | Local Control on/off | 0=off | 127=on |
7B | 123 | All Notes Off (!!) | 0 | |
7C | 124 | Omni Mode Off (includes all notes off) | 0 | |
7D | 125 | Omni mode On (includes all notes off) | 0 | |
7E | 126 | Mono On (Poly Off)(includes all notes off) | * | |
7F | 127 | Poly On (Mono Off)(includes all notes off) | 0 |
*Note: This equals the number of channels, or zero if the number of channels equals the number of voices in the receiver.
Note Index
The following table lists the numbers corresponding to notes for use in note on and note off commands.
Octave | Notes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
0 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
1 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
2 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
3 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
4 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
5 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
6 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
7 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
8 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 |
9 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
10 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
General MIDI Instrument Patch Map
The heart of General MIDI (GM) is the Instrument Patch Map This is a list of 128 sounds, with corresponding MIDI program numbers. Most of these are imitative sounds, though the list includes synth sounds, ethnic instruments and a handful of sound effects.
The sounds fall roughly into sixteen families of eight variations each. Grouping sounds makes it easy to re-orchestrate a piece using similar sounds. The instrument map isn't the final word on musical instruments of the world, but it's pretty complete.
Prog# | Instrument | Prog# | Instrument |
---|---|---|---|
(0-7 Piano) | (8-15 Chrome Percussion) | ||
0 | Acoustic Grand | 8 | Celesta |
1 | Bright Acoustic | 9 | Glockenspiel |
2 | Electric Grand | 10 | Music Box |
3 | Honky-Tonk | 11 | Vibraphone |
4 | Electric Piano 1 | 12 | Marimba |
5 | Electric Piano 2 | 13 | Xylophone |
6 | Harpsichord | 14 | Tubular Bells |
7 | Clav | 15 | Dulcimer |
(16-23 Organ) | (24-31 Guitar) | ||
16 | Drawbar Organ | 24 | Acoustic Guitar(nylon) |
17 | Percussive Organ | 25 | Acoustic Guitar(steel) |
18 | Rock Organ | 26 | Electric Guitar(jazz) |
19 | Church Organ | 27 | Electric Guitar(clean) |
20 | Reed Organ | 28 | Electric Guitar(muted) |
21 | Accoridan | 29 | Overdriven Guitar |
22 | Harmonica | 30 | Distortion Guitar |
23 | Tango Accordian | 31 | Guitar Harmonics |
(32-39 Bass) | (40-47 Strings) | ||
32 | Acoustic Bass | 40 | Violin |
33 | Electric Bass(finger) | 41 | Viola |
34 | Electric Bass(pick) | 42 | Cello |
35 | Fretless Bass | 43 | Contrabass |
36 | Slap Bass 1 | 44 | Tremolo Strings |
37 | Slap Bass 2 | 45 | Pizzicato Strings |
38 | Synth Bass 1 | 46 | Orchestral Strings |
39 | Synth Bass 2 | 47 | Timpani |
(48-55 Ensemble) | (56-63 Brass) | ||
48 | String Ensemble 1 | 56 | Trumpet |
49 | String Ensemble 2 | 57 | Trombone |
50 | SynthStrings 1 | 58 | Tuba |
51 | SynthStrings 2 | 59 | Muted Trumpet |
52 | Choir Aahs | 60 | French Horn |
53 | Voice Oohs | 61 | Brass Section |
54 | Synth Voice | 62 | SynthBrass 1 |
55 | Orchestra Hit | 63 | SynthBrass 2 |
(64-71 Reed) | (72-79 Pipe) | ||
64 | Soprano Sax | 72 | Piccolo |
65 | Alto Sax | 73 | Flute |
66 | Tenor Sax | 74 | Recorder |
67 | Baritone Sax | 75 | Pan Flute |
68 | Oboe | 76 | Blown Bottle |
69 | English Horn | 77 | Skakuhachi |
70 | Bassoon | 78 | Whistle |
71 | Clarinet | 79 | Ocarina |
(80-87 Synth Lead) | (88-95 Synth Pad) | ||
80 | Lead 1 (square) | 88 | Pad 1 (new age) |
81 | Lead 2 (sawtooth) | 89 | Pad 2 (warm) |
82 | Lead 3 (calliope) | 90 | Pad 3 (polysynth) |
83 | Lead 4 (chiff) | 91 | Pad 4 (choir) |
84 | Lead 5 (charang) | 92 | Pad 5 (bowed) |
85 | Lead 6 (voice) | 93 | Pad 6 (metallic) |
86 | Lead 7 (fifths) | 94 | Pad 7 (halo) |
87 | Lead 8 (bass+lead) | 95 | Pad 8 (sweep) |
(96-103 Synth Effects) | (104-110 Ethnic) | ||
96 | FX 1 (rain) | 104 | Sitar |
97 | FX 2 (soundtrack) | 105 | Banjo |
98 | FX 3 (crystal) | 106 | Shamisen |
99 | FX 4 (atmosphere) | 107 | Koto |
100 | FX 5 (brightness) | 108 | Kalimba |
101 | FX 6 (goblins) | 109 | Bagpipe |
102 | FX 7 (echoes) | 110 | Fiddle |
103 | FX 8 (sci-fi) | 111 | Shanai |
(112-119 Percussive) | (120-127 Sound Effects) | ||
112 | Tinkle Bell | 120 | Guitar Fret Noise |
113 | Agogo | 121 | Breath Noise |
114 | Steel Drums | 122 | Seashore |
115 | Woodblock | 123 | Bird Tweet |
116 | Taiko Drum | 124 | Telephone Ring |
117 | Melodic Tom | 125 | Helicopter |
118 | Synth Drum | 126 | Applause |
119 | Reverse Cymbal | 127 | Gunshot |
General MIDI Percussion Key Map
General MIDI also includes a Percusssion Key Map. This mapping derives from the Roland/Sequential mapping used on early drum machines. As with the Instrument Map, it doesn't cover every percussive instrument in the world, but it's more than adequate as a basic set.
To avoid concerns with channels, GM restricts percussion to MIDI Channel 9. Theoretically, the lower nine channels (0 - 8) are for the instruments, but the GM spec states that a sound module must respond to all sixteen MIDI channels, with dynamic voice allocation and a minimum of 24 voices.
MIDI key | Drum Sound | MIDI key | Drum Sound |
---|---|---|---|
35 | Acoustic Bass Drum | 59 | Ride Cymbal 2 |
36 | Bass Drum 1 | 60 | Hi Bongo |
37 | Side Stick | 61 | Low Bongo |
38 | Acoustic Snare | 62 | Mute Hi Conga |
39 | Hand Clap | 63 | Open Hi Conga |
40 | Electric Snare | 64 | Low Conga |
41 | Low Floor Tom | 65 | High Timbale |
42 | Closed Hi-Hat | 66 | Low Timbale |
43 | High Floor Tom | 67 | High Agogo |
44 | Pedal Hi-Hat | 68 | Low Agogo |
45 | Low Tom | 69 | Cabasa |
46 | Open Hi-Hat | 70 | Maracas |
47 | Low-Mid Tom | 71 | Short Whistle |
48 | Hi-Mid Tom | 72 | Long Whistle |
49 | Crash Cymbal 1 | 73 | Short Guiro |
50 | High Tom | 74 | Long Guiro |
51 | Ride Cymbal 1 | 75 | Claves |
52 | Chinese Cymbal | 76 | Hi Wood Block |
53 | Ride Bell | 77 | Low Wood Block |
54 | Tambourine | 78 | Mute Cuica |
55 | Splash Cymbal | 79 | Open Cuica |
56 | Cowbell | 80 | Mute Triangle |
57 | Crash Cymbal 2 | 81 | Open Triangle |
58 | Vibraslap |
Sources
- "Standard MIDI File Format" - Dustin Caldwell
- "The USENET MIDI Primer" - Bob McQueer