HTML Basix - HTML tutorials and online webmaster tools

Htaccess code generators Code generators Tutorials

Subscribe to RSS feed
Subscribe to the HTML Basix RSS feed.

Putting Sound on a Webpage

This page will take you through what is required to put some sound on your webpage. It's a simple process, I don't think you'll have too much trouble with it!

Auto Play
When you opened up this page, you should have heard 'Imagine' by John Lennon playing. The code was 'embedded' into the page, and can either be set to play continuously or just once. I have set this code to once for this page.

You can't see the controls for the background sound - so think twice before you set it to play endlessly, as you could drive people batty! <BGSOUND src="/images/ImagineCut.wav">

Manual Play
I have set the music below to 'show' and not to autostart. This allows visitors to your website to control the sound if they wish. It can be set to autostart, and the visitor can stop the sound if they choose to. The controls below have been set into a table with a black border.

  • use sound files with a .wav or .midi extension
  • try to keep your file under 100kb if you've set it as a background sound - it can take too long to download for some people
  • play with the width and height attributes of the controls display - different dimensions will produce more/less of the player
  • auto play runs the file when the page is opened. Set to 'no' if you wish your visitors to click the button to start the sound file
  • continuous plays the sound non-stop - choose once to only play once then stop
  • 'hide controls' doesn't show the sound player on the page - choose 'yes' if you want your visitors to control start/stop
  • 'url to sound file' - this can be an 'absolute' link (starting with http) or a relative link to where your sound file is located. Enter the full url if you're not sure on what you're doing
  • if you choose the controls to be 'hidden', an extra tag is provided to make sure all browsers can play the sound
  • if you want sound to play automatically on opening the page, the code goes into the head section of the page. If you want your visitor to control the sound - place the code where you want the player to show.

try these: Want some cool song clips for your webpage? Try Pammy's Wavs!

sound details
auto play:
hide controls:
url to sound file:

Results will open in a new window

Site Stats     
Total: 9,768,793 Total: 28,332,441
Today: 242 Today: 622
Yesterday: 238 Yesterday: 618
Past Month: 7,378 Past Month: 19,158

273 visitors in the last 24 hours
This page has been visited 245,144 times
There are currently 3 visitors online
click to see where
most people online at once:
286 visitors on 06/27/2012
   You beaut

This site is © HTML Basix 2003 - 2009