Q: I'm embedding sound into some pages. What audio format is best for compression and playback on most browsers?
A: When you say you're embedding sound, I assume you're using the <embed> tag, and not a helper application like RealAudio or a plug-in like Shockwave, so I won't talk about either of those in this column.
As you may know, there's a zoo of audio file formats out there, and Web browsers can only read a few of them. That means you need to make sure you have the right MIME type (Multipurpose Internet Mail Extensions). MIME types allow us to exchange different kinds of data files on the Internet. Audio, video, and image files fall into this category, as well as application programs and pretty much anything else you might come across on the Web that isn't plain ol' ASCII text.
Netscape's LiveAudio plug-in, which comes bundled with Navigator 3.0, will read WAV, AU, MIDI, and AIFF MIME types. Internet Explorer 3.0 has an audio player built into its architecture that supports AU, SND, WAV, AIFF, AIF, and AIFC files.
|MIME types supported |
||Netscape 3.0||I.E. 3.0
So, you're fairly safe if you use WAV, AIFF, or AU. Although AIFF used to be the standard, these days I recommend the WAV format, because sometimes IE 3.0 chokes on AIFF. You can use Sun's AU format if you want to, but realize that it only supports 8-bit sound, which is pretty horrible.
Remember that sound files are very large and take so long to download that if you're going to use embedded, nonstreaming audio, you'd better compress the hell out of it. The best way to make sure your audio is cross-platform may be not to embed your sound at all. If you can, using a helper app like RealAudio or Shockwave may be a better way to go. You can stream the audio using either, and both players are pretty ubiquitous these days. If you're interested in learning more about either, check out Shvatz's Shockwave Demo or my piece on putting together sound for RealAudio.