There are a number of ways to loop an audio sample, but the easiest and best cross-platform solution is to use the Apple QuickTime plug-in, which ships with Netscape Navigator 3.0, but also works with Navigator 2.0 and as an ActiveX control in Internet Explorer 3.0.
Before we go any further, though, I should tell you how to shut off the looping sample that began playing when you loaded this page (if you have the plug-in). Chances are good that it's making you crazy, so just press this "pause" button if you want it to stop:
OK, let's get down to business. You can embed an audio sample as a QuickTime movie in an HTML document with the embed src tag, but first you need to prepare the audio sample. Once you've got the sample, most sound-editing applications will let you save your audio file as a QuickTime movie.
Be sure to name your file with a .mov suffix, then download a handy
little shareware application called Internet Movie Tool. Open your file from this application and
resave it so the file will work across platforms. Alternately, use
MoviePlayer, which comes with Quicktime 2.5 to open the file,
then save it with a new name. Be sure to check the "make file
self-contained" and "make playable on all computers" options.
Then place it in your page's directory, and call it with this tag:
<embed src="/stuff/mysillysample.mov" height=35 width=16 controller=TRUE autoplay=TRUE loop=TRUE>
In this example, I used controller=TRUE to make sure my readers can stop the audio if they don't like it. The attribute autoplay=TRUE tells the browser to start playing the sound file when the pages load, and loop=TRUE tells it to play the file over and over and over.
Make sure you listen to the results a couple of times before you post it to your site. You may need to modify the sample slightly by truncating the end to make it loop smoothly.
A looped audio piece like this is perfect for adding extra punch to a page. It can provide a new design element without using much real estate. Don't get too carried away, though. Remember that loops are - by their very nature - inherently annoying to almost everyone but the creator of the loop, who usually acts like a proud parent listening to Baby's first words, while everyone else edges quietly away from the godforsaken thing. If you pick the wrong sample, you risk irritating and even enraging viewers, which, of course, is the cardinal sin of any Web developer. I picked a short, complex, and ambient piece culled from a longer keyboard thing I did for this example.
I predict in six months that we'll see looping ambient samples all over the Web, so get in there and hack it out while it's still cool. But remember the blink tag! What seems nifty today might be extremely annoying tomorrow.