Adding Sound to Web Pages
Required Browser Extensions
Data may be stored in various specialized forms which are not
supported by basic HTML.
A browser can display these data files by using software called
plug-ins. Plug-ins are small programs that extend the capabilities of a
Web browser by enabling the browser to interperet and display various
types of data files.
Your browser may have been installed with some plug-ins.
In Netscape, if you click on Help>About Plug-Ins you can find
a list of the plug-ins that you have installed.
Sometimes, if you load a file that requires a plug-in, the browser will display
a message informing you that the file requires the plug-in and asking whether
it should download and install the plug-in for you.
Sound files are stored in different formats. In order to interpret and
play an
audio file,
your browser must have access to the appropriate plug-in.
(Different plug-ins are required for different audio formats.)
HTML tags for including audio files
Several HTML tags can be used to embed audio files in a Web page. Some
tags work only under certain browsers.
The most commonly supported tag is the <EMBED> tag.
The format is:
<EMBED SRC="url" VOLUME=50 HEIGHT=60 WIDTH=144>
("url" should be replaced with an actual path to a file.)
This will generate a control panel on the web page.
You will find that the control panel looks different under different browsers.
If you include the parameter "AUTOSTART=FALSE" (see below),
the file will not play automatically, but the viewer can play the file
by clicking on the play button on the console.
<EMBED SRC="url" AUTOSTART="FALSE" VOLUME=50 HEIGHT=60 WIDTH=144>
You can add "LOOP=TRUE" which will continuously repeat playing the audio file.
You can also add "HIDDEN=TRUE" which will hide the control panel so that
it does not display -- but that can be very annoying to the viewers!
Here are several examples of Web pages with an embedded audio file,
showing the effects of the different settings in the EMBED tag.
You can view the page source to see
how it is done.
- Example 1 - simple example, music plays automatically.
- Example 2 - same example, with AUTOSTART=FALSE,
so you have to click on the play button to start the music.
- Example 3 - music is played in a loop
- Example 4 -
music plays in a loop; console is hidden.
Ths site that provided the audio file used here is no longer alive, but
you can try Hamienet for a library of
other free sound files. (They're partially supported by advertising, so
after you inspect a few files they'll try to make you visit some
advertiser, but you can just ignore it.)