Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Intro to Sound
Your Ad Here

Intro to Sound


To add sounds to a web page... we will use the <EMBED> tag. This tag supports many common file formats... such as .wav, .mid, and .au. Here is the basic structure of the tag:

<embed src="filename.ext" width=x height=x autoplay=x hidden=x loop=x volume=x></embed>

If you want the file to automatically play when the web page is loaded, set autoplay=true, if you do not want the file to automatically start, set autoplay=false. If you want the control box to be hidden, use the hidden=true attribute. Normally the file will stop playing after it is completed the first time, so if you want it to start over once it is done use the attribute loop=true. You can set the volume setting with the volume attribute, a value from 1 to 100 (default is 50). The control box size that plays the sound can vary from browser to browser, but some versions of Netscape won't show the box at all unless you specify. (145 and 60 are usually good)

Example of the embed tag...

<embed src="http://www.webdesignhelper.co.uk/saywhat.wav" loop=false autoplay=false width=145 height=60></embed>



NOTE: Because this embed tag was not set to autoplay=true, you will need to click the play button to play the sound file.

You may use multiple embed tags within one page, but it is recommended to never set more than one on autoplay. It is also not recommended to use .wav or .au files in the embed tag, because they are very large and take a few minutes to download. (.mp3 also falls into the category of "too large to use".)

I hope this came in useful!

Author's URL: davesite
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

HTML is Hyper Text Markup Language that is used to make hypermedia and hypertext documents for the Web. More HTML and CSS: Most Popular Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Add comments to "Intro to Sound"

Only registered users can write comment

No comments yet...