Sound Files
Sound files come in more flavors than ice cream. Not all browsers support all sound files, but any browser that supports plug-ins or ActiveX (Navigator or Explorer versions 2 or later) should be able to play most sound files. Navigator 3 or later's pre-installed LiveAudio plug-in plays nearly every common sound file type.
There are two ways to add a sound file to your page. One way is to link to the sound file, so that users download and play it when they click on a link. The other way is to embed the sound file so that it begins to load when the page loads, and a plug-in will play it automatically when the sound file finishes loading.
A sound link is like any other link.
To link to a sound file:
-
In the Document window, select the text or image that you want to make into the link.
Type the location of the sound file in the Propertires inspecto's Link text box.
-
In the Properties inspector, type the pathname for the sound file in the Link text box (Figure 4).
Type the location of the sound file in the Propertires inspecto's Link text box.
Or Click on the folder icon and use the Select File dialog box to choose a sound file from your computer (Figure 5). Be sure to select All Files (*.*) from the Files of type drop-down menu.
Select the sound file in the Insert File dialog box.
-
Press Enter (Return). The selection will be linked to the sound file.
When the user clicks on the link on your page, one of three things will happen:
-
An external program, or "Helper App," will launch to play the sound file (Figure 6)
or
-
The browser will play it using its own capabilities or those of a plug-in; or
-
If the browser doesn't support or recognize the file type, an error will occur. Sometimes a dialog box will open that says "Unrecognized file type," and sometimes the browser will open the file as if it were text.
WinAmp is one kind of helper app that plays sound files.
Embedding a sound file is similar to linking to an image. You can add the <embed> tag by inserting the sound file as plug-in content, or you can add the code by hand.
To embed a sound file:
-
View the document you want to attach the sound file to in the Document window.
-
Click to place the insertion point at the place in the document where you want the sound controller to appear. For invisible sound files, you can place the file anywhere, although at the top or bottom of the document is usually more convenient.
-
View the HTML source for the page in the HTML inspector by selecting Window > HTML from the Document window menu bar (or by pressing F10).
-
For a sound file with no controls showing, type the following line of code:
<embed src="sounds/yoursound.wav" autoplay="TRUE" hidden="TRUE"> </embed>
Where sounds/yoursound.wav is the pathname of the sound file.
-
Save your changes to the page (Figures 7 and 8).
The code for a standard, non-visible Netscape controller (top), and for a standard visible controller.
This is the same page we saw in Figure 7. Note that the hidden controller is not displayed at all in the Document window.
-
Preview the page in a browser to make sure it works.
-
You can embed a sound file with or without the use of the plug-in dialog box. Because Dreamweaver's Insert > Plug-in feature doesn't include all the stuff you need for embedding sounds in a page, I discuss embedded sound and plug-ins as if they were two different entities.