to home page


Embedded Sounds
  


Adding Embedded
or 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

 

 

 


The easiest way of adding sound to a web page is by using links. However many choose to add music or sounds automatically within the web page.

This an be a bit fraught sadly due to conflicting standards & browser differences. Here's our guide to it

There are 3 competing tags you need to know about

<embed>
<bgsound>
<object>


The <embed> tag is historically the oldest and still works on netscape and some other browser. Using allows you to simply embed sound files into the pages like graphics. Sadly newer verions of internet explorer browsers run into trouble with it.

Hear me speak ->

(sorry to some internet explorer users. It won't work)

Here's the code for the above example

<embed src="test.wav" autostart="false"
width="140" height="60" loop="false">
</embed>

Lets break that down by each attribute

<embed src="test.wav"
Tells the browser to embed the following URL (here the relative URL "test.wav" - you could use an absolute URL )

autostart="false"
Tells the browser not to automatically play the sound file (the autoplay value is "true"). If this is set at "false" you'll need to display the controls to allow users to turn on the sound effects- see below). Values are true or false.

width="140" height="60"
Determine the size of the sound controls. Here 140 x 60 pixels

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

Now if you make it really small you can hide the player

Here the sound is coded by

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

Okay.

Now those of using browsers like the latest version of internet explorer will be get a bit fed up as nothing is happening.

They have a handy <bgsound> tag

Again the tag does exactly what the name say

The essentials of the example below are coded by

<bgsound src="test.wav" loop=infinite>

loop serves the same function as you get with <embed>.

The final tag is the <object> tag

This is a jack of all trades tag designed to be the key tag for multimedia elements (you can even add images with it). In HTML 4 it was brought in to replace multimedia tags like <embed> and <applet>.

Guess what ? browser support is very poor

 

Here's the code

<object classid="../grapix/test.wav"
type="audio/wav" width="100" height="20">
<param name="controls" value="console" valuetype="data">
<param name="autostart" value="yes" valuetype="data">
</object>

Looks not unlike the <applet> tag, doesn't it?

Essentially the object tag defines the embedded "object" located at the classid. The type tag just defines the media type (n.b. some would suggest using audio/x-wav instead). Just as with the <applet> tag the <param> tags define the parameters for that object

 

Making Links to Open Sound FilesLinks to open sound filesSounds MainBackgrouind soundsBackground sounds
  Sounds Main Menu  

 

 

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