Feeling the Music with MIDI


Musical Instrument Digital Interface, or MIDI , started out in the early 80s as an attempt to establish a standard interface between musical instruments. The main use for MIDI back then was to enable a dedicated keyboard to control a synthesizer. Keyboard synthesizers consist of two main components : the keyboard and the synthesizer. The keyboard is responsible for keeping up with input information such as which musical note is being generated and how hard the key is being pressed on the keyboard. The synthesizer, on the other hand, is responsible for generating sounds based on the input information provided by the keyboard. So, the original goal of MIDI was to provide a standardized approach to controlling a synthesizer with a keyboard. MIDI eventually expanded to support an incredibly wide range of musical instruments and devices, but the keyboard/synthesizer relationship is significant to MIDI as it applies to computers.

One way to view a MIDI device is as a note generator in the input sense and as a sound generator in the output sense. It isn't important how a MIDI device works internally as long as it adheres to a MIDI interface for generating or outputting notes. You might be thinking that the design of MIDI sounds somewhat reminiscent of the device-independent design of Windows, and in many ways this comparison is accurate. Just as Windows makes it possible to mix and match different kinds of hardware and have them work together, MIDI makes it possible to connect different kinds of musical devices together and have them work together as well. Most electronic musical equipment now comes standard with MIDI interface ports. In fact, the sound card on your computer has a MIDI-compatible interface through which a MIDI device can communicate with your computer.

Similar to waves, MIDI music is digital. However, unlike waves, which are just approximations of analog sound waves, MIDI music consists of musical notes. In other words, a MIDI song consists of a series of carefully timed musical notes. This means that you can create a MIDI song much like you might write out a musical composition on paper. This task requires special software, but it is possible if you have the knowledge and skill to write music. Because MIDI music is composed of notes rather than wave data, the resulting output sound quality is entirely dependent on the MIDI output device used to play the music. In the case of your computer, your sound card likely includes a MIDI synthesizer that can be used to play MIDI music. It's up to the synthesizer and Windows multimedia features to decide how the specific music sounds when played .

The main benefit of MIDI is that it allows you to use one MIDI device to control others. You can use a MIDI keyboard to play notes through another MIDI device, such as a MIDI sequencer. Even though you're generating notes by playing them on the keyboard, the actual instrument sounds are processed and output by the sequencer. In other words, you are triggering the sequencer with the keyboard. A similar situation occurs when you play MIDI music on your computer. The notes contained within the music are sent to the sound card where they trigger the synthesizer to play the actual sound.

I've mentioned MIDI music several times throughout this discussion, but I haven't really clarified how it is stored or how you work with it. Similar to waves, MIDI music is stored in files, but MIDI files have the file extension .MID. Unlike waves, MIDI music files are typically fairly small because musical notes simply don't take up a whole lot of space. Like waves, you can play MIDI files using Windows Media Player (see Figure 13.2). There is no built-in Windows tool for creating or editing MIDI files because creating MIDI music is more difficult than recording waves, and it involves a fair amount of music knowledge.

Figure 13.2. Windows Media Player can be used to play MIDI files, as well as wave files.

graphics/13fig02.jpg

Playing a MIDI file in Windows Media Player is as simple as double-clicking the file in Windows Explorer. This works because MIDI files are automatically associated with Windows Media Player. You will likely use Windows Media Player to screen MIDI files for use in your games . Or, if you're ambitious enough to create your own game music, you'll likely use Windows Media Player as a final means of testing a MIDI file before incorporating it into a game.



Sams Teach Yourself Game Programming in 24 Hours
Sams Teach Yourself Game Programming in 24 Hours
ISBN: 067232461X
EAN: 2147483647
Year: 2002
Pages: 271

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net