How do I put background music on my web page?
It’s fairly simple to add background music to your web page but first you have to consider your visitors. Never put a sound that plays automatically in the background with no option for the user to turn it off. In fact, it would probably be best to give your visitors the choice of turning on the music only if they want to hear it.
The <EMBED> tag is the most common way of adding sound to a Web page. Its advantage over the <BGSOUND> tag is that it is supported by both browsers, and more consistently across the PC and Mac platforms. The <EMBED> tag introduces many features that aren’t supported by <BGSOUND>. Furthermore, while the <BGSOUND> tag only supports background sounds, the <EMBED> tag also features an interactive interface (including various buttons to play, stop, and handle the sound). Let’s take a look at the <EMBED> tag in action
(requires a sound-enabled browser)
The HTML code that generates a control panel is very simple:
This code:
<EMBED height="20" SRC="http://www.partnersinrhyme.com/indexmidis/BLUES.MID" VOLUME="50" loop="true" controls="console" AUTOSTART="FALSE" width="128">
Will produce this console:
This version uses a WAV file instead of a midi:
<EMBED height="20" SRC="http://www.sound-effect.com/sounds/loops2/SweetDreams.WAV" VOLUME="50" loop="true" controls="console" AUTOSTART="FALSE" width="128">
If you find a sound you like somewhere on the web and decide you want to use it on your web page make sure you download the file to your hard drive then upload it to your own server. Do not under any circumstances link directly to the server you found the file on. Hot linking to someone else’s server is considered bandwidth theft and is against the law.
The attribute, "autostart=true," specifies whether the file should start playing automatically after it loads. If autostart is set to "false," then the file will load into the sound player utility but the user will have to click on the "play" button of the sound player utility in order to start the playing of the sound file.
The LOOP attribute tells the browser how many times you want the the sound to repeat. If you added LOOP="10" to the <BGSOUND> tag, the sound would play 10 times and then stop LOOP="TRUE" will play the loop until the user stops it.
If you need more music loops you can always download free royalty-free music loops here.
If you find a sound you like somewhere on the web and decide you want to use it on your web page make sure you download the file to your hard drive then upload it to your own server. Do not under any circumstances link directly to the server you found the file on. Hot linking to someone else’s server is considered bandwidth theft and is against the law.
The attribute, “autostart=true,” specifies whether the file should start playing automatically after it loads. If autostart is set to “false,” then the file will load into the sound player utility but the user will have to click on the “play” button of the sound player utility in order to start the playing of the sound file.
The LOOP attribute tells the browser how many times you want the the sound to repeat. If you added LOOP=”10″ to the tag, the sound would play 10 times and then stop LOOP=”TRUE” will play the loop until the user stops it.
If you need more music loops you can always download free royalty-free music loops here.