Audio on the Web
Part of How Do They Do That With HTML? by Carl Tashian

"la la la la la la la la la, la la la la la la la la la la la la la la la la la, la la la la, la la la, la la la la la la la la la la" -Bob Dylan, The Man in Me

Background Sounds and Music

Do you like to shock and annoy people? If so, background sounds and MIDI music are just the thing for your web page.

Seriously, though, I have to say a word on etiquette before I proceed with instructions for background sounds. First of all, most people like to browse the web in silence. They don't want to hear any music, they don't want to hear any strange sound effects or disco beats, and they get annoyed when they do. Why not? Well, the web isn't traditionally an aural experience, and people aren't expecting sound to come out of web pages.

But someone has to break new ground, right? And background sound can be tactfully done. The right sound in the right place can be great. A sound that relates to a visual element of the page can work wonders. It's unfortunate that most sites don't seem to get this right, but perhaps you can help change this trend.

Who is doing it right, anyway? In my opinion, the web design firm Second Story is, as always, right on the money. They incorporate background sound into many of their clients' sites, such as Kodak's Birdcam 2000. Notice how the bird's chirps don't repeat much as you read through the page. The sound is very subtle, not pestering. Keep this in mind when you start thinking about adding repeated chalkboard scratching sounds to your page, and you'll be much less likely to offend the audience.

Now, on to the details.

How to do it:

There a few ways to set up background sounds (.WAV files) and music (.MID files) on a page, but I'm going to tell you about only one of them, because it's all you'll really need.

If you've read about the <BGSOUND> or <OBJECT> tags, forget what they told you. These tags aren't compatible with Netscape (which alienates a lot of your audience), and they're either too simple (like <BGSOUND>) or too complicated (like <OBJECT>) to be useful.

For background sound and music, all you need is one simple tag: <EMBED>. Though it's not standard HTML, it is supported by most web browsers right now. The quick and easy format for a background sound is this:

<EMBED SRC="sound_filename.wav" WIDTH=1 HEIGHT=1 HIDDEN="true" AUTOSTART="true" LOOP="false"></EMBED>

That's it. Put that in your page, and change "sound_filename.wav" to the name of the sound file (WAV, AU, or AIFF format) you want to play. You can also say <LOOP="true">, if you want your sound to loop forever. The <EMBED> tag actually supports MIDI files, QuickTime movies, and AVI movies, among other things. But that's a different story...

How the cool people are doing background sounds:

The cool people are using Flash to play background sounds. They use the <OBJECT> and <EMBED> tags to embed a Flash movie that only contains sound. This is cool because Flash compresses sounds very well, while WAV files are not compressed. Flash also has more options for playback and looping. The downside: you have to buy Flash ($400) to do it, and your listeners have to have the Flash player (a free download) to play back your sound. Since I don't own or use Flash myself (I'm not that cool or rich), I won't get into the details of it here.

Playing longer sounds:

There's no perfect solution for longer (>30 second) background sounds yet. You've got a couple options, and neither of them work in the "background" of a page. But if you just want to get your sounds out there, here's what you can do:

MP3 it.

I love MP3s. Yes, they've gotten a lot of bad press for pirated music, but I think they are one of the greatest inventions of the last decade. I'll spare you the details of how they work, but lets leave it at this: if you're looking to publish long high quality sound, MP3s can be your savior. Music retailers like CDNow give away 30 second samples, often in MP3 (they call it "MPEG") format. They sound great, and they have certainly helped me choose what to purchase.

As I said before, you can't embed MP3s on web pages yet. The only thing you can do is provide MP3s for download, with a standard link like this:

Listen to my <A HREF="my_song.mp3">new song</A>!

As with any download, your listeners will have the option of saving the file to their hard drive or playing it immediately in an MP3 player. Oh, by the way, if you need to make MP3 files for your site, look at my page about Web Site Theft Protection , which has a list of MP3 encoder programs.

Use RealAudio or Liquid Audio

RealAudio, Liquid Audio, and other variants are popular because they allow streaming audio on the Web. With streaming audio, people don't have to download a large WAV file before they hear anything. Instead, they hear the sound as they download it. If your goal is to publish really long sounds (anything over 30 seconds), you should consider streaming audio.

Unfortunately, the subtle difference between regular WAV files and streaming audio costs a lot. Here are the downsides:

There's still hope, though. Your Internet provider may already support streaming audio, and if they do, your job will be a lot easier. If the idea still interests you at all, ask your Internet provider for details on their setup.

[ return to front page ]

Reproduction of material from this page without written permission is strictly prohibited
Copyright © 1995-2001 Carl Tashian