Choosing Whether to Use Sound on Your Web Pages - dummies

Choosing Whether to Use Sound on Your Web Pages

By Bud E. Smith

Many people want to have a soundtrack or mood music on their Web sites. Sounds can make using the site more pleasant and contribute to its personality. Ideally, the user would be able to easily turn the sound on or off; most users would probably prefer being offered this choice before any sound started.

Unfortunately, using sound is complicated. You can put a sound file in a Web page but not a Web site. So you can indeed start a sound playing on a given page of your site. But when the user leaves that page for the next one, sound stops.

On serving the next page, you can play a new sound file — or the same sound file again — but it won’t pick up seamlessly. And giving the user a choice before the sound starts playing requires JavaScript or other more advanced Web technologies. Alas, the goal of having background music play as the user visits your Web site is surprisingly difficult.

Using sound on a Web page is easier on any specific type and version of a Web browser, but not easy across different types of Web browsers and different versions. The accepted HTML coding for this capability has changed over the last several years. It used to be that the embed HTML command could, well, embed any kind of multimedia file in a Web site. But it never became an official standard, so Microsoft stopped supporting it, supporting the bgsound (background sound) command instead.

Unfortunately, the JavaScript code that could help you has compatibility problems across early browsers as well. If you made any mistake at all, or are just unlucky, sound would either not play, or the same sound would play twice, with the two instances of the sound slightly out of synch with each other!

Because of all this complexity, few Web sites embed sounds in Web pages. Because it’s rarely needed, some users haven’t downloaded the software needed to play back sounds from within Web pages. So if you go to the effort, and make it work, you may still be asking the user to go through a difficult and time-consuming program download just to play a background sound in your Web page.

So, believe it or not, there’s no simple, reliable, completely user-acceptable way to make a sound play in your Web page. Except by embedding the sound in a video file or by offering sound files for download.