Creating a Web Page VIII: Sound

0 Conversations

Please refer to previous entries in the "Creating a Web Page" series:

Be advised...

It is possible to add sound to a web page. Many web development sources discourage it because when it works it’s often irritating to your visitors, and when it doesn’t work it’s even more irritating because it can cause error messages or problems when loading the page. There are ways to cut down on the irritation, as you’ll see below.

The three ways of adding sound to a page are the BGSOUND tag, the EMBED tag, and as a link.

BGSOUND

This one only works in Microsoft Internet Explorer 2.0 and above. The tag is located within the HEAD tag, along with TITLE and any META tags you choose to put in.

<HEAD>
...other tags...
<BGSOUND SRC=” “ LOOP= “ “ VOLUME=” “ BALANCE= “ “>
</HEAD>
  • SRC :
  • "Source", the filename of the sound file and the path to it if it’s not in the same directory or folder as your HTML file. This tag supports .wav, .au, and .mid files.

  • LOOP :
  • ...is the number of times you want the piece to be played. Setting it to -1 or INFINITE will make it play without stopping.

  • VOLUME :
  • -10000 is mute and 0 is full volume.

  • BALANCE :
  • This determines which speaker the sound comes out of more. It can be set to -10000 (all left), 0 (equal amounts out of each side), or 10000 (all right).

EMBED

This tag works with Netscape Navigator 2.0 and above, and IE 3.0 and above.

<EMBED SRC=" " HIDDEN=" " WIDTH=" " HEIGHT=" " AUTOSTART=" " LOOP=" " CONTROLS=CONSOLE>
  • SRC :
  • This is where you tell it the filename and path to the file if the sound file is not in the same place as the HTML file.

  • HIDDEN :
  • ... can be either "true" or "false". It determines whether or not you want to display a control panel that allows the visitor to play, stop, and control the volume of the music. If you’re going to use sound on your page, this attribute is highly recommended. If hidden=”false”, you’ll need to also specify the width and height of the control panel. Width of 144 and height of 74 is standard but you can set it however you wish.

  • AUTOSTART :
  • ... means whether or not the sound starts automatically when the page loads.

  • LOOP :
  • "True" mean it will play continously, "false" will make it play once then stop, or you can enter the number of times you want the sound to play before stopping (3, 4, 5, etc).

  • CONTROLS=CONSOLE
  • To be honest, I'm not fully sure why that has to be in there. Perhaps there are other kinds of controls besides the console setup with the little "play", "pause", and "stop" buttons.

This supports tag supports .wav, .aiff, .au, and .mid files.

Links

The less known way of including sound is to turn it into a link. A small download window will appear and your visitor can choose to listen to it from the site or download it to their computer and save it. This way is arguably the least intrusive method of the three for incorporating sound into your site, since visitors can decide for themselves whether or not to listen to it even once.

<A HREF=”soundfile”>Click here to listen</A>


Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A670853

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more