This shows how to add user selected MIDI or WAV sounds to your page.

An example of incorporating the playing of a MIDI sound/music file in your home page.


camera pic

The MIDI du jour is The Eagles Hotel California (my personal favorite).

This will work with Netscape 3+ and Internet Explorer 3+ browsers.

To add a MIDI play to your page like this, place the MIDI file into your directory and include the HTML shown below, substituting the name of your selection.

When the link is selected, Netscape will download the file (this one is about 74K Bytes) and start it playing. A little pop-up (like the one at the right)will be displayed that allows the viewer to start/stop/pause and adjust the volume (Netscape only) of the selection. This selection will start and play one time.

Note that the selection will keep on playing even though you navigate off the page where you selected the MIDI. When you have had enough, you can close the pop-up. If you want, you can repeat the playing of the selection from that pop-up.

The HTML used to start this selection is:

Hotel California

A viewer can copy your selection to their own PC by right clicking on the link and selecting Save Link As.... If that is your intent, then adding this instruction to your page would be a good idea.

Many home pages automatically start some MIDI selection as soon as the page is loaded. While this seems like a good thing, I personally do not like background selections that Autostart.

First, it requires that you wait until the selection downloads to see the whole page. This can significantly increase the load time for a page.
Second, if you (the viewer) don't have a sound card, two error messages (in Netscape) will pop-up, forcing you to acknowledge that you don't have a sound card.

If you still want to have a background sound, here is an HTML example that will work for all browsers (since Netscape doesn't recognize the BGSOUND tag and Internet Explorer doesn't recognize the EMBED SRC= tag).

If you want simple code without having to worry whether someone is using Netscape or something else, here it is:

<!-- Netscape -->
<EMBED SRC="music.mid" HIDDEN=TRUE AUTOSTART=TRUE>
<NOEMBED> <!-- non Netscape browsers -->
<BGSOUND SRC="music.mid">
</NOEMBED>

Specifying HIDDEN=TRUE prevents a player plug-in control from showing up on your page. If you want to give the viewer control over the player, you can specify a HEIGHT and WIDTH parameter for the "console". Using WIDTH=145 HEIGHT=35 allows the console shown above to be displayed (don't forget to leave the HIDDEN=TRUE parameter out to display a console). Charles Belov's page (referenced below) has some guidelines for sizing for different console options.

The above tags will play the music once. If you want the music to play forever (not recommended) place a LOOP=INFINITE parameter in the tag.

In order to play a MIDI file, you must have the selection stored in your server directory. MIDI selections are available for download from many sources. Search engines (using midi as the key) will give you a lot of pointers. (One good starting point is Yahoo's MIDI Archives page.)
Similarly, wav files can be downloaded and played in the same manner (see references to wav files at Yahoo's WAV archives page ).

A great resource for MIDI related topics, including tests you can run as well as a lot of helpful information, is Charles Belov's MIDI Web Tips and World Rock Site. I have found his info to be of great help in this area.


If you want to use this page as a template to start your own page, use File, Save As.. to save a copy of the HTML (what you see if you select View, Document Source) and then use an HTML editor (like Homesite) to customize it on your own computer.
Note: This page created another browser window because of the TARGET="WINDOW" parameter in the tag that got you here. You can simply close this browser to return to the prior page (which is in its own browser window).
Send mail to Jim at hansonj@usa.net

Copyright © 1999 Jim Hanson
This Page was created with Homesite.

Most recent revision Sept. 1999


This page hosted by GEOCITIES Get your own Free Home Page