User Tools

Site Tools


midi_file_format

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
midi_file_format [2011/11/12 20:58] javapimpmidi_file_format [2023/08/18 18:15] (current) – external edit 127.0.0.1
Line 25: Line 25:
 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. 
Line 126: Line 126:
 | ''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/beat)\\ \\ MICROSECONDS_PER_MINUTE = 60000000\\ \\ BPM = MICROSECONDS_PER_MINUTE / MPQN\\ MPQN = MICROSECONDS_PER_MINUTE / BPM\\ \\ TODO: How does this relate to delta-time ticks per quarter note specified in the header chunk? |+| ''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 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. | | ''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. |
Line 424: Line 424:
 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     ^
midi_file_format.1321131484.txt.gz · Last modified: 2023/08/18 18:15 (external edit)