LIST 26 ============================================================================ MIDI DATA FORMAT For standard MIDI messages, there is a clear concept that one device is a "transmitter" or "master", and the other a "receiver" or "slave". Messages take the form of "status" bytes, followed by data bytes. Status bytes are marked by bit 7 being 1. All data bytes must contain a 0 in bit 7, and thus lie in the range 0 - 127. MIDI has a logical channel concept. There are 16 logical channels, encoded into bits 0 - 3 of the status bytes of messages for which a channel number is significant. status byte meaning data bytes 0x80-0x8f note off 2 - 1 byte pitch, followed by 1 byte velocity 0x90-0x9f note on 2 - 1 byte pitch, followed by 1 byte velocity 0xa0-0xaf key pressure 2 - 1 byte pitch, 1 byte pressure (after-touch) 0xb0-0xbf parameter 2 - 1 byte parameter number, 1 byte setting 0xc0-0xcf program 1 byte program selected 0xd0-0xdf chan. pressure 1 byte channel pressure (after-touch) 0xe0-0xef pitch wheel 2 bytes gives a 14 bit value, least significant 7 bits first For all of these messages, a convention called the "running status byte" 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. Also, a "note on" message with a velocity of zero is to be synonymous with a "note off". Combined with the previous feature, this is intended to allow long strings of notes to be sent without repeating status bytes. The pitch bytes of notes are simply number of half-steps, with middle C = 60. ------------------------------------------------------------------------------ Octave|| Note Numbers || 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 | ------------------------------------------------------------------------------ ------------------------------------------------------------------------- Status Data Byte(s) Description D7----D0 D7----D0 ------------------------------------------------------------------------- 1000cccc 0nnnnnnn Note Off event. 0vvvvvvv This message is sent when a note is released (ended). (nnnnnnn) is the note number. (vvvvvvv) is the velocity. 1001cccc 0nnnnnnn Note On event. 0vvvvvvv This message is sent when a note is depressed (start). (nnnnnnn) is the note number. (vvvvvvv) is the velocity. 1010cccc 0nnnnnnn Polyphonic Key Pressure (After-touch). 0vvvvvvv This message is sent when the pressure (velocity) of a previously triggered note changes. (nnnnnnn) is the note number. (vvvvvvv) is the new velocity. 1011cccc 0ccccccc Control Change. 0vvvvvvv 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. (ccccccc) is the controller number. (vvvvvvv) is the new value. 1100cccc 0ppppppp Program Change. This message sent when the patch number changes. (ppppppp) is the new program number. 1101nnnn 0ccccccc 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 (of all te current depressed keys). (ccccccc) is the channel pressure number. 1110nnnn 0lllllll Pitch Wheel Change. 0mmmmmmm 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. (llllll) are the least significant 7 bits. (mmmmmm) are the most significant 7 bits. ------------------------------------------------------------------------- ( from: lee@uhccux , eharnden@auvm 4/07/89 midi-intro lee@uhccux , eharnden@auvm 4/07/89 messages.table lee@uhccux , eharnden@auvm 4/07/89 status.table lee@uhccux , eharnden@auvm 4/07/89 notes.table ) ============================================================================