home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeDesigning Web AudioSearch this book

Chapter 10. MIDI: Quick and Easy Audio for the Web

One of the quickest and easiest means by which to add sound to a web site is to use MIDI (Musical Instrument Digital Interface). MIDI allows for universal, cross-platform communication between computers and composers. It lets you easily integrate sound into your site by utilizing the same principles musicians and producers have used for nearly two decades. What makes MIDI a popular format for web audio is its simple learning curve, its inexpensive price tag, and its conservative use of bandwidth.

MIDI developed out of the need for a standard. In the late 1960s and early 1970s, electronic instrument makers began to create the world's first commercial synthesizers. Companies created systems that could communicate only with their own synthesizers. These machines were made popular by such music pioneers as Keith Emerson, Joe Zawinul, Walter and Wendy Carlos, and most notably, Herbie Hancock.

In the early 1980s, synthesizers started becoming more mainstream and computer software was developed to communicate with the electronic instruments. With the introduction of each new synthesizer, manufacturers were forced to write complex customized code to interface with each new product line. Due to the inherent inefficiencies in developing new software each time a new synthesizer was developed, the larger electronic instrument companies like Roland, Sequential Circuits, and Yamaha decided to create a universal standard that all electronic instruments and computers could understand.

During a 1982 conference, a group of music industry heavyhitters gathered to discuss a common protocol. In 1983, the MIDI standard was born with the introduction of the first MIDI keyboards by Roland and Sequential Circuits. Soon after, virtually every synthesizer manufacturer in the world was producing MIDI-compatible hardware.

10.1. MIDI: A universal approach

MIDI and MIDI-hybrid formats such as Beatnik or QuickTime Music Tracks are perhaps the best audio formats on the market for incorporating sound into limited-bandwidth environments. MIDI communicates between devices via a text-based code system or score. Much like the player piano of old, where hole-punch sheet music was fed into the piano, MIDI pianos and synthesizers can play back music translated into the MIDI format. When a user comes across a web page featuring MIDI, the embedded MIDI file or score is downloaded to the computer and played back via the user's MIDI-compatible soundcard or synthesis engine.

On most home computer systems, MIDI is played back with Apple's QuickTime plug-in or Microsoft's Windows Media system. These plug-ins feature a MIDI sound engine or a software-based synthesis module that replicates a set of common instrument sounds. Increasingly, popular web browsers such as Internet Explorer and Navigator 4.0 and later are starting to include built-in sophisticated MIDI sound engines.

10.1.1. Advantages to using the MIDI format

The main advantage to using MIDI on your web site is that MIDI file sizes are relatively tiny (usually between 2 KB and 25 KB) in comparison to other digital audio formats. Traditional digital audio files are measured in megabytes. Another advantage is that MIDI is a universal language, compatible with almost all browsers and computers across the Internet. In other words, you do not need a special plug-in, other than what is pre-installed in your web browser, to listen to MIDI files. This is important because many users are not comfortable with or do not want to download an extra plug-in to listen to other formats.

MIDI also happens to be ideally suited to the low-bandwidth web medium. MIDI playback has several key advantages over other web audio formats:

  • Near universal playback.

  • Availability of a copious amount of MIDI files featuring all types of music.

  • Easy integration into existing HTML pages using a standard text editor.

  • Availability of mature authoring tools, such as Performer, Vision, and Cakewalk, and a large base of knowledgeable users on the Internet and in the music industry.

  • The smallest file size per minute of any audio format. (An entire minute of MIDI results in a mere 10 KB to 20 KB file, compared to a one-minute 500 KB MP3 file or a 120 KB 28.8 Kbps RealAudio file.)

Despite its limited range, MIDI is so ideally suited for the Web that it's surprising that it's not used more often. However, MIDI is constrained in part by computers with cheap sound cards and by inferior software synthesis engines that cause more elaborate MIDI compositions to sound less than perfect. The MIDI file is simply a set of instructions about how a given synthesizer or sound engine should play back the particular MIDI file. All the texture and richness comes from the synthesis engine itself. For this reason, many people mistakenly assume that MIDI is to blame for the poor sound quality, when it is often the sound engine that is the culprit. When played back on a decent sound engine (software sound engines such as QuickTime are making nice advancements in quality), MIDI can sound very good, often making it difficult to tell whether the source was live or MIDI-produced.

However, cheap MIDI engines are not the only offender. Using poorly composed MIDI files or using unedited files grabbed from web sites also creates problems. With a little work, MIDI files can be made to sound good, even when played through a lower-quality MIDI sound engine.

If you follow good sound design techniques, you will find many uses for MIDI. And if you are already familiar with a MIDI editor, you will not have to face the steep learning curve involved with RealAudio, Flash, or Shockwave integration. MIDI is a good sound design alternative for creating mood and ambiance on your site. You don't always have to use the most sophisticated multimedia formats in order to add sound. If you just want to add a little intro theme music to your welcome page or a few button rollover sounds to your navigation bar, RealAudio and Flash may be overkill. Ask yourself if your site needs custom-built interactive Flash or Shockwave soundtracks or digitized audio broadcasts with RealAudio. If the answer is no, consider using MIDI.

