Microsoft DirectX 8.1 (Visual Basic) |
A channel message is addressed to a particular MIDI channel, which corresponds to a single part in the music.
A channel message can be either a mode message or a voice message.
A mode message determines how a channel will deal with subsequent voice messages. For example, a mode message might instruct the channel to remain silent, ignoring all note-on messages until further notice.
Most channel messages are voice messages. They instruct the channel to begin or stop playing a note or to modify the note in some way, or they change the timbre by assigning a different MIDI patch number to the channel.
The following table describes types of voice messages.
Voice message | Purpose |
Note-on | Play a note. |
Note-off | Stop playing the note. |
Control change | Modify the tone with data from a pedal, lever, or other device; also used for miscellaneous controls such as volume and |
Program (patch) change | Select an instrument for the channel by assigning a patch number. |
Aftertouch | Modify an individual note, or all notes on the channel, according to the aftertouch of a key. |
Pitch bend change | Modify the pitch of all notes played on the channel. |
Keep in mind that these descriptions apply to standard MIDI messages, not MIDI data that has been converted to performance message format. For example, two MIDI messages to start and stop a note are combined by DirectMusic into a single performance message giving the duration of the note. DirectMusic messages also contain much additional information about timing and routing.
The data bytes of a note-on message represent the pitch and
For information on how DirectMusic converts to and from MIDI notes, see Music Values and MIDI Notes.
Program changes and patch numbers are a key concept in MIDI playback and in DirectMusic. A program change assigns a particular instrument (also called a program or timbre) to a channel so that the notes sent to that channel are played with the appropriate sound. Instruments are identified by patch numbers. If the GM instrument set is loaded, a program change specifying patch number 1 always causes the channel to play its notes as an acoustic grand piano. The actual sound produced at the speakers depends on how the instrument is synthesized.
Because a single data byte is used to select the patch number in a program change, and only 7 bits in each data byte of a MIDI message are significant, a program change can select from a maximum of 128 instruments. To provide a greater choice, the MIDI specification allows for the use of up to 16,384 instrument banks, each containing up to 128 instruments.
To select an instrument from a different bank, the MIDI sequencer must first send a control change message called bank select. The 2 data bytes of this message are referred to as the most significant byte (MSB) and least significant byte (LSB), and they are combined to identify a bank. Once the bank has been selected, each subsequent program change selects an instrument from that bank.
This topic pertains only to applications written in C++. DirectX for Visual Basic does not enable applications to change patch numbers except by using the DirectMusicPerformance8.SendPatchPMSG method.