Adding Sound Files To Your Web Page
You found a cool new MIDI, or WAV file and you really want it to play on your page, right?
Will the sound enhance the page, or will it drive people away? Just because the sound file is slightly related to the page topic does NOT mean it should go on your page.
That said, let's take a closer look at sound files and how to set them up on your pages:
MIDI versus .WAV files
A MIDI file (a file that ends with the extension .mid) is essentially a small file with instructions that tell your sound card how to play a song. The better your sound card, the better it will sound. All of the actual playing is done on YOUR computer. You cannot 'record' existing sounds with MIDI.
A WAV file (a file that ends with the extension .wav) is a digital recording of a sound or song. It is much like a cassette tape or cdrom. Because there is so much information contained in .wav's these files tend to be HUGE. (Long .wav's can be
anywhere from 500k to 3 MEGS or more!)
Adding A Link To A Sound File
The easiest way to add a sound file to your page is to provide a simple link:
<A HREF="bojangle.mid"> Play Mr. Bojangles</A>
Try it here: Play Mr. Bojangles
When a visitor clicks on this link, the file will be downloaded in it's entirety, and then played on their computer using a sound program (like Windows media player) that the user already has. If a user does not have a sound utility/program installed they will hear nothing.
The <Embed> and <Bgsound> Tags
You can use the Embed tag to have sound automatically play on your page. However, Netscape Navigator and Internet Explorer require two DIFFERENT tags to tell the browser how to handle sound files. You MUST include both tags to get the sound file to play in all formats of both browsers.
The <EMBED> Tag works in Internet Explorer 4.0x, 5.0x, Navigator 3.0x, 4.0x
The <BGSOUND> Tag works in Internet Explorer 3.0x (best used with the NOEMBED tag... see below)
Here is the coding for adding sound files that most every browser can handle:
<EMBED SRC="example.mid" AUTOSTART="TRUE" LOOP="TRUE" WIDTH="145" HEIGHT="60" ALIGN="CENTER">
<BGSOUND SRC="example.mid" LOOP="10">
Copy and Paste this example into your page and replace the "example.mid" with the name of your sound file.
<Embed> Tag Attributes
Enter the name of the sound file you wish to use, like "example.mid" or "example.wav".
Using this attribute will tell the browser to play a sound automatically by entering "TRUE" as the Value. The sound will NOT start automatically if you enter "FALSE" as the Value.
In Netscape, you can tell the browser to play the sound over and over in an endless Loop by entering "TRUE" as the Value. You can tell the browser to play the sound ONCE by entering "FALSE" as the Value. (Internet Explorer does not recognize this attribute. Use PLAYCOUNT= as shown below for IE.)
Entering a number ("2" or "5" etc.) will tell Internet Explorer how many times to play the sound. (Netscape does not recognize this attribute.)
WIDTH= and HEIGHT=
In Netscape, these attributes define the appearance and size of the CONTROL PANEL it creates. (Internet Explorer does not recognize this Tag.)
The smallest Value you should use for these two attributes is:
If you put anything smaller or do not include these two attributes you may encounter trouble getting the control panel to appear properly.
For Internet Explorer, enter "TRUE" as the Value to show a CONTROL PANEL and enter "FALSE" to not show it.
Tells the Browser where to display the CONTROL PANEL. Enter "right", "left", "absmiddle", "top" or "bottom" as your Value.