The Complete HTML Teacher

Adding Music To Your Pages





So you're ready to make your pages sing! Maestro if you please. Well believe it or not it's actually extremely easy to do. In this chapter we will discuss the different varieties of music available and the steps involved to make them work for you.

First things first, what is this form of magic that allows you to hear music over your computer on the internet? Well as most of you have a CD player, the process involved with hearing music from files is very much the same as placing a CD in your drive and pushing play. The music is digitally broken down into a series of 1's and 0's that your computer reads as data then reassembled into what you hear as music. (ya ya ok but I want music not history lessons.)

The first thing that I feel is important to know is the different sound sources available. We will start first with what is commonly known as the .mid or (midi). This is the single most commonly used form of music on the internet for many reasons. The number one reason is file size. The midi file is a sound that starts out digital and ends digital, which means it skips all the steps required for your computer to break it down, reassemble it, and turn it into music. Most of your midi's are recorded in a multi-channel format, giving them a full rich sound, where as a poor sounding midi is a rush job, using 3 to 5 channels of up to 32 available channels. A full length midi song that plays for 4 minutes plus may be only 21k or 21 thousand bytes, which goes back to your earlier html lesson of keeping it small. A full length midi will load in as little as 20 seconds or less.

Next would be the .wav or wave format. Ok now, .wav gives you more flexibility with your music (i.e. the ability to record and listen to full length songs in stereo sound). Basically, the .wav is like a tape recorder for your computer. Warning: I can't stress this enough, .wav files are a way to have your favorite artist, your child's first words, or whatever you might like to record as a computer file. However, the end result is an astoundingly HUGE file. For example, a full length song that is just over three minutes long will end up being around 4.5 million bytes. WOW! Hmmm, lets see, can you say 15 minutes plus load time? I don't want to wait that long to hear a single song, and will abandon your web site in a hurry! These two being the most commonly used formats will be the primary topics but there are other formats available for those of you who wish to experiment.

You have learned by now your basic tags required to create your page; I'll give you some example tags to insert music. This is very important; always insert your sound tag as close to the top of your page as you can get it. A computer reads an html page just like you or I read a book, from top to bottom. So by placing your tag at the top, just below your background tag, your file will start loading so that it starts playing while your final graphics files are loading, keeping your visitor interested in your site.

<EMBED SRC= "your.mid" WIDTH=200 HEIGHT=55 AUTOSTART=TRUE><BGSOUND SRC="your.mid" loop=infinite AUTOSTART=TRUE><BR>

This tells the server hosting your page to pull up the file called "your.mid" so that the computer seeing your page can hear it. WARNING: Be careful using this tag, some browsers may not be able to read it. Some browsers assume that the computer viewing your page has a plugin, most likely crescendo. So say Netscape3®™ users would need the plugin, and couldn't hear your music, were as Netscape4®™ or above, can hear your music. The same thing can happen with Internet Explorer®™. Also, Internet Explorer®#153; and Netscape®™ don't always agree on what tag they will read. They rarely agree, that is why you see two different command lines:

<EMBED SRC= "your.mid"> and <BGSOUND SRC="your.mid".> Netscape®™ uses the <EMBED> command, and Internet Explorer®™ uses the <BGSOUND> command.

The next tag I have found may seem like a lot of extras, but I have found it is compatible with the greatest number of browsers.

<EMBED src="your.mid" hidden=true width=200 height=55 autostart=true loop=true><NOEMBED><bgsound src="your.mid" loop=infinite></NOEMBED>

As you can see, they are similar, with the exception of the <NOEMBED> command. This is used so earlier versions of both browsers can hear your music as well.

Altering your tag. (ok lets play around with it have some fun)

The HIDDEN=true command.
Well if you have noticed on some pages with music, a little box pops up with a play and stop button. By installing the HIDDEN=true command, that button does not appear. Most users have no idea that there is music on your page until it starts playing. I use the command for appearance reasons, as I don't want a little box popping up on my page.

Width=200 Height=55
This command controls the size of the box if you don't use the hidden command. That will be the size of your play/stop button.

Autostart=true
This command starts playing your music the second it is loaded. If you choose not to use the autostart command, do not use the hidden command. If the sound is not told to start automatically and its source is hidden, the music cannot be played. Well, I would have to wonder why you put the sound file there in the first place.

Loop=true
This command tells your music that once it has finished to replay automatically. Here is where we get into a difference of opinion between Netscape®™ and Internet Explorer®™ again. That is why you also see the <LOOP=infinite> command. They both say the same thing, but the two different browsers can't seem to agree on a common language.

Another command you can put in, but is not a requirement, is the VOLUME=100 command. This can be any number between 1 and 100, 1 being so low you can't hear it, and 100 being the loudest setting. Now this is a judgment call command, as the end result, is at what volume the computer viewing your page is at. Since most don't surf the net with their volume on full blast, I rarely use this command, except for special circumstances. (smile) I like (not) using the volume command as it is a real wake up call if the user has their volume turned up. I hope this helps you to get started on adding music to your pages.

This article is based on personal experience by the author and in no way reflects the work or opinions of any other source.

Note: Please always be aware of copyright laws. All recorded for retail sale music tapes (CD's ect) are copyrighted. Most midi's you find on resource sites are public domain files, which means anyone can use them. If you are not sure, be sure to ask for permission. It only takes 5 minutes to email a site host for permission to use their material, but it can take years and lots of hard earned money to settle a law suit because you didn't bother to find out if you were using copyrighted material.

This article is ©Copyrighted and used with permission of Dragon's Cache 1998. Please see the banner on page 2.

Do You Need Some Midi's?

Do You Need MORE Midi's?

Ok, I've got music in my webpages life...now what?

Contents



Copyright ©1998 by K. Williams Resources. All Rights Reserved