Both sides previous revisionPrevious revisionNext revision | Previous revision |
midi_file_format [2011/10/15 21:50] – javapimp | midi_file_format [2023/08/18 18:15] (current) – external edit 127.0.0.1 |
---|
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 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 spacify the delta-time in frames per second. For ticks per beat, common values range from 48 to 960. | 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. | 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. |
| |
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. | 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. | 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. | 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. |
| |
==== MIDI Event Commands ==== | +--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. | 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 ^ | ^ 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 | | | ''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 | | | ''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 | | | ''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 | | | ''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 | | | ''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 | | | ''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 | | | ''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. | |
| |
The following table lists the numbers corresponding to notes for use in note on and note off commands. | === Channel Mode Messages === |
| |
^ Octave ^ Notes |||||||||||^ | ^ Hex ^ Binary ^ Data ^ Description ^ |
| | C | C# | D | D# | E | F | F# | G | G# | A | A# | B | | | ''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 Off\\ ''cc'' = 122, ''vv'' = 127: Local Control On\\ \\ **All 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 Off\\ ''cc'' = 125, ''vv'' = 0: Omni Mode On\\ ''cc'' = 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) | |
| 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 | | |
| |
==== Meta-Events ==== | ==== Meta-Events ==== |
| ''07'' | ''00000111'' | ''nn tt ...'' | Cue point. Marks the start of some type of new sound or action.\\ \\ ''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. | | | ''20'' | ''00100000'' | ''??'' | MIDI channel prefix assignment. | |
| ''21'' | ''00100001'' | ''pp'' | Has been used, though unofficially, for a MIDI port or cable number. (deprecated) | | | ''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. | | | ''2F'' | ''00101111'' | ''00'' | End of Track. This event must come at the end of each track. | |
| ''51'' | ''01010001'' | ''03 tttttt'' | Set tempo\\ \\ ''tttttt'' = microseconds/quarter note.\\ \\ MICROSECONDS_PER_MINUTE = 60000000\\ \\ BPM = MICROSECONDS_PER_MINUTE / MPQN\\ MPQN = MICROSECONDS_PER_MINUTE / BPM | | | ''51'' | ''01010001'' | ''03 tttttt'' | Set tempo\\ \\ ''tttttt'' = 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. | | | ''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 Signature\\ \\ ''nn'' = numerator of time sig. \\ ''dd'' = denominator of time sig. 2 = quarter 3 = eighth, etc.\\ ''cc'' = number of ticks in metronome click \\ ''bb'' = number of 32nd notes to the quarter note | | | ''58'' | ''01011000'' | ''04 nn dd cc bb'' | Time Signature\\ \\ ''nn'' = 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 note\\ \\ MIDI 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 signature\\ \\ ''sf'' = sharps/flats (-7 = 7 flats, 0 = key of C, 7 = 7 sharps).\\ ''mi'' = major/minor (0 = major, 1 = minor) | | | ''59'' | ''01011001'' | ''02 sf mi'' | Key signature\\ \\ ''sf'' = 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 information\\ \\ ''xx'' = number of bytes to be sent.\\ ''dd'' = data | | | ''7F'' | ''01111111'' | ''xx dd ...'' | Sequencer specific information\\ \\ ''xx'' = number of bytes to be sent.\\ ''dd'' = data | |
| |
===== Channel Mode Messages ===== | <code> |
| bpm = beats per minute. |
^ Hex ^ Binary ^ Data ^ Description ^ | 60000000 / bpm = tt tt tt. |
| ''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 Off\\ ''cc'' = 122, ''vv'' = 127: Local Control On\\ \\ **All 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 Off\\ ''cc'' = 125, ''vv'' = 0: Omni Mode On\\ ''cc'' = 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) | | |
| 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. |
| </code> |
| |
===== System Messages ===== | ===== System Messages ===== |
| |
The following table lists system messages which control the entire system. These have no midi channel number. (these will generally only apply to controlling a midi keyboard, etc.) | 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 ==== | ==== System Common Messages ==== |
| ''F7'' | ''11110111'' | | End of Exclusive. Used to terminate a System Exclusive dump (see above). | | | ''F7'' | ''11110111'' | | End of Exclusive. Used to terminate a System Exclusive dump (see above). | |
| |
=== Divided System Exclusive Events === | ==== 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. | 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 === | ==== 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. | 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. |
| ''FD'' | ''11111101'' | | Undefined. | | | ''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. | | | ''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. 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. | | | ''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 ===== | ===== Controller Codes ===== |
| |
| This table lists the controller codes used in the controller setting change command above. |
| |
^ Hex ^ Decimal ^ Description ^ ^ ^ | ^ Hex ^ Decimal ^ Description ^ ^ ^ |
| ''65'' | ''101'' | Registered Parameter Number MSB | ? || | | ''65'' | ''101'' | Registered Parameter Number MSB | ? || |
| ''66'' | ''102'' | Undefined | ? || | | ''66'' | ''102'' | Undefined | ? || |
| ''67'' | ''103'' | Undefined | ? || | |
| ''67'' | ''103'' | Undefined | ? || | |
| ''67'' | ''103'' | Undefined | ? || | |
| ''67'' | ''103'' | Undefined | ? || | |
| ''67'' | ''103'' | Undefined | ? || | | ''67'' | ''103'' | Undefined | ? || |
| ''68'' | ''104'' | Undefined | ? || | | ''68'' | ''104'' | Undefined | ? || |
| |
*Note: This equals the number of channels, or zero if the number of channels equals the number of voices in the receiver. | *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 ===== | ===== General MIDI Instrument Patch Map ===== |
| |
^ Prog# ^ Instrument ^ Prog# ^ Instrument ^ | ^ Prog# ^ Instrument ^ Prog# ^ Instrument ^ |
^ (1-8 Piano) |^ (9-16 Chrome Percussion) |^ | ^ (0-7 Piano) |^ (8-15 Chrome Percussion) |^ |
| 1 | Acoustic Grand | 9 | Celesta | | | 0 | Acoustic Grand | 8 | Celesta | |
| 2 | Bright Acoustic | 10 | Glockenspiel | | | 1 | Bright Acoustic | 9 | Glockenspiel | |
| 3 | Electric Grand | 11 | Music Box | | | 2 | Electric Grand | 10 | Music Box | |
| 4 | Honky-Tonk | 12 | Vibraphone | | | 3 | Honky-Tonk | 11 | Vibraphone | |
| 5 | Electric Piano 1 | 13 | Marimba | | | 4 | Electric Piano 1 | 12 | Marimba | |
| 6 | Electric Piano 2 | 14 | Xylophone | | | 5 | Electric Piano 2 | 13 | Xylophone | |
| 7 | Harpsichord | 15 | Tubular Bells | | | 6 | Harpsichord | 14 | Tubular Bells | |
| 8 | Clav | 16 | Dulcimer | | | 7 | Clav | 15 | Dulcimer | |
^ (17-24 Organ) |^ (25-32 Guitar) |^ | ^ (16-23 Organ) |^ (24-31 Guitar) |^ |
| 17 | Drawbar Organ | 25 | Acoustic Guitar(nylon) | | | 16 | Drawbar Organ | 24 | Acoustic Guitar(nylon) | |
| 18 | Percussive Organ | 26 | Acoustic Guitar(steel) | | | 17 | Percussive Organ | 25 | Acoustic Guitar(steel) | |
| 19 | Rock Organ | 27 | Electric Guitar(jazz) | | | 18 | Rock Organ | 26 | Electric Guitar(jazz) | |
| 20 | Church Organ | 28 | Electric Guitar(clean) | | | 19 | Church Organ | 27 | Electric Guitar(clean) | |
| 21 | Reed Organ | 29 | Electric Guitar(muted) | | | 20 | Reed Organ | 28 | Electric Guitar(muted) | |
| 22 | Accoridan | 30 | Overdriven Guitar | | | 21 | Accoridan | 29 | Overdriven Guitar | |
| 23 | Harmonica | 31 | Distortion Guitar | | | 22 | Harmonica | 30 | Distortion Guitar | |
| 24 | Tango Accordian | 32 | Guitar Harmonics | | | 23 | Tango Accordian | 31 | Guitar Harmonics | |
^ (33-40 Bass) |^ (41-48 Strings) |^ | ^ (32-39 Bass) |^ (40-47 Strings) |^ |
| 33 | Acoustic Bass | 41 | Violin | | | 32 | Acoustic Bass | 40 | Violin | |
| 34 | Electric Bass(finger) | 42 | Viola | | | 33 | Electric Bass(finger) | 41 | Viola | |
| 35 | Electric Bass(pick) | 43 | Cello | | | 34 | Electric Bass(pick) | 42 | Cello | |
| 36 | Fretless Bass | 44 | Contrabass | | | 35 | Fretless Bass | 43 | Contrabass | |
| 37 | Slap Bass 1 | 45 | Tremolo Strings | | | 36 | Slap Bass 1 | 44 | Tremolo Strings | |
| 38 | Slap Bass 2 | 46 | Pizzicato Strings | | | 37 | Slap Bass 2 | 45 | Pizzicato Strings | |
| 39 | Synth Bass 1 | 47 | Orchestral Strings | | | 38 | Synth Bass 1 | 46 | Orchestral Strings | |
| 40 | Synth Bass 2 | 48 | Timpani | | | 39 | Synth Bass 2 | 47 | Timpani | |
^ (49-56 Ensemble) |^ (57-64 Brass) |^ | ^ (48-55 Ensemble) |^ (56-63 Brass) |^ |
| 49 | String Ensemble 1 | 57 | Trumpet | | | 48 | String Ensemble 1 | 56 | Trumpet | |
| 50 | String Ensemble 2 | 58 | Trombone | | | 49 | String Ensemble 2 | 57 | Trombone | |
| 51 | SynthStrings 1 | 59 | Tuba | | | 50 | SynthStrings 1 | 58 | Tuba | |
| 52 | SynthStrings 2 | 60 | Muted Trumpet | | | 51 | SynthStrings 2 | 59 | Muted Trumpet | |
| 53 | Choir Aahs | 61 | French Horn | | | 52 | Choir Aahs | 60 | French Horn | |
| 54 | Voice Oohs | 62 | Brass Section | | | 53 | Voice Oohs | 61 | Brass Section | |
| 55 | Synth Voice | 63 | SynthBrass 1 | | | 54 | Synth Voice | 62 | SynthBrass 1 | |
| 56 | Orchestra Hit | 64 | SynthBrass 2 | | | 55 | Orchestra Hit | 63 | SynthBrass 2 | |
^ (65-72 Reed) |^ (73-80 Pipe) |^ | ^ (64-71 Reed) |^ (72-79 Pipe) |^ |
| 65 | Soprano Sax | 73 | Piccolo | | | 64 | Soprano Sax | 72 | Piccolo | |
| 66 | Alto Sax | 74 | Flute | | | 65 | Alto Sax | 73 | Flute | |
| 67 | Tenor Sax | 75 | Recorder | | | 66 | Tenor Sax | 74 | Recorder | |
| 68 | Baritone Sax | 76 | Pan Flute | | | 67 | Baritone Sax | 75 | Pan Flute | |
| 69 | Oboe | 77 | Blown Bottle | | | 68 | Oboe | 76 | Blown Bottle | |
| 70 | English Horn | 78 | Skakuhachi | | | 69 | English Horn | 77 | Skakuhachi | |
| 71 | Bassoon | 79 | Whistle | | | 70 | Bassoon | 78 | Whistle | |
| 72 | Clarinet | 80 | Ocarina | | | 71 | Clarinet | 79 | Ocarina | |
^ (81-88 Synth Lead) |^ (89-96 Synth Pad) |^ | ^ (80-87 Synth Lead) |^ (88-95 Synth Pad) |^ |
| 81 | Lead 1 (square) | 89 | Pad 1 (new age) | | | 80 | Lead 1 (square) | 88 | Pad 1 (new age) | |
| 82 | Lead 2 (sawtooth) | 90 | Pad 2 (warm) | | | 81 | Lead 2 (sawtooth) | 89 | Pad 2 (warm) | |
| 83 | Lead 3 (calliope) | 91 | Pad 3 (polysynth) | | | 82 | Lead 3 (calliope) | 90 | Pad 3 (polysynth) | |
| 84 | Lead 4 (chiff) | 92 | Pad 4 (choir) | | | 83 | Lead 4 (chiff) | 91 | Pad 4 (choir) | |
| 85 | Lead 5 (charang) | 93 | Pad 5 (bowed) | | | 84 | Lead 5 (charang) | 92 | Pad 5 (bowed) | |
| 86 | Lead 6 (voice) | 94 | Pad 6 (metallic) | | | 85 | Lead 6 (voice) | 93 | Pad 6 (metallic) | |
| 87 | Lead 7 (fifths) | 95 | Pad 7 (halo) | | | 86 | Lead 7 (fifths) | 94 | Pad 7 (halo) | |
| 88 | Lead 8 (bass+lead) | 96 | Pad 8 (sweep) | | | 87 | Lead 8 (bass+lead) | 95 | Pad 8 (sweep) | |
^ (97-104 Synth Effects) |^ (105-112 Ethnic) |^ | ^ (96-103 Synth Effects) |^ (104-110 Ethnic) |^ |
| 97 | FX 1 (rain) | 105 | Sitar | | | 96 | FX 1 (rain) | 104 | Sitar | |
| 98 | FX 2 (soundtrack) | 106 | Banjo | | | 97 | FX 2 (soundtrack) | 105 | Banjo | |
| 99 | FX 3 (crystal) | 107 | Shamisen | | | 98 | FX 3 (crystal) | 106 | Shamisen | |
| 100 | FX 4 (atmosphere) | 108 | Koto | | | 99 | FX 4 (atmosphere) | 107 | Koto | |
| 101 | FX 5 (brightness) | 109 | Kalimba | | | 100 | FX 5 (brightness) | 108 | Kalimba | |
| 102 | FX 6 (goblins) | 110 | Bagpipe | | | 101 | FX 6 (goblins) | 109 | Bagpipe | |
| 103 | FX 7 (echoes) | 111 | Fiddle | | | 102 | FX 7 (echoes) | 110 | Fiddle | |
| 104 | FX 8 (sci-fi) | 112 | Shanai | | | 103 | FX 8 (sci-fi) | 111 | Shanai | |
^ (113-120 Percussive) |^ (121-128 Sound Effects) |^ | ^ (112-119 Percussive) |^ (120-127 Sound Effects) |^ |
| 113 | Tinkle Bell | 121 | Guitar Fret Noise | | | 112 | Tinkle Bell | 120 | Guitar Fret Noise | |
| 114 | Agogo | 122 | Breath Noise | | | 113 | Agogo | 121 | Breath Noise | |
| 115 | Steel Drums | 123 | Seashore | | | 114 | Steel Drums | 122 | Seashore | |
| 116 | Woodblock | 124 | Bird Tweet | | | 115 | Woodblock | 123 | Bird Tweet | |
| 117 | Taiko Drum | 125 | Telephone Ring | | | 116 | Taiko Drum | 124 | Telephone Ring | |
| 118 | Melodic Tom | 126 | Helicopter | | | 117 | Melodic Tom | 125 | Helicopter | |
| 119 | Synth Drum | 127 | Applause | | | 118 | Synth Drum | 126 | Applause | |
| 120 | Reverse Cymbal | 128 | Gunshot | | | 119 | Reverse Cymbal | 127 | Gunshot | |
| |
===== General MIDI Percussion Key Map ===== | ===== 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. | 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 10. Theoretically, the lower nine channels 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. | 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 ^ | ^ MIDI key ^ Drum Sound ^ MIDI key ^ Drum Sound ^ |
* "[[Standard MIDI File Format]]" - Dustin Caldwell | * "[[Standard MIDI File Format]]" - Dustin Caldwell |
* "[[http://www.sonicspot.com/guide/midifiles.html|MIDI File Format]]" | * "[[http://www.sonicspot.com/guide/midifiles.html|MIDI File Format]]" |
| * "[[http://home.roadrunner.com/~jgglatt/|MIDI Technical Fanatic's Brainwashing Center]]" |
* "[[The USENET MIDI Primer]]" - Bob McQueer | * "[[The USENET MIDI Primer]]" - Bob McQueer |
| |
| ===== More Information ===== |
| |
| * [[http://www.amazon.com/gp/product/0240807987/ref=as_li_ss_tl?ie=UTF8&tag=fourwood-20&linkCode=as2&camp=217145&creative=399369&creativeASIN=0240807987|The MIDI Manual, Third Edition: A Practical Guide to MIDI in the Project Studio]] |
| * [[http://www.amazon.com/gp/product/1598630849/ref=as_li_ss_tl?ie=UTF8&tag=fourwood-20&linkCode=as2&camp=217145&creative=399369&creativeASIN=1598630849|MIDI Power!: The Comprehensive Guide]] |
| * [[http://www.amazon.com/gp/product/1584502452/ref=as_li_ss_tl?ie=UTF8&tag=fourwood-20&linkCode=as2&camp=217145&creative=399369&creativeASIN=1584502452|Game Audio Programming (Charles River Media Game Development)]] |
| * [[http://www.amazon.com/gp/product/1244615293/ref=as_li_ss_tl?ie=UTF8&tag=fourwood-20&linkCode=as2&camp=217145&creative=399373&creativeASIN=1244615293|Video Game Music File Formats, including: Xm (file Format), Mod (file Format), Module File, S3m (file Format), Midi Timecode, General Midi, Yamaha Xg, ... Audio Midi Setup, General Midi Level 2]] |
| |
| |
| |