Adding music to webpages is a subject that quite a few of our students have asked about, so I've decided to put up this page for information purposes.
Before we get into this, think about all the webpages you have visited. What do you think makes the best pages? What elements are included? What makes a particular page appealing to you, and is it univerally appealing? At the moment, I cannot think of any major webpage that uses music, and there is a reason for that.
The first issue that we will address is personal taste. Many people, myself included, do not like hearing music, midis in particular, on pages that we visit. Some people love midis; others, like myself, think they belong in the trash along with rap and heavy metal. There are very few instances where it's really necessary to include sounds on your webpages. If you do want to include sounds or music, PLEASE give your readers the option of turning them off. I've seen too many wonderful websites that have been ruined, in my opinion, by the addition of music, especially the ones that didn't allow me to turn it off.
On the internet, you will find 4 different types of sounds, with 3 sounding very much alike.
Now that you know the types of sound files that you can use on your page, the question remains, "HOW?"
It's actually very easy to do. Your first step, of course, is to upload the file from your own hard drive to your file manager. There are 2 codes in html that you can use, both of which are browser specific. Netscape uses the embed tag, while Internet Explorer uses the background sound source tag. Older tutorials on html will tell you to include both tags to ensure that the 2 major browsers will be able to handle your sounds. However, Internet Explorer now recognizes the embed tag.
Most of the average Internet users have only one sound player, the one that was built into their system. Many have downloaded RealPlayer as well, as many sites use streaming media which has been created in RealAudio format (.ra or .ram). Then there are other people, like me, who use several players, all for different purposes. I have found that when you have more than one player, if you use both the embed tag and the background sound tag, the music may load twice, at differing intervals. It sounds something like a round (Row, Row, Row Your Boat or Frere Jacque) performed very badly. I've had this happen to me on many different sites and to many other people that I know of, as well.
The code that I use is <embed src="nameofyourfile">. For the sound to play automatically when the page loads, with no option to turn off the sound, you want to include a couple of other attributes. <embed src="nameofyourfile" autostart="true" hidden="true"> To include a way to turn off the sound, insert dimensions: <embed src="nameofyourfile" autostart="true" hidden="false" width="145" height="30">. Within that tag, you can also tell it to loop (repeat) by including loop="true". Make sure you include </embed> at the end of the code as it's a tag set.
If you have some reason that you only want the sound to be played in Internet Explorer, the code is <bgsound src="nameofyourfile" loop="number of times you want it played">. It is my opinion that the best way to use sounds is to give your readers a choice from the very beginning. Instead of forcing them to listen or to shut off the sound once it starts, you can make the sound a link, just as you would link to anything else. To listen to my music, click here. If this were an active link (it's not) it would result in the opening of a small download window. Your readers can choose to open the file from the present location, in which case it's only temporary, or they can save the file to disk.
You have another option that works instead of using html code. You can use a java applet found at: Java Midi Player. This works in other formats besides midi.
If you have a sound or music file that you want to use but it's not in the correct format, you will have to convert it. The program that I use is called Goldwave, a shareware program, which is available at GoldWave. Midis can't be converted without special, expensive software.
There is something that you should be aware of. At any given web host, you are limited as to the amount of file space. Some offer a lot, and others offer very little. Adding music files in formats other than midi will eat up that space much faster than you realize. Don't use music on your page just because you think it's cute, or that it will add to the value of your page, or just to prove that you know how to do it. Get the opinions of your friends, classmates, or total strangers in a chat room or discussion board. Hopefully you will see that you really don't need it.