So what's the catch? Despite some of MIDI's advantages, it has some drawbacks and limitations. For example, MIDI uses an entirely different method of producing sound than do traditional digital audio technologies. And because MIDI is basically a language for communicating music notation and not a storage format for digitized audio, there is no way to broadcast voices or prerecorded sounds with MIDI. Essentially, MIDI is limited to jingles, instrumental tunes, and ambient synthesizer background sounds.

Another disadvantage to MIDI is that each user's MIDI sound engine or hardware/software setup may contain a different set of musical instrument sounds. If you compose a piece of music in MIDI and use a great synth sound you have spent months customizing, chances are it is not going to sound the same played back over the SoundBlaster card or other MIDI sound engine loaded on your user's machine.

While initiatives such as General MIDI have helped to standardize MIDI playback, there is still considerable variance in playback from one device to another. General MIDI is a standard that specifies a common bank or a set of 128 musical instrument sounds that all MIDI devices share in common to ensure uniform playback. For example, with General MIDI, you can be assured program number 4 will be a honky tonk piano sound on any General MIDI device, instead of a flute or drum sound.

What a difference a good MIDI sound engine makes

 

To demonstrate the audible difference between various MIDI sound engines, compare the two MIDI examples at http://www.designingwebaudio.com.

 

Example MIDI #1 is a recorded excerpt of a MIDI file playing Beethoven's 5th Symphony. The file was played through the QuickTime music instruments and the result recorded in 44.1 kHz audio. As you listen to the sound, you may notice how the QuickTime MIDI sound engine produces every note of Beethoven's 5th, without missing a beat. You may also notice that the sound quality is pretty good for a computer and a software synthesizer. However, the deep, rich tones of the symphony are missing from this file. One reason why software-based synthesizers (like those developed for QuickTime) cannot reproduce the finer nuances of elaborate compositions is the current processor speed and power of PCs. As faster processors are developed, sound quality is expected to improve.

 

Now listen to the second example, MIDI #2. We used the same MIDI file, but switched the MIDI-compatible sound engine. We ran the MIDI file through an Alesis Quadrasynth Plus (a hardware-based keyboard/sound module) and recorded the outcome. As you listen to this recording, the difference is noticeable. You may even think the recording was made with real instruments. The reason Quadrasynth Plus has better sound is simple: the sounds are actually sampled from symphonic instruments and stored on ROM chips, then placed into the synthesizer's hardware architecture.

 

QuickTime also uses samples and wavetables via the Roland Sound set.However, a dedicated external synthesizer like the Quadrasynth Plus has more memory and dedicated ROM for samples and therefore yields better sound. Most hardware synthesizers sound better than most software synthesizers because they have dedicated DSPs (Digital Signal Processors) and because they're built specifically for music applications. A DSP is a dedicated microprocessor used to process sound by any number of ways the user requests. In the MIDI #2 file, the DSPs are working to create the sound. In other cases, the DSPs can be used to alter a sound by adding effects such as reverb or delay. The advantage of a DSP is that it can be programmed to perform almost any function.

But General MIDI is not a cure-all; it merely specifies that your instrument settings should be the same from one General MIDI device to another. General MIDI cannot tell each synthesizer or sound engine how to reproduce a particular bamboo flute, grand piano, or a more difficult sound, such as an angelic synth chorus sound. Each manufacturer's MIDI-compatible device uses a slightly different technique to reproduce sound. This means you cannot guarantee exactly how your MIDI music score will sound when played back through a user's particular set of instrument sounds, especially if you are using a subjective description, such as "tubular bells" or "Indian flute."

To avoid this problem, make sure your MIDI files are built around common instrument sounds that are easy to reproduce and fairly consistent from one device to the next, such as bass, organ, harmonica, and piano. Avoid using sounds that are difficult to reproduce, even instrument sounds such as guitar, saxophone, and most horn instruments, which all do synthesize well on expensive synthesizers. Later in this chapter, we show you how a new specification called DownLoadable Sounds (DLS), which offers more predictable playback with higher-quality synthesis, is helping create better standards, so you don't have to be as vigilant about your instrument selections. (See the sidebar "DLS: The future of MIDI" later in this chapter.)

The quality of MIDI playback is expected to improve in the near future as synthesis engines improve with faster chips and more extensive software. In 1999, we saw the advancement of some software synthesis engines, such as the new Unity DS-1 software sampler from BitHeadz. There are also several promising initiatives, including DLS, which is spearheaded by the MIDI Manufacturer's Association and companies such as Apple Computer and Microsoft. The music equipment industry is also seeking to improve the quality of MIDI playback via more powerful synthesis engines and standardization among sound cards.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.