|Adding Background Music to Web Pages
More and more these days, we find web sites including more and more multimedia, and one of the ways that this is done is through Background Sound. In this article I will show you how to add background sound to your web pages for both Internet Explorer and Netscape Navigator.
Adding Background sound to pages for use in Internet Explorer
Internet Explorer is by far the easiest browser to cater for as far as Background Sound is concerned, as it supports the <BGSOUND> tag. This tag, inserted within the <HEAD> tag of your document will allow you to add a Background Sound effect to any page very easily. The tag is documented as follows:
Specifies how many times a sound or video will loop when activated. Also specifies how many times the marquee should loop.
Specifies the URL of a sound to be played.
The Title attribute is used to provide advisory information.
A typical example of the <BGSOUND> tag would be something like:
<BGSOUND SRC="mysound.wav" LOOP=1 TITLE="My Background Sound">
You can use a sound sample (either .wav or.au) with the <BGSOUND> tag or a MIDI file (.mid). MIDI files have the advantage of being very compact yet providing a large amount of music. However, at present it is not possible to tell how good a MIDI file will sound on a users computer as it is the users sound card which dictates this. A Sound Sample will sound the same on any computer, but is very large in size. You will need to balance the pros and cons of each type of file before choosing.
Adding Background sound to pages for use in Netscape Navigator
With Navigator, life becomes slightly more tricky but not much. Navigator does not support the <BGSOUND> tag, so we have to EMBED a sound instead. The following code is the code I used to simply display a blank page which played the file wonder.mid (in the same directory as the HTML file) in the background:
The key here is the <EMBED> tag which embeds a sound file into the document which is automatically played when the document loads. The two key elements here are the SRC and HIDDEN properties.
SRC, as above with the <BGSOUND> tag specifies the URL of the sound to be played.
HIDDEN tells Netscape whether it should show the user a control panel to control the sound with. If HIDDEN=TRUE then the user will not see any control panel and the sound will play automatically in the background. If HIDDEN=FALSE then the user will see a control panel which they can use to stop and play the sound. Note that if HIDDEN=FALSE then the background sound will not play automatically.
And that concludes this article. I hope that you have found it interesting and useful. Please remember that my inbox is always open and that article suggestions, questions etc. are always welcome. You can e-mail me at Ben@homemail.com.
Copyright 1997, i5ive communications inc.
Please read the Suite 101 Disclaimer.
Broken links, link suggestions and article suggestions to
Benjamin Kitt at Ben@bkitt.demon.co.uk
For help, E-mail Julie Bradshaw at firstname.lastname@example.org.
E-mail bug reports/improvement ideas to Sunny Hirai at email@example.com.