Working With Sound

Use the EMBED command to embed a sound file and have it play in the background. Upload the sound file to your server as raw data and include the following tag in your HTML document:

AUTOSTART=TRUE LOOP=TRUE>

  • EMBED SRC tells the browser where to find the sound file.
  • HIDDEN=TRUE tells the browser to load the sound file but not to display a sound control panel. If you use the attribute HIDDEN=FALSE, a sound player control panel with play, stop, pause, and volume control buttons will be displayed. Keep in mind, however, that if you choose to display this sound control panel, you must also specify a WIDTH and HEIGHT attribute for the CONSOLE (WIDTH=144 HEIGHT=74 is suggested). Your tag would then look like the following:

    AUTOSTART=FALSE LOOP=FALSE WIDTH=144
    HEIGHT=74 CONTROLS=CONSOLE>

    Just click on the arrow button in the middle of the console below to hear hal.wav:

  • AUTOSTART=TRUE specifies that the sound file will automatically start to play as soon as the file is loaded. If you change the attribute to AUTOSTART=FALSE, the audio will not start to play until the user instructs it to do so.
  • LOOP=TRUE specifies that the sound file will play an infinite number of times. With LOOP=FALSE, the sound file will play only once. LOOP=4 (or any number you choose) will cause the sound file to play 4 times.

Sound files can be uploaded and played in WAV, AIFF, AU, and MIDI format. In addition, you can use the EMBED tag to play QuickTime movies, AVI and VRML files.