HOW MIDI WORKS
MIDI is an acronym for Musical Instrument Digital Interface. Originally invented in the 1980s, today MIDI has become the de-facto standard for communicating between electronic musical instruments.You can think of MIDI as a simple networking protocol. Essentially, you hook up all of your hardware (synthesizers, drum machines, computers, and so on) using MIDI cables, and assign each unique piece of equipment a channel ID (see Figure 6.1). For example, your synthesizer might be channel 2 and your drum machine might be channel 4. Now, when you press a key on your synthesizer, a "Note On" message gets sent out on channel 2. When you hit a drum on your drum machine, a Note On message gets sent on channel 4. MIDI supports up to 16 different channels.
Figure 6.1: A professional MIDI setup might have several different pieces of hardware, all assigned to different MIDI channels.
Software on your computer (or your synthesizer, if you have an advanced one) can listen to any or all MIDI channels and record the "Note On" events. It can then play them back by sending out messages on the appropriate channels. Or, it can save the sequence of notes it received into a MIDI file.
AUDIO CLIP | Play Audio Clips 6.1, 6.2, and 7.3 to hear a couple of differenct examples of MIDI music. |
The Note On message itself contains several different fields—of course, there's a number representing which note of which octave to play (for example, middle C, or C4—higher numbers mean higher pitched notes), as well as options for the volume of the note, the duration, and so on. For drums, the "note" is actually the type of drum to play—when a drum synthesizer receives a C4 note, it plays a high bongo drum. For drum machines, higher note numbers do not mean higher pitched drums, they mean different drum sounds altogether, sort of like the ASCII character set.There are many different types of messages defined by MIDI. Note On is arguably the most important, but there are also messages used to tell devices to change their voice and perform special effects (like vibrato or pitch-bending).MIDI channels are not the same as tracks. Sequencer software (for example, DirectMusic Producer or Cakewalk Pro Audio) uses the notion of tracks. Whereas there are only 16 MIDI channels, there can be hundreds of tracks. However, at any given time, you can have at most 16 channels active, even though those 16 channels might be spread over a higher number of tracks (for example, some tracks might be muted because they contain different recordings or different effects). This doesn't mean there's a limit of 16 notes being played simultaneously—each channel corresponds to one device or instrument, but many devices or instruments allow several notes to be played at once (called polyphony).In DirectMusic, MIDI messages aren't usually sent out the MIDI port, through the MIDI wire, and to external synthesizers. Rather, they're sent to DirectMusic's internal synthesizer, which synthesizes the sound in software and ships it off to the speakers. This is a tremendous benefit for video games because it means that you don't have to have thousands of dollars worth of synthesizers and equipment to get MIDI files to sound good; all you need is the standard DirectMusic synthesizer that comes with Windows.