¤ Tisha Look's HTML Tutorial ¤
How To Add Music

Adding music is another way to put your creative stamp on your website. However, before you go in search of the latest, greatest song, let me first point out a few things:
  • Any music you add to your page has to be downloaded to the computer of the person viewing it. Even though it's hosted somewhere on the internet, it doesn't just magically appear on your website - it has to be downloaded in order to be heard. This is done automatically through the web browser.
  • Large music files (WAVs and MP3s) can cause your page to load slower. Some people - especially those with slower internet connections - may decide to go elsewhere instead of waiting to view your page.
  • Some people find music on web pages annoying, especially since most people don't know how to stop it on their own.
  • There are different codes for different browsers. At this time, the code used to add music so it will play in Mozilla browsers (Netscape, Firefox, etc.) is NOT allowed on Marasites or in Maraclubs.
File Formats: MIDI, MP3 or WAV:
There are numerous different music file formats but MIDIs, MP3s and WAVs are probably the most popular. Another format is AU which I don't know enough about to explain so I won't. There are benefits and drawbacks of each format:
  • MIDI: These are small files so they load quickly. The drawback of MIDIs is that they sound like a Casio keyboard (probably because they use the same format).
  • MP3: Anyone who has ever used an iPod and/or iTunes is familiar with an MP3. It's a way of getting quality sound from a song in about one tenth the space. The drawback of using MP3s as music for your website are that they are still too large. The average full-length MP3 is between 3-4 MBs (megabytes) in size which would take about half an hour to download over a 56K dialup connection.
  • WAV: A WAV file is an excellent format for recording any kind of sound file to your computer. However, WAVs are huge, especially when compared to MP3s. In fact, MP3s are just compressed WAV files. The advantage to WAV files is the clarity of sound. The drawback - and this is a biggie (no pun intended) - is the size. A full-length song in WAV format can be anywhere from 10-40 MBs (megabytes) in size. Not only will it take too long for anyone to hear, it's almost impossible to find anyone to host a file that size. The only exception to using WAV files for your web page is when they are small (as in file size). For example, I once had a cow-themed web page where a WAV file of a cow's moo played once - and only once - when the page first loaded.
Editing Sound Files:
Just as with graphic files, there will be times when you want to modify sound files. In order to do this, you will need some kind of sound editing software. Most versions of Windows come with a program called "Sound Recorder" which will allow you to edit sound files. However, it's extremely limited in its capabilities. A better bet would be to find some freeware/shareware sound editing program and use that instead. Just do an internet search on "sound editing software".

Adding Sound To Your Web Page:
Once you've found your perfect sound file, it's actually pretty easy to add it to your web page. However, there are different tags for different web browsers: BGSOUND and EMBED. BGSOUND is IE-specific - this means it will only work when your page is viewed using Internet Explorer. To make other browsers play your music file, you will need to use the EMBED tag.

PLEASE NOTE: At this time, Marapets does NOT allow the EMBED tag in Marasites or Maraclubs. This means any music you put on your page will ONLY play with Internet Explorer.

Here's the code for using the BGSOUND tag (be sure to replace the "your.url.here" with the actual URL of your sound file):
  • <bgsound src="http://your.url.here" loop="infinite">
Here's the code for using the EMBED tag (be sure to replace the "your.url.here" with the actual URL of your sound file):
  • <embed src="http://your.url.here" hidden="true">
Notes: There is no closing tag for either BGSOUND or EMBED. The "hidden" attribute of the EMBED tag keeps any volume controls from appearing on your web page. The "loop" attribute of the BGSOUND tag is explained below.

To Loop Or Not To Loop:
The term loop is just another way of saying repeat. If you want your sound file to play more than once, set the loop to the number of times you want it to play. If you want it to loop indefinitely, set it to "infinite". Here are some examples:

To Do This: Use This Code:
Play the sound one time <bgsound src="http://your.url.here" loop="1">
Play the sound five times <bgsound src="http://your.url.here" loop="5">
Play the sound indefinitely <bgsound src="http://your.url.here" loop="infinite">