WEB AND COMPUTER INFORMATION

Background music or sound on a web page








There are times when you would like to have some music or a sound file play on a web page when it starts.

A nice introductory audio file of a voice speaking about the web page at hand is a nice touch.

It can also be an irritating thing to shock someone with a loud explosion of sound when they are web surfing in the quiet of the night and then you wake up the wife and the kids and the dog and the neighbors.

So keep the volume of the initial recording low if you can control that when you record your audio.






Here is the html. Code

>

There is a nice bit of code that you can insert into the body.

Copy and paste the code that is in the box but not the box itself.

Place it somewhere in the source code between the tags <body> and </body> to do the job.

This will play the music once. Be sure to replace your_music.wav with your sound file.

Be sure to put the sound file in the same folder as the web page.

You can also use an MP3 or midi file and possibly other audio files as well.

To get it to play in a loop (continuously) edit this change to the top line of the code autostart="true" loop="true"

To hear the audio file again, you can just refresh the page.



<embed src="your_music.wav" hidden="true" autostart="true">
</embed>
<noembed>
<bgsound src="your_music.wav">
</noembed>







Roger Chartier       Disclaimer - Privacy Policy The Author - Roger Chartier

Search