Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This

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:

  1. In the Document window, select the text or image that you want to make into the link.

    Figure 4

    Type the location of the sound file in the Propertires inspecto's Link text box.

  2. In the Properties inspector, type the pathname for the sound file in the Link text box (Figure 4).

    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.

    Figure 5

    Select the sound file in the Insert File dialog box.

  3. 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.

Figure 6

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:

  1. View the document you want to attach the sound file to in the Document window.

  2. 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.

  3. 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).

  4. 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.

  5. Save your changes to the page (Figures 7 and 8).

    Figure 7

    The code for a standard, non-visible Netscape controller (top), and for a standard visible controller.

    Figure 8

    This is the same page we saw in Figure 7. Note that the hidden controller is not displayed at all in the Document window.

  6. Preview the page in a browser to make sure it works.

 Tip

  • 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.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.