HTML MUSIC CODE
FOREGROUND MUSIC To
make a music file play when clicked, you simply link it using the following
tag, where "filename.mid" is the full name of the sound file
you are using, for example, "midione.mid" or "bvhcop.wav". If
your background music is a midi file (and most are), then you cannot get a
foreground midi file to play when requested, as your midi player will be busy
playing your background music. However, a foreground wav file can play over a
background midi. <a href="filename.mid">
Play this music!</a> This should begin to play automatically. BACKGROUND MUSIC There
can be a conflict between the tags needed for background music with Netscape
and Internet Explorer browsers. To make your music accessible to more people,
it is wise to include both Netscape and I.E tags. Netscape
supports <embed> tags. I.E supports
<bgsound> tags. If you want the tags that will be supported
by both Netscape and I.E, then use the following, where
"filename.mid" is the full name of the sound file you are using, for
example, "midione.mid" or "bvhcop.wav". USER PLAY <embed
src="filename.mid" width=145 height=55> <noembed> <bgsound
src="filename.mid"> </noembed> This
will produce a music player which can be clicked to start and stop the music. For
a smaller music player, change the size tags to width=145 height=35
AUTOMATIC PLAY -
ONCE ONLY <embed
src="filename.mid" width=145 height=55 autostart=true> <noembed> <bgsound
src="filename.mid"> </noembed> This will produce a
music player. The music will play automatically once your page has loaded. It
will play through once and then stop. AUTOMATIC PLAY - CONTINUOUS <embed
src="filename.mid" width=145 height=55 autostart=true loop=true> <noembed> <bgsound
src="filename.mid" loop=infinite> </noembed> This will produce a
music player. The music will play automatically once your page has loaded. The
music will play continuously. SMALL CONSOLE CONTROL For
all of your visible play options, you can substitute a small music control
console, instead of the larger music player. Simply use the
following code: <embed
src="filename.mid" width=51 height=15
controls="smallconsole"> <noembed> <bgsound
src="filename.mid" controls="smallconsole"> </noembed> This
will produce a small console consisting of an "ON" and
"OFF" button. For
a slightly larger version, change the size tags to width=144 height=15 HIDDEN BACKGROUND MUSIC <embed
src="filename.mid" hidden=true autostart=true loop=true> <noembed> <bgsound
src="filename.mid" loop=infinite> </noembed> NO
music player will appear on your screen. The music will be hidden. This
coding will produce automatic start, continuous play music. Continuous
music that you cannot turn off can get very annoying, so ... for hidden
background music that starts automatically, but only plays through once and
then stops, use this coding: <embed
src="filename.mid" hidden=true autostart=true> <noembed> <bgsound
src="filename.mid"> </noembed> Cross-browser code If
you want simple code without having to worry whether someone is using Netscape
or something else, here it is: Automatically
play, don't loop: <EMBED
SRC="targetURL" HIDDEN="TRUE"
AUTOSTART="TRUE"> <NOEMBED>
<BGSOUND
SRC="targetURL"> </NOEMBED>
Automatically
play, loop: <EMBED
SRC="targetURL" HIDDEN="TRUE" LOOP="TRUE"
AUTOSTART="TRUE"> <NOEMBED>
<BGSOUND
SRC="targetURL" LOOP="-1"> </NOEMBED>
Don't
automatically play, don't loop: <EMBED
SRC="targetURL" WIDTH="200" HEIGHT="80"
AUTOSTART="FALSE" DISPLAY="SONG"> Don't
automatically play, do loop: <EMBED
SRC="targetURL" WIDTH="200" HEIGHT="80"
LOOP="TRUE" AUTOSTART="FALSE" DISPLAY="SONG"> The
EMBED tag will play on Netscape Navigator, as well as 3.01 and later versions
of Internet Explorer, and the current version of WebTV, and is available for both
automatic and manual play. The BGSOUND tag will play on NCSA Mosaic, older
versions of WebTV, and earlier versions of Internet Explorer, and is available
for automatic play only. DISPLAY="SONG" supports manual starts for
your visitors who use Headspace Beatnik. Copy
this code from your browser screen, not from the source HTML. Replace targetURL
with the file name of your MIDI file, including the .mid extension. If the
target MIDI file is in the same directory as your home page, just use the file
name, for example, "mysong.mid"; otherwise, use the fully qualified
URL, starting with
"http://" and ending with ".mid". Do not use a URL that
starts with "/" as it does not work on some browsers. Note
that the 200 by 80 console will support all known MIDI plug-ins. Please don't
go below that, since you can't be sure what plug-in your visitors are using,
and you
can crash their browser if you set the size too small for their plug-in.
(Actually, you can tell what their plug-in is if they are using NN 3 or greater
and have JavaScript
turned on, but that's another subject.) |