Audio Fundamentals

Sound is just quivering air—the faster the quiver, the higher the sound; the more violent the quiver, the louder the sound. Sound pitch, or frequency, is measured in units called hertz (abbreviated as Hz), and a thousand of those units are called a kilohertz (abbreviated as kHz). The best human ears can hear frequencies ranging from a low, throbbing 20 Hz to a squealing 20 kHz. Sound intensity is often measured in decibels, and the range from the softest sound to the loudest in any given recording is called the dynamic range.

Audio data stored on the Mac (or any other computer) usually contains the information needed to re-create both the frequency and the intensity of the sound in any given instance. Most simply, this means measuring the intensity of the sound at regular intervals (usually thousands of times a second) and recording the intensity as a number. Given the rate of measurements (the sampling rate) and the measurements themselves, your Mac can easily re-create the sound waves.

The quality of any digital sound on your Mac ultimately depends on two factors: how many measurements you take per second (the more measurements, the higher the frequency you can reproduce) and how precise each of those measurements is (the more precise, the smoother the sound). But the more measurements you take and the more information you store in each measurement, the more disk space or memory is required. With sound (and as we'll see later, with video), you often find yourself making tradeoffs between quality and storage.

To get a sense of the numbers involved, let's look at the standard audio CD. It stores two channels of sound. Each channel consists of 44,100 samples per second, and each sample takes up 16 bits (2 bytes) of storage (which can hold a number between 0 and 65,535). This means each second of CD-quality sound requires more than 176 Kbytes of disk space, and a single minute takes up 10 MB.

When you face numbers like these, you can well understand why audio compression was invented. Some common sampling rates and sizes for a single channel of uncompressed audio appear below:

Sample Rate Sample Size Storage for 1 Minute of Sound
11.025 kHz 8 bit 645 Kbyte
22.050 kHz 8 bit 1.26 MB
44.100 kHz 8 bit 2.52 MB
11.050 kHz 16 bit 1.26 MB
22.050 kHz 16 bit 2.52 MB
44.100 kHz 16 bit 5.04 MB

Uncompressed Audio Formats

Uncompressed audio comes in several standard packages. Here are a few common ones you might encounter:

AIFF.

A basic cross-platform format developed by Apple, AIFF can support samples of various sizes at all common sampling rates. Just about every program for digital-audio editing on the Mac can handle AIFF sound.

SND.

This is the original Macintosh sound format. Your system alert sounds are stored in SND format, and it is the format you'll use if you need to store a sound in a file's resource fork (see Chapter 22, “Cross-Platform Compatibility,” for details on resource forks and what they're for). This was once the dominant audio format on the Mac, but most multimedia now uses other (usually cross-platform) formats. One cool thing about SND files: You can play them by simply double-clicking them in the Finder—no player required.

WAV.

The common Windows audio format. Though it was once bothersome to use WAV files on a Mac, that's no longer true: QuickTime Pro, for example, handles this format with ease.

8- or 16-Bit Sound?

Back when disk space and RAM were at a premium, it made some sense to keep the sample rate down to 8 bits. However, when you only have 8 bits per sample, you can only record 256 distinct levels between the softest and the loudest sounds. The effect? Even at a high sampling rate, 8-bit audio seems fuzzy and crackly. For example, even though audio stored at 11 kHz and 16 bits can only reproduce half the frequency range of audio stored at 22 kHz and 8 bits, the 11 kHz recording will usually sound a lot better. Today, storage is cheap and plentiful, so there's little reason to skimp on the sampling rate.


QuickTime.

In addition to accepting any of the above formats (and many more besides), QuickTime can store uncompressed audio data in its own file format, and it can handle just about all of the commonly used sample sizes and rates. If your multimedia project is at all QuickTime based, you'll probably want to keep your sound in QuickTime audio format (Figure 16.1).

Figure 16.1. The QuickTime Player plays an audio file.


About Audio Compression

Uncompressed audio can eat up a lot of space quickly, and although today even the humblest iMac ships with many gigabytes of storage, that space isn't infinite. If you want to keep a lot of audio on your hard disk, you need to make it as small as possible … and if you're planning to pass it along over the Internet, you really need to make it as small as possible (some of us still have modems!). That's where compression comes in.

Audio tends to resist compression: The data is complicated and varies constantly, and there's usually not much in the way of redundant information to eliminate. Consequently, most audio-compression schemes are designed to throw away nonredundant data (this is called lossy compression) … but once enough of the data is gone, you really start to notice its absence. The best audio compressors work hard to find just the right chunks of data to eliminate or to represent in a simpler form, without degrading the sound too severely.

Once audio is compressed, it must be decompressed for playing: The more sophisticated the compression, the more processing is required to decompress the audio. However, the harder a decompressor has to work your Mac's processor, the less time the Mac has available to play the decompressed sound. The latest generation of audio compressors and decompressors (when paired, they're called codecs) require a fast processor to work effectively, and seem happiest using nothing less than a PowerPC G3 (or a blistering Pentium III).

Capture raw, cook it later: Because audio compression blithely discards infor-mation, you should delay compressing your audio data for as long as possible. Instead, bite the bullet and capture the best raw (that is, uncompressed) sound your system can handle. When you finish editing and otherwise manipulating your audio, that's when you want to compress it.


Compressed Audio Formats

Thanks in large part to the Internet explosion, stuffing high-quality audio into tiny packages has become a top priority for the digital technology and entertainment industries. Many (often proprietary) audio codecs have made their way to market recently (although a few hung around just long enough to squeeze the fruit before leaving).

The latest audio-compression schemes available on our Macs generally fall into three categories: those for which QuickTime has a codec, those formats QuickTime can decompress but not compress, and third-party proprietary formats that haven't been licensed (or reverse engineered) for QuickTime at all (Figure 16.2).

Figure 16.2. This QuickTime menu shows the audio compressors available to the program.


AU (QuickTime has codec). This format—common on Unix systems—comes in two standard variants, A-Law and μLaw. AU stores data in 8-bit chunks, but in a logarithmic format roughly equal to 14 bits of ordinary sample data. It only compresses the audio by half and is not very useful for high-quality sound (not surprising, since it was originally developed for voice data on the telephone).

IMA 4:1 (QuickTime has codec). Developed by the International Multimedia Association, this format reduces audio to about a quarter of its uncompressed size. The format is relatively simple, so the processor doesn't have to work very hard (good for older machines but not for Internet delivery), and it offers pretty good quality as long as you're not a raging audiophile (if you are, you probably don't even like uncompressed CD audio).

MACE (QuickTime has codec). Don't go there, sister, this one's obsolete.

QDesign Music (QuickTime has codec). Developed by QDesign Corporation (www.qdesign.com), this codec uses a proprietary psychoacoustic method to compress recorded music. The compression method is slow (usually taking several minutes to compress one minute of sound), and the decompressor requires at least a 100 MHz PowerPC. But it's worth it: This format can reduce audio files to a hundredth of their uncompressed size and still deliver acceptable quality. If you plan to use this codec frequently, you should consider getting the professional version at $399—it provides many more compression settings and is optimized to work with the PowerPC G4's Velocity Engine.

Qualcomm PureVoice (QuickTime has codec). From the digital-phone folks, the PureVoice codec works best with, well, pure voice: It reproduces human speech very nicely, and reproduces music and sound effects not so nicely. PureVoice can compress voice data in real time to less than 60 Kbytes for a full minute and still deliver telephone quality, perfect for that marathon reading of Finnegans Wake you want to e-mail to all your friends.

MP3 (QuickTime has decompressor). This is the codec that gives the Recording Industry Association of America nightmares. Many people call it MPEG 3, but that's incorrect: It is actually the MPEG 1, Layer 3, audio format. It performs best when compressing audio to a rate of about 16 Kbytes per second of sound (not nearly small enough for modem-speed streaming but acceptable for swapping files over the Internet). Although you can stream MP3 over the Internet to users with fast connections, the arrangement of the data in an MP3 file is not very friendly to the streaming process: You'll really notice any data drop-outs. It seems odd that Apple doesn't support an MP3 encoder in QuickTime, especially given that the company does provide a dandy one with iTunes, but sometimes Apple is just so inscrutable.

MP3 and the Coming Revolution

Maybe that title's a bit strong, but the MP3 audio codec has given the entertainment industry (and particularly the recording industry) a violent case of the revolving clammy-damps. What makes MP3 so important is that it is an easily available codec that can compress a CD-quality audio file by a factor of 10 and still provide very high fidelity. The MP3 codec made it possible for companies such as Napster and MP3.com to distribute music files to a very large audience—often before they worked out the copyright and licensing issues with the record companies (providing rich opportunities for both the legal profession and the press). Even more upsetting to music-copyright owners, the MP3 format has made it possible for anyone with a computer and a CD drive to create high-quality digital copies of music and share them with a few thousand of their closest friends.

So popular has this activity become that Apple now ships recordable CD drives with most of its computers and has produced the nifty (and free) iTunes program, which can play MP3 files, encode or rip them from audio CDs, and even record or burn duplicate audio CDs using the MP3 files it just ripped. Suddenly the pirate flag that flew over the original Macintosh development team's headquarters takes on a whole new historical significance.


RealAudio (unavailable to QuickTime). This proprietary format is designed for streaming audio from a remote server, although RealPlayer will let you play RealAudio files stored on your hard disk as well. The player comes in two forms: the free RealPlayer or its pay-for-play big brother, the $29.99 RealPlayer Plus (Figure 16.3). (Many users buy the Plus version because finding the link to the free player on Real's Web site at www.real.com is like playing an endless game of “Where's Waldo”—the link is tiny and seemingly moves every few days.) The format is extremely common on the Web; RealAudio is still the most widely used streaming format. Its compression is quite good, and at some data rates the quality slightly exceeds the best that any currently available QuickTime codec can provide. RealNetworks provides the $199.95 RealSystem Producer on the Mac for compressing QuickTime and other formats into RealAudio.

Figure 16.3. The free RealPlayer—note its clean, unobtrusive design.


However, the format does not integrate well with other applications: Your choices are pretty much either the RealPlayer application itself or the Web browser plug-in that comes with it. If you want to extract the sound from a RealAudio file and convert it to some other format, forget it. The RealAudio format is like a Roach Motel—sounds go in but they don't come out. Finally, if you happen to have a server and want to stream RealAudio files, prepare to get a Windows machine (the RealServer software doesn't run on Macs) and to dig deep into your retirement fund. The server software price is high, and goes up as you increase the number of users you want to serve.

Windows Media (unavailable to QuickTime). This is Microsoft's answer to both QuickTime and RealAudio. The current Mac version of the free Windows Media Player (often referred to as WMP) supports five audio codecs comparable in quality to the ones QuickTime and RealAudio provide (www.microsoft.com/mac). The format is becoming very common in the Windows-using world and on the Internet because Microsoft is backing it strongly. The company has specifically targeted customers who are concerned about protecting intellectual property rights. The format features both Microsoft's Digital Rights Manager and its Windows Media Rights Manager. WMP on the Mac lets you play the format (though the player seems to be in perpetual beta release), but if you want to develop multimedia for it or serve WMP files, Microsoft offers no Mac options: The folks in Redmond very much want you to both develop your multimedia on and serve it from Windows. (All right, stop laughing … they're serious!)

Capturing Audio

Sound (like love) is all around us; the trick with sound is to get it inside your Mac and keep it there (what you do with love is your business). The process of getting sound into your Mac is variously called capturing, digitizing, or ripping. Sound sources come in a lot of forms, so it shouldn't be surprising that there are a lot of different ways to capture it.

Capturing CD audio.

If you have QuickTime Pro and a CD drive, this couldn't be simpler (Figure 16.4). Put in the CD. Open QuickTime Player. From the File menu, choose Import. In the Open File dialog box, select the CD and choose a track. Then click the Convert button. You'll see a Save File dialog box. Give the file a name and save it on your hard disk. If you like, before you save it you can click the Options button, which lets you choose just a portion of the track, set the sample rate and size, and choose between mono and stereo capture. The captured file will be in uncompressed AIFF format, so expect each minute to devour 10 MB.

Figure 16.4. QuickTime Pro offers many capture options.


iTunes: A Ripping Good 'Ware

Apple's free iTunes software (www.apple.com/iTunes/) may be targeting the Napster-loving, CD-burning, MP3-toting youthful hordes of the twenty-first century, but it's also a slick tool for the multimedia developer who wants to bring some CD audio quickly into a project (Figure 16.5).

Figure 16.5. Ripping a song with iTunes is easy.


For starters, iTunes serves as a free CD cataloging program (no small thing, as keeping track of digital media is one of the essential tasks in multimedia development). Just pop a CD in your Mac and open iTunes. If you are online, it will immediately establish a direct link to Gracenote's CDDB music-recognition service (www.cddb.com) and attempt to retrieve the name of the CD, the artist, and the titles of all the tracks—and it almost always succeeds. But if CDDB comes up dry (or if you're just a roll-your-own kind of gal or guy), you can enter that information yourself. What's more, your Mac will remember the information the next time you insert the CD.

Even more useful is iTunes' capturing or ripping capability. Just click the program's Import button and stand back: iTunes will rip the CD, track by track, into MP3 format—quickly, too. Even a modest 233 MHz iMac (Rev. B) can rip a track in half the time it takes to play it (a midrange Power Mac G4 will suck in the tunes at rates better than 7:1). If MP3 isn't your compression cup of tea, you can set iTunes's preferences to rip to AIFF or WAV format at various sampling rates and sizes. The preferences also let you tune MP3 compression settings for a range of data rates and set a number of other encoding options.

So Where Are the Tunes?

iTunes stores the ripped files (which it calls songs) in its Music folder. It sorts the files into folders and subfolders alphabetically, first by artist and then by title. iTunes stores songs in the album folders and names them after the tracks (using either the names it fetched from CDDB or the ones you entered), so it's very easy to find the track when you want to use it in a project. Just -click any song in your iTunes library and choose Show Song File—the Finder will open the song's folder and highlight the file (Figure 16.6).

Figure 16.6. iTunes, go get that tune!


Sound capture, compression, and cataloging: not bad for the price. (Oh, yes, iTunes does a few other things, too, but those are mostly for fun.)


Capturing analog audio.

You must first convert analog audio (such as the output of a cassette deck) into digital information before you can save it on your Mac—unlike CD audio. Luckily, if you have one of the many Macs that came with the PlainTalk microphone, you already have an analog-to-digital converter. The microphone jack on your Mac is actually a line-in jack, compatible with most consumer audio equipment, that provides good enough quality for many multimedia projects.

Demanding audio professionals will want to bypass the Mac's built-in audio input and outfit their Power Mac towers with a dedicated capture board that's compatible with high-end studio equipment (if you know what S/PDIF, ADAT optical, and MIDI I/O mean, you're one of those people). Digidesign (www.digidesign.com) is one of the product leaders in this area (it's owned by Avid, which also makes professional Mac-based video-editing systems). If you want to set up a home recording studio, the Digi ToolBox XP capture system will get you started for $545. On the other hand, if you're an extreme audiophile and money (at least, $11,995 of it) is no object, you may want to go all the way to Digidesign's top-of-the-line Pro Tools/24 MIX3 24-bit digital-audio production system.

If your needs fall somewhere in between—and you have a USB-equipped Mac running Mac OS 9 or later—Edirol's $430 Roland ED UA-30 might be right for you (www.edirol.com). It provides RCA line level, 1/4-inch mike- guitar, and S/PDIF optical inputs; it has a front-panel mixer; and it doesn't require a Mac with PCI slots.

Once you have the hardware figured out, you'll still need software to handle the actual capturing. The high-end capture boards usually come with their own software for this, but at the lower end you'll have to look around for suitable applications. You needn't look very far, since several shareware and freeware solutions are readily available. Among the freeware solutions is Coaster (www.visualclick.de/), a direct-to-disk recording utility that can handle 44.1 kHz stereo input and produce standard AIFF files. It also provides useful additional features, such as clipping detection, accurate level meters, and click elimination. A $35 shareware fee gets you Felt Tip Sound Studio (www.felttip.com/products/soundstudio). Not only does it perform audio capture but it also provides good basic sound-editing capabilities, audio fil-ters, and pitch shifting (now you can make Barry White a tenor!). The $25 Amadeus II shareware application (www.unige.ch/math/folks/hairer/martin) can capture, edit, filter, and analyze your sound files; this one's best for working with a bunch of short sound samples.

Where's My Mike, Jack?

Some of the latest Macs, including the newest Power Mac G4s, omit both the previously standard audio-input jack and the microphone. Apple surely has its reasons (the profit margin is certainly involved), but that omission makes multimedia production trickier. However, third-party developers have come up with alternatives that provide audio input via the now-standard USB connectors on modern Macs. For example, Griffin Technology's surprisingly inexpensive iMic add-on ($35; www.griffintechnology.com) provides cleaner sound input than the older analog input and doesn't require any special driver software. (The microphone-free Tangerine iBook on which I'm writing this chapter loves its iMic and never leaves home without it.)


MIDI—What It Is

Anyone who plays electronic instruments probably knows more about this standard than we can cover here, but for the rest of us, MIDI stands for Musical Instrument Digital Interface and is a long-established standard way to interconnect electronic music devices so they can exchange information. As the name indicates, this information is digital, so it's not surprising that your Mac can understand and manipulate MIDI data. The data is not digitized sound but, rather, information about a musical performance: which keys the player pressed, for how long, and so on. You can store such data very compactly and manipulate it very easily—a MIDI file representing ten separate instruments playing, say, a minute-long piece typically takes up just a few kilobytes on disk.

MIDI files contain sequences, and a sequence can contain one or more channels, where each channel represents the performance of a single instrument, and each instrument has a corresponding program number. In the electronic music world, MIDI data usually goes to a synthesizer, which plays the sequence using its own sounds (these can be either hardware generated or predigitized sound samples).

Although the basic MIDI standard lets a musician assign any instrument to a MIDI program number, another standard called General MIDI helps musicians work together by assigning specific instruments to specific program numbers. For example, in General MIDI 0 is always a piano sound and 12 is a vibraphone. Using this specification, musicians can exchange MIDI files and get reasonably comparable results on their different playback systems.

Macs can both play and produce MIDI. Among its many other features, QuickTime provides MIDI playback support, allowing Apple's QuickTime Player to open any standard MIDI file and play it back using QuickTime's built-in Roland GS samples, which adhere to the General MIDI specification. QuickTime Player Pro even lets you change the instruments assigned to each channel (Figure 16.7).

Figure 16.7. You can change a MIDI channel's instrument with QuickTime Pro.


Making MIDI.

Hooking a MIDI instrument (such as a keyboard) to your Mac is more complicated than it used to be. On older Macs with serial ports, you could hook an inexpensive MIDI interface device to one of the Mac's two serial ports (each port can support 16 MIDI channels). However, today's modern Macs don't have serial ports—but they do have USB ports, and several manufacturers have produced MIDI USB interfaces. Mark of the Unicorn (www.motu.com) provides a range of USB-based MIDI interfaces, from the Fastlane model ($79) to the full-featured Pro Tools–compatible MIDI Timepiece AV ($595).

MIDI files consist of sequences, and the programs used to write them are sequencers. Generally, you have to know a good deal about music to use them, and even the simplest sequencers provide much music-making power. One widely used MIDI sequencer is Steinberg's Cubase VST (www.steinberg.net) at $195; another is Mark of the Unicorn's Performer ($295). Many others are available as well, and musicians apparently never tire of discussing the features and quirks of the sequencer du jour.

Creating scores.

MIDI can also take the drudgery out of transcribing music; the MIDI data contains the notes played, the duration of those notes, and the volume … and that's just what a musical score is all about. After all, why labor to write down your music when you can just play it and have your Mac lay out the score? The top-of-the-line product for such interactive music notation is Coda's Finale 2001 ($545; www.codamusic.com), which provides unlimited staves, professional notation, and seemingly endless features (with the concomitant seemingly endless learning curve). A less complex (and less expensive) notation program that understands MIDI is Ars Nova's SongWorks II ($125; www.ars-nova.com).

Uses.

Aside from its obvious uses for musicians and composers, MIDI fits right into many multimedia projects. Games often use MIDI tracks to provide background music, Web sites occasionally play background MIDI sequences (and we really wish they wouldn't), and because QuickTime can easily play MIDI, interactive QuickTime projects often use MIDI samples for button-click sounds and other effects.

MIDI also has other, nonmusical uses as well—technicians have even used it to control the lighting during stage shows … you know, analog multimedia.

Playing Audio

Digital audio is not much use if you can't hear it, but fortunately there are plenty of ways to play digital audio on your Mac. Once again, QuickTime Player is your friend: It can play many of the formats apt to end up on your Mac, including streaming versions. And as we've seen earlier in this chapter, players for both RealAudio and Windows Media are available for your Mac as well.

Keep your installers. RealPlayer and Windows Media Player can both play some of the same formats QuickTime can, and installing either of these packages will often reassign those media formats to the new player; the file that launched QuickTime yesterday may suddenly launch RealPlayer today. Though a polite installer will ask if you want to reassign the file types, not all installers are polite. To make sure QuickTime will continue to play the files you want it to, you may need to reinstall QuickTime after installing RealPlayer or Windows Media.


In the last year or two, the MP3 format has rocketed to stardom and MP3 players have proliferated wildly. The various MP3 players have their vociferous fans and detractors, and the available offerings are changing very rapidly. Aside from Apple's QuickTime Player (which can play MP3s) and iTunes (which can play them, encode them, catalog them, and give you a dandy light show), currently popular MP3 players include Casady & Greene's SoundJam MP (Plus version $39.95; also comes as freeware; www.soundjam.com), Panic's Audion 2 player and encoder ($32.95; www.panic.com/audion/), and the Macast multimedia player, which can play MP3s and many other formats ($24.95 for the full version, also available as freeware; www.macast.com).

Editing Audio

If you plan to use digital audio in a multimedia project, chances are you'll need to edit the sound at some point.

If you simply need to trim a sound file or splice two sounds together, all you really require is QuickTime Player Pro. The editing commands are very similar to what you'll find in a word processor: Position the slider where you want to start (or end), shift-click to select a range, and then choose Cut, Copy, or Clear from the Edit menu. You can paste a sound from one file to another by simply cutting or copying it from the source, selecting the location in the destination file, and choosing Paste from the Edit menu.

However, QuickTime Player Pro doesn't have the editing chops for detailed work, and you'll want to use a more full-featured audio editor on these projects. Such editors will let you mix multiple tracks, filter sounds, add audio effects, and edit sounds down to a fraction of a second. Two previously mentioned shareware products, Felt Tip Sound Studio and Amadeus II, can take you quite a bit further than QuickTime Player Pro for very little cost.

QuickTime files can point to other files. That is, when you copy media from one file to another in QuickTime Player Pro, all you are really copying is a reference to the sound's location in the first file. You'll need to have both files on your disk to play the edited piece. (This is actually very useful while you are working on a project because it saves a lot of disk space and processing time while you experiment with different versions.) If you want your edited sound to end up in one file, save the file as self-contained: From the File menu, choose Save As and click the “Save as self-contained” button in the file dialog box.


The tools that professional sound editors use usually come in a complete package that includes audio hardware, such as Digidesign's previously discussed suite of products. If you want to experience Digidesign's audio-editing approach, try a free reduced version of the Pro Tools editing software (http://download.cnet.com/downloads/0-10216-100-3296394.html), which can handle eight separate audio tracks (as well as 48 MIDI tracks). For a professional-quality editor that falls between the shareware and freeware offerings and the really big-ticket suites, you might consider Bias's Bias Deck VST ($399; www.bias-inc.com), which lets you edit as many as 999 tracks and play back 64 of them simultaneously.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.217.134