Programming
MIDI Programming
Most MIDI command strings consist of a status byte followed by one or two data bytes. The most notable exception to this is the System Exclusive which starts with a status byte of $F0, has 4 or more data bytes, then ends with a status byte of $F7. Status bytes are always $80 or greater. Status bytes are always denoted in hexadecimal. Data bytes are always less than $80 (128 in decimal). Data bytes may be denoted in either decimal or hexadecimal.
Program change, Control change, and Note On/Off are the most often used of the MIDI "Channel Voice" commands. Since they are standard MIDI commands they are almost never explained in manufacturers programming manuals. Program change (Preset), Control change, Note On/Off, and System Exclusive.
Programming examples
The following section provides some programming examples:
SEND_STRING MIDI,"$C0 + (MIDI_CHANNEL - 1), PROGRAM - 1"
Specific example, to recall preset 128 on MIDI ch 1: MIDI_CHANNEL = 1
1 - 1 = 0
$C0 + 0 = $C0,
PROGRAM = 128
128 - 1 = 127, thus the send string,
SEND_STRING MIDI,"$C0,127"
The Program change is denoted by status byte $C0 (for MIDI channel 1) through status byte $CF (for MIDI channel 16), followed by one data byte.
PRGM EX. 1
SEND_STRING MIDI,"$90 + (MIDI_CHANNEL - 1), Note, Velocity" (* Note On *) SEND_STRING MIDI,"$80 + (MIDI_CHANNEL - 1), Note, Velocity" (* Note Off *)
Note that On is denoted by status byte $90 (for MIDI channel 1) through status byte $9F (for MIDI channel 16), Note that Off is denoted by status byte $80 (for MIDI channel 1) through status byte $8F (for MIDI channel 16).
PRGM EX. 2
SEND_STRING MIDI,"$80 + (MIDI_CHANNEL - 1), Note, 0" | (* Note Off *) |
Most modern controllers send a $90 note on with velocity 0 for note off (We'll save the reason why for MIDI programming 102).
PRGM EX. 3
9 |
| |
|
|
|