Using Sound In HTML

You find a cool .avi or .wmv and want to add it on your website. The sound enhances the page and it is something on what about the topic. You can have a closer look at the sound files and then set accordingly. Check out the important aspects while using sound in HTML.

MIDI versus the .WAV files.

The MIDI file comes with an extension of .mid, it is actually a small file where you can find instructions about how the sound card will play the song. It is better to install a sound card in your computer as it will help you to run the .wav files. With existing MIDI, you cannot record the sounds. The WAV file is a sort of digital recording of song or sound. It is similar to a CD rom or a cassette tape because much information are contained than the .wav files. When you want to add link to the sound file and one of the easiest ways to add a sound file to the page is:

<a href="bojangle.mid">Play Mr. Bojangles</a>

When a visitor clicks on the link, the file gets downloaded to the entirety and hten it is played in the computer by using the sound program. In case, the user don’t have a utility program installed in their computer they won’t be able to hear anything.

<embed> and <Bgsound> tags

The embed tags can be used for an automatic play on the page. The netscpe navigator and internet explorer requires two different tags for telling the browser on how to handle the files. You can also include both the tags for playing the sound in all types of formats in the browser. <embed> tag works in browsers like Internet explorer 4.0, 5.0 and ion Navigator 3.0 and 4.0. on the other hand, the <bgsound> tagwill work with IE 3.0 and this is supposed to be the best browser which anyone can handle. The syntax for coding for adding sound files is given below:

<embed src="example.mid" autostart="true" loop="true" width="145" height="60" align="center">
        <bgsound src="example.mid" loop="10">

<Embed> Tag Attributes

Some of the well known tag attributes of embedding sound files in HTML, can be the following.

  • src: You can enter the name of the sound file and can use with “example.wav” or “example.mid”
  • autostart: This attribute will indicate the browser for playing the sound automatically by entering the code “TRUE” represented as value. The sound may not start automatically but if you enter the “FALSE” it will also be considered as a value.
  • loop:In Netscape you can tell the browser for playing the sound repeatedly in an endless loop and that can be done by entering the “TRUE” as the value. You can also enter the code “FALSE” as the value for using it as a Playcount.
  • playcount: in playcount, you will enter a number and the internet explorer knows about how to play the sound.
  • width and height: in the netscape there are attributes defines the appearance and the size of the control panel that it creates.