Click here for a free WYSIWYG pixel precision HTML editor.
For the best in D HTML editors
Join the IMS Web Tips weekly newsletter
Email: Name:

Please recommend us to a friend.

Using Audio on your Web Site

Have you ever asked if you should add audio to your web site? If you
have you will have probably got the answers: No! Never! Just don't
do it!

If you have surfed through a lot of web sites you will have probably
been deafened by the silence. When you do come across a web site
with music, a new web-page author has most likely posted it. Visit it
again in a few weeks and the music will have probably gone.

Why is adding music or sound to a Web Page a problem?

There are several problems associated with music over the Internet.

First; music appreciation is very subjective. One person's symphony
is another person's cacophony. Unless your visitors are all the same
age and demographic, odds are pretty good that they will not
appreciate your music selections. Is that Bach or Corn?

Second; many people cruise the net while listening to their own
audio selection. They may have the TV on, be listening to the radio,
have a CD playing music in the computer or be located in an open
office where a sudden blare of sound of any description will not be

Finally, not all audio is created equal. Analogue audio files (Wave,
MP3) are capable of recreating reasonable quality audio but only by
using large files that will increase download time significantly for
many users. Digital Midi files are very compact but the music must
be composed specifically for them. If the visitor has a high quality
sound card configured just right, the sound reproduction may be
acceptable. A second high quality sound card may not reproduce a
Midi file in the same way. Misconfigured sound cards and just about
all low cost cards will sound atrocious when playing midi files.

At best your visitor will turn down the volume on their speaker. At
worst they will beat a hasty retreat and find a less intrusive web site.

So is the common wisdom that you should never use audio on your
web site correct? Those of you that have been reading this newsletter
for very long will know that I am not a big believer in doing things
on the Internet based on what is considered correct or incorrect. The
Internet's great opportunity is its ability to cater to innovation and
new ideas. Common Wisdom can quickly become a euphemism for
outmoded and outdated.

The fact is the Internet is already awash with sound and music. Visit
a CD music site to listen to your favorite music, find an Internet radio
station, listen to a band play their latest compositions or visit a game
site if you really want to be smothered in sound. These sites
however, have very specific reasons for adding audio. Audio is an
integral component to their reason for being.

In general, the majority of web designers should carefully consider
their reasons for wishing to add audio to a web page. Is it for its own
sake or do you have a serious compelling reason. A few reason that I
can think of: web sites designed for small children, sites with some
form of interactive or animated content, sites that contain interactive
content that may benefit from sound effects or sites where the audio
itself is the focus of the web page.

The only example of audio on the Virtual Mechanics web site can be
heard at: P&GWake.htm. If
you have not already checked out this animated joke, have a look and
decide if the sound effects are valid. Unfortunately the audio will
only work with Internet Explorer for reasons discussed below. (I
make no apology for the quality of the joke.)

After having decided that adding audio is valid you will discover
another problem. There is no standard way to add sound to your Web
Site. Internet Explorer uses the <bgsound> tab which is not
supported by Netscape. With Netscape you will have to embed a
plug-in to play the audio. The format is:

<embed src="sound.wav" autostart=true hidden=true loop=0;>
<bgsound id = SoundEffect loop=0 src="sound.wav">


'src' identifies the path or URL of the sound file.
'autostart' will start the audio as soon as the web page loads.
'loop' identifies how many times to play the selection.
'hidden' will display or hide the audio controls.

With Internet Explorer, you can also include an "ID" to identify the
'bgsound' Object in a script file. The reason our example works in
Explorer but not Netscape is because we can use the Object 'id' to
Stop, Start and change the 'src' of the audio file.

When adding sound you should include both tags. It is also a good
idea in most cases to allow your user to turn the sound off unless it is
going to be brief. In Netscape you should make the console visible.
In Internet Explorer you can use a Javascript to disable the audio.

I will discuss the different audio formats in greater detail in a future

"IMS Web Tips" ISSN 1488-7088
© Copyright 2001 Virtual Mechanics

"IMS Web Tips" is a weekly news letter for all web site managers regardless of experience who are looking for detailed information on creating, maintaining and promoting their web sites.

To subscribe send an email to or visit for subscription information and a list of past articles.


If you like the contents of this newsletter, please recommend it to a friend. Not only will you help us to continue to provide you with useful and informative articles, you could also win $10,000. Click here for details.
Home Page | Archive by Date | Archive by Topic | Virtual Mechanics