Manual: MIDI Reference
Before the early 1980s, there was no common language or electronic message system that was shared between synthesizers. Then in 1982 a protocol was outlined to allow commands or other electronic messages to be used to control or read synthesizer data in more-or-less a universal format. It was dubbed the Musical Instrument Digital Interface or MIDI for short. MIDI transmissions are only electronic event messages rather than audio signals, and are designed to allow each synthesizer to produce and process audio in its own way, but be controlled using somewhat universal commands.
For example, you can play notes, bend their pitches, control panning positions, or sync timers between synthesizers of different makes and models, using a single set of commands understood by all devices. Because the electronic stream is data rather than audio waveforms, the files that contain these event messages are quite small, compared to other means of creating electronic music.
In the 1980s, MIDI allowed for digital composition to be done on computers or specialized electronic devices called sequencers. Sequencing used the MIDI language to make it easy to record and edit events that would control MIDI synthesizers, and even trigger it to play back the audio, which could be recorded to an audio medium. While file sizes are small and the commands can be understood by any MIDI-compatible device, the disadvantage is that the song will probably sound different on different synths, because each have their own means of producing sounds, especially among synthesizer companies.
This problem was somewhat addressed by the advent of General MIDI, or GM, which is simply a set of pre-defined preset instrument programs, that any sequencer file can call to produce a universal playback sound (though the actual instruments may still differ in timbre), no matter what synth is used. The GM standard not only assigned specific instruments to particular program numbers, it also mapped many MIDI controllers to important synthesis effects and set minimums for polyphony and number of channels. GM is still in use today, and even has been expanded into different formats like Roland’s GS and Yamaha’s XG, as well as the more recent GM2 specifications present in many newer synthesizers.
Many of the synthesizer parameters that can be manipulated are done so using MIDI messages that work in each channel, of which there are only 16. While the channels are limited to 16, one can send Program Change messages to call up different instruments. But this means that one synth can only play a maximum of 16 instruments at once (although each instrument can have more than one multisample assignments). But this instrument limitation is not the same as polyphony, which limits the number of notes or voices.
These MIDI channel messages are only a few bytes in length, which make for excellent translation speed between the event and the parameter control. In a normal playing of a note on a keyboard, here is an example of the messages that are and can be sent:
- When the user presses a note key, the Note On message is sent, which is a data package that contains the note (within a range of 0 to 127, the range of notes of the MIDI keyboard) and the key velocity, the strength that the note was struck. Some synthesizers may interpret this as note volume and some programs may control different parameters of the instrument based on velocity amount.
- If the user continues applying pressure to the synth keys while holding them (this is called aftertouch), the synth will send either aftertouch messages from each key (also called Poly Pressure) , or channel pressure messages, which applies the aftertouch to the whole keyboard.
- When the user releases the keys, a Note Off message is sent, which also contains the release velocity of each note, which is the strength of each key being released.
Not all synthesizers pass or understand all of these parameters; the only ones that are truly universal are the note values for Note On and Note Off messages. Furthermore, many synthesizers offer ways of affecting the instrument settings as they are being processed, such as Pitch Bend and Modulation wheels, joysticks, data sliders, knobs and buttons, foot controllers and pedals, breath controllers, and ribbon controllers. All of these send their own messages using their own controller numbers, which can sometimes be assigned by the user, depending on the synth model.
The data blocks commonly referred to as MIDI Messages are sent serially in one-way paths from one MIDI device’s “MIDI Out” connector to the other device’s “MIDI In” connector (“MIDI Thru” passes on the MIDI-In signal to another device). The messages are simple but specific, often taking the form of commands that not only control various synth settings like pitch, volume, key pressure, and filters, but also change programs or banks or toggle arpeggiations or on-board effects. Many of these messages have a universal scope of application, but not all do; each company can set its own use for the MIDI controller messages, and even different devices from the same company will use the same controller assignments to manipulate different parameters.
There are basically eight types if MIDI messages:
- Notes: MIDI has 128 notes represented, from C-1 to G9 (the equivalent of C-0 to G-10 in OpenMPT’s octave range, notes above B-9 are not available in OpenMPT), or 0 - 127. Using Western tuning this is the range from 8.176 Hz to 12,544 Hz. Sending a note value with velocity greater than 0 is considered a Note On message.
- Key Pressure: An aftertouch message is sent when notes that are on are being pressed with non-static pressure. Most keyboards still use Channel Pressure messages that apply aftertouch to the entire keyboard, while some more expensive keyboards send Poly Pressure (also called Polyphonic Aftertouch) messages from each pressed key (which require more sensors in the assembly). These two types of aftertouch are usually not found together in the same controller.
- Pitch Bend: In OpenMPT, this is called portamento and increases or decreases the pitch of the note smoothly in 64ths of a semitone (or by single semitones if a glissando setting is enabled), while pitch bends are defined to work in a given pitch wheel range in MIDI. These messages bend the synthesizer notes by up by a pre-defined amount of semitones up or down in one event. There is no standardized way of controlling the pitch bend range which all MIDI devices understand. In OpenMPT, you have to define the synth’s pitch bend range to properly utilize portamento effects with MIDI gear and instrument plugins.
- Control Change: For all other instrument parameters that can be manipulated, MIDI CC messages are assigned by the manufacturer to control certain settings. While there is a standardized set of controls, there is a certain amount of flexibility by each synth maker, so do not assume that a standard CC command will control a listed parameter. Read the synthesizer’s MIDI implementation table to find out which MIDI CCs it responds to.
- Program Change: These special messages call up another program (or patch) from the synthesizer’s current bank. Many synths also support a MIDI CC to changes banks. One bank may contain up to 128 patches.
- System: These are specialized messages such as MIDI clock ticks that stay in sync with the clocks of other MIDI devices, and Active Sense messages that keep the connection between inactive MIDI devices.
- System Exclusive (SysEx): These messages are usually non-MIDI data dumps or device settings that each manufacturer defines for its devices. This type of message is often used for transmitting entire patches or banks, e.g. for backup purposes. Some synths also use SysEx messages instead of MIDI CCs to update their parameters.
- Real-Time System Exclusive: These are the newer type of MIDI messages that control the interaction and communication of MIDI-compatible equipment that activate light or other entertainment devices. These devices are designed mainly for stage shows and concerts.
There are a few steps to follow to enable MIDI input and output in OpenMPT; Below is the procedure for using your MIDI devices with OpenMPT.
Enabling MIDI Input
- Plug your MIDI device into your computer. Unless the device has a PC-specific port (serial or USB), or your computer has a MIDI-specific input, you will probably need a special converter plug to transfer MIDI messages between the two. Check your device’s manual to make sure you have the correct connection. Many newer computer models no longer use serial ports, but some older MIDI synths provided them. If you are planning to purchase a MIDI device for use with OpenMPT, it is advisable to get one with USB connections, since they are generally the most universal and they have a higher data exchange speed and reliability.
- Click on the Setup icon in the Main toolbar, or alternatively, select the Setup menu item from the View menu). The Setup dialog will open.
- Click on the MIDI tab to see the MIDI Setup page.
- In the MIDI Input Device list, make sure the correct input for your MIDI device is selected.
- In the Main Toolbar, select the MIDI Record button, depicted on the right. Check Enable MIDI recording in the MIDI Setup to have this enabled by default.
- Now while editing in the Pattern Editor, notes played on your MIDI keyboard will input the corresponding notes in the pattern.
- To assign a MIDI controller to a macro for output (so that you can manipulate MIDI parameters of an external MIDI device during playback), see the section on Zxx Macros.
- To control plugin parameters using incoming MIDI data, you can set up parameter routing from the MIDI Mapping dialog.
You may also quickly switch between several MIDI input devices from the main toolbar by clicking the drop-down button next to the MIDI Record icon.
Enabling MIDI Output
OpenMPT cannot access MIDI hardware from the application itself, but a plugin called MIDI Input / Output is shipped with OpenMPT to allow for easy MIDI routing.
However, this plugin is more than just an instrument plugin to send out MIDI data; As the name suggests, it can also be used to capture incoming MIDI events. While this might not seem useful at first, it brings some advantages over the default MIDI input in some cases:
- Several plugin instances can be opened at once to allow for multiple MIDI inputs.
- The incoming MIDI events are only routed to the next chained plugin.
Combining these two previous points, you can use the plugin to control another instrument plugin exclusively using the MIDI data from the MIDI plugin. Only the selected output plugin of the MIDI plugin will receive this input. MIDI events captured by this plugin can also be be recorded to the pattern editor by toggling the Record MIDI Out to Pattern Editor setting in the plugin window’s Options menu.
You can set up plugin chains with several MIDI processing plugins to go crazy: How about sending the MIDI events captured by this plugin to an arpeggiator plugin, and then send the arpeggiated MIDI data generated by that plugin to another instance of the MIDI Input / Output plugin to control external gear that has no built-in arpeggiator? It’s up to you!
Here is a short tutorial on setting up the MIDI Input / Output plugin to control external MIDI:
- If not done already, add the MIDI Input / Output plugin to OpenMPT′s plugin list using the Plugin Manager.
- Open or create a track in XM / IT / MPTM format.
- In the General page, in the Plugin section at the bottom half of the page, make sure the current plugin is empty, and click on the “Select” button next to it. The Plugin Manager window will open.
- Find the MIDI Input / Output plugin (it should be in the instruments category). Click on it, and click on the top button (“Put in FX01” or whatever slot you are putting it into).
- Now you can click on the Edit button to see its interface, shown on the right. Click on the dropdown list under “MIDI Output Device” to choose the MIDI port to route MIDI data to.
- OpenMPT automatically creates an instrument to control the VST. You can then use the newly created instrument to send note data to the MIDI Input / Output plugin on a specified MIDI channel, which in turn will send it to the port where your MIDI instrument receives its data. This should play the MIDI instrument.
Note: The "Compensate for host output latency" function delays the MIDI output so that it is in sync with OpenMPT’s audio output. This is especially important when you cannot resort to low latency playback. This does not compensate for any delay the targetted MIDI device might introduce, though.