Home
Contact
Links
Lyrics
Tablature
Thoughts
Visual Basic
Web Design
What's New
Site Map
Site Designed By
J.T.S. DESIGN, INC.
Jeff T.S.'s Homepage

Web Design

IV. Sounds

Introduction
Sounds can be used to enhance your webpage just as images can. But, as with images, you should be aware of how large the sound file is. You'll want good quality sound but small file sizes. Even with small files, there will most likely be a delay due to the download time.

There are 2 types of sound files that you can use. These file types are the wave (.wav) and the midi (.mid).

^^-Return to Top-^^

The <bgsound> Tag
There are two tags that you can use to add sound to your webpage. Both tags are very similar to the <img> tag. The first is the <bgsound> tag. This tag is the better of the two tags I will discuss but it has one major drawback -- it can only be used in Internet Explorer. This tag can only be used within the <head> tag.

Here is how you would use the <bgsound> tag:

<bgsound src="mysound.wav">

or

<bgsound src="mysound.mid">

With the <bgsound> tag, you can make your sounds loop. Looping basically means that when the sound ends, it will start back over again at the beginning. To loop a sound, you would use the loop attribute.

Here is how you would do it:

<bgsound src="mysound.wav" loop="3">

The above example would cause the sound to loop, or play, 3 continous times and then it would stop. You can also have the sound loop continously by using the value "-1".

There are two other attributes that can be used with the <bgsound> tag. The balance attribute directs how the sound is divided between the left and right speakers. The value for this attribute is any number between -10,000 and +10,000. A negative value will boost the sound coming out of the left speaker while a positive value boosts the right side. A value of 0 means that the sound will be equally balanced when it comes out of the speakers which is the default value.

Here is how to use the balance attribute:

Left Speaker Boost

<bgsound src="mysound.wav" balance="-3500">

Right Speaker Boost

<bgsound src="mysound.wav" balance="+5000">

The other attribute that can be used is the volume attribute. This attribute defines how loud the sound will be relative to the volume that the user has set on their computer. The maximum volume is 0 and it is only as loud as the volume set in the users sound settings. Adjustments to sound are negative values as low as -10,000.

Here is how you would use the volume attribute:

<bgsound src="mysound.wav" volume="-100">

It should be noted that most users will lose the sound at a value that is much higher than -10,000.

^^-Return to Top-^^

The <embed> Tag
The other tag that can be used is the <embed> tag. This tag is accepted by both Internet Explorer and Netscape Navigator.

This is how you would use this tag:

<embed src="mysound.wav">

Unfortunately, there isn't an attribute to loop the sound while using the <embed> tag.