to home page


Background
  


Adding Background Sounds

HOME
TUTORIALS
LINKS
FORUM
GLOSSARY
NEWS/ABOUT

 

THIS AREA

HTML
Using an editor
HTML Basics

Intermediate HTML
Tables
Lists

Sounds
  Main
  File Types
  Delivery
  Recording
  Link to Sound
  Embedding sound
  Background

Video
More Links
Frames
Style Sheets
Updating

Advanced HTML
HTML Hints
Reference Library
HTML Reviews

 

BWRS
SEARCH

 

 

 


Background sounds or music are extensively used on the web. Ranging from simple intro effects as you heard here to music played in the background. Remember sound files can occupy a large amount of space

The principles are essentially the same as creating an embedded sound files into the pages which we've dealt with already

Lets run through how to add a simple sound file (wav.) as background effect.

Lets begin with setting up a background sound as it is essentially the same technique as creating an embedded file. Click below to hear an example

 

Okay so we didn't use a particularly wonderful sound file but it's a good example

Audio is one area where browser incompatibility makes things different but the code we've used sorts that largely out. It relies on using the <embed> tag.

Here it is.

<embed src="test.wav" autostart="true"
width="10" height="1" loop="false">
</embed>

lets break that down by each attribute

<embed src="test.wav"
Tells the browser to embed the sound file called "test.wav" in the document (you could use an absolute or relative URL to a sound file if you wish just like a graphic)

autostart="true"
Tells the browser to automatically play the sound file (if not you'll need to display the controls to allow users to do so- see below). Values are true or false.

width="10" height="1"
are used here to hide other sound controls. Making the size of the controls 10 x 1 will work for both Explore and navigator (this gives a balance between lalmost being invisable and actually working using 0 Obviously you'd give the sizes bigger value if you wanted to give your viewer some control. The command hidden="yes" can also be used but browser support varies.

loop="false"
Tell the browser not to repeat (loop) the file. Is set at true or infinite will run add nauseam or you can assign a value. Note it appears you must have some of the sound control unit present for this to work (e.g. try setting width and height at "10") with navigator

Back to top

Okay. Now that will allow you to have background sounds that run on both main browsers.

However there are other ways of doing this. The problem is audio use is the biggest area browser incompatibility.

Internet explorer users can enjoy back ground sound through the very handy <bgsound> tag

The essentials of the example below are coded by
<bgsound src="test.wav" loop=infinite>

It is a wonderful does exactly what the name says tag which cuts out several attributes. Sadly not yet supported by Netscape (last tried v4.7)

Another is the use of a tag called <object>. This is a jack of all trades tag and allows you to use many items called objects on a web page which include things like sound video and will eventually replace the <embed> (and the<applet> tag)

Guess what ? It doesn't work as yet for Internet Explorer!!

We've mentioned these 2 primarily for the future. Some advocate the use of multiple tags to cover all eventualities but you run the risk of getting numerously simultaneous file run interfering with each other. The embed tag is a pretty safe way of doing things and although will be depreciated will be usable for some time after that even on the latest browser

As a rule, we don't like background sounds for rather obvious reasons.

We find intro sounds a bit gimmicky and really detest background music. You really might enjoy your rendition of Vivaldi on a stylophone. But not everyone else will, especially if its stuck on a permanent loop, so put a set of on-off controls or you might find your hit count dropping.Back to top


Embedded SoundsEmbedded Sound FilesSounds Mainstreaming mediaStreaming Media
  Sounds Main Menu  

terms & conditions copyright © 1999-2003 legal notices
home
credits
contact us link to us