Adding sounds to web pages is easy. You can addosounds which play in background or are triggered by links
However one of the best ways to use sound is to embed sound files into the pages gives the viewer control (this we like!!). Like this
Hear me speak ->
Audio is one area where browser incompatibility makes things difficult but the code we've used sorts that largely out. It relies on using HTML code with a tag to embed the file called the <embed> tag.
Lets run through how to add a simple sound file (wav.) as an embed effect.
here's the code for the above example
Just enter it in HTML either of the two methods we've descibed before (remember if you use insert -> HTML tag to seperate add </embed>)
<embed src="test.wav" Tells the browser to embed the following URL (here the relative "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="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 we set width="140" height="60", but play around to see the different effects
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
Example of looped file
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, but we'll mention another tag set of great importance
The second 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 this 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.