Sound on the Web, Fall 2001

Placing Sound on a Web Page

As discussed in Audio Basics the types of audio files used on the Web are MIDI and digital audio. MIDI files have an MID extension (e.g. peanuts.mid); standard digital audio files an AU (Unix), WAV (PC), or AIF (MAC) extension (e.g. sound.au, sound.wav, sound.aif.) Other formats for MIDI and digital audio can also be used. See Multimedia Delivery Systems for more information.

When placing an audio file on a Web page, there are two options you can use: the HTML <EMBED> tag or you can create a link to the audio file.


Embedding an Audio File

When you use the <EMBED> tag, there are two important options or attributes: Autostart and Hidden. When Autostart is set to "true," the sound plays automatically as the page loads. When Hidden is set to "true," the audio player is not visible. Note: with some HTML editors you may have to hand-code the <EMBED> tag.

Internet Explorer also supports the proprietary <BGSOUND> tag which allows you to place a background sound on a page that plays automatically when the page loads in the viewer's browser. Netscape does not support this HTML tag.

Embedded examples:
Audiostart and Hidden: Digital Audio and MIDI
No Autostart, not Hidden: Digital Audio and MIDI


Linking to an Audio File

To link to an audio file you follow the same procedure used to create a link to a Web page. When the viewer clicks the audio link either the audio player will appear in a new window or the browser will go to a new page containing the player. The action taken by the browser will depend on the plug-in playing the audio file. (More on plug-ins below.)

Linking examples:
Digital Audio and MIDI


Note: <EMBED> and linking can be used with other media too. Another tag, the <OBJECT> tag, is used in place of the <EMBED> tag when embedding ActiveX controls used by Internet Explorer (but not Netscape.) Eventually the <OBJECT> tag may replace <EMBED>.

As with most multimedia files, browsers use plug-ins to play audio files, and most popular browsers come with plug-ins for the standard formats listed above. However, with other formats such as Real Audio, Quicktime, Beatnik, Liquid Audio, MP3 and Flash, viewers may need to install the plug-ins themselves. Keep this in mind when deciding which audio format to use on your Web pages. Will your viewer know how to download and install the plug-in for the format you've chosen?

Also be aware that some plug-ins can handle several standard audio formats and a viewer's browser may not use the same plug-in as the browser you used to test your Web pages. For example, Quicktime, Windows Media Player, Netscape's LiveAudio and Beatnik will all play MIDI files and if you use attributes specific to one of these plug-ins, results may not be what you intended.


Information on the sound files used in examples:
MIDI: 6.71K, 40 secs.
Digital Audio: 30K, 2.7 sec., 11,025 Hz sample rate, 8-bit sample resolution, mono

Information on the sound file used on this page:
Digital Audio: 37.6K, 3.5 sec., 11,025 Hz sample rate, 8-bit sample resolution, mono

Document Weight: 47K. Download time: 9.4 secs on a 56K modem