Gary L. Simmons  rev 06/17/03
Home  Marathon  Joke OT Weak  Web Building  Resumé  Lynx  Hobbies  Extra  Site Map Resume Joke of the Weak Go to next department

Gary's Web Building

Put Sounds On Your Page

Sounds are cool. You have my permission to put them on your page. Here is some background on it as well as the "how to". Remember that long loading sound files that are forced on a person can be obnoxious especially if it is something like "Barney does rap" or "The Norman Tavern Quacker Choir rock and roll medley". Also of some concern is the time it takes Java based sounds to start on some slower machines. I had a computer that would take a minute to load and initialize Java and there was no stopping it from loading once it got started. You could tell I had stumbled across such a page when an expletive would explosively break wind. I would avoid pages with Java based effects like they were plague rats. So take note you tuneophyles. Anyway sounds on your page are a good thing in general, an   artsy fartsy multi media thingy that the web is all about these days. Here you will learn to not only put sounds on your page but to provide controls for the sound file, have them streaming or just have your computer create them via a real time midi conversion. But again here is another cravat, consider your audience. If you are on an intranet and you know your audience is there in an official capacity to work with your sounds then fine. Remember that someone at work doesn't want to fill their office with the sound of 500lb hogs humping or even the sounds I will have here as examples. Always give people the option of being able to turn the sounds off. Warn them at the very least. Mmmmm Kay? Make sure you have your QuickTime plug-in installed for this page.

  • Use 8 bit files:

    If you don't need perfect reproduction, EX: you are sounding a "wrong buzzer" as opposed to identifying the bird call of the "Woodland Hanger Legged Dropshot" then by all means use an 8 bit sound. This is an 8 bit sound and this is the same recording in 16 bit format but they sound pretty much the same right? The 16 bit sound is 104K bigger than the 8 bit sound and this is only a four second sound file. Big deal if you are on a T1, DSL or cable but really a big deal if you are like most of us, on a 56K dial up or slower. I'm not saying to sacrifice quality, just don't over do it when it is not necessary.

  • Compression:

    Aside from using 8 bit sounds, you can also reduce the size of the sound file by using a smaller sampling rate. CD quality is 44.1 khz, 16 bit stereo. Do you need that? 22 khz 8 bit mono will get you a lot of places and sound very reasonable in doing so. All my examples here have been 22 khz, about as low as I would want to go for this particular presentation. You will find uses for it I am sure, the smaller the sampling rate the smaller the sound file. If you do not want to compromise quality yet need a smaller sound file you should consider compression.

    Compression typically eliminates redundant data and then removes less important data to shrink the file even further. Ever hear of "codecs"? You have now, codec is short for "compressor/decompressor" and is basically an algorithm for compressing media by examining consecutive frames and storing the difference (temporal compression) or by generalizing an image and removing redundant data (spatial compression). If your sound editing program will let you compress files then you may want to consider this option on large files. Keep in mind that you will lose some quality from compression.

    I started using a compression trick recently that works great and the loss of sound quality is almost undetectable to me. First I create a sound, then I convert it to MP3 format, then convert it again to a web ready format such as AU (See Sound Formats below). MP3 compression throws away a lot of "unheard" sound data that basically is unused by the human ear. This results in a tremendous reduction in file size. For example I was able to convert a 180K sound file into a stunning 16K sound file with very little degradation in the quality. To convert to the MP3 format I used the program "AudioCatalyst 2.0" found at It is now version 2.1 and only for the PC but it was available as freeware for the Mac and as shareware for the PC. PC users can now download a free trial version and Mac users can use the free program iTunes program that ships with Macs. My... the world changes in a year! There are other MP3 encoders out there on the web, shop around and find something you like. You really should try this trick, I was so impressed with it that the first thing I did was to come here and tell you guys about it.

  • Normalize:

    Audio files sometimes loose their amplitude and clarity when they are digitized. If this is the case then you should normalize your sounds. There are a number of sound ware packages that will normalize sounds for you such as SoundEdit. Normalizing finds the highest peak in your sound then amplifies the rest of the file to make that peak's volume 100% of the possible amplitude. This way you will have the loudest possible signal to work with. Here is an example of an unnormalized sound and the exact same sound after it has been normalized. Play each one several times in a row then play the other. Quite a difference eh? The two sound files are exactly the same size but the normalized file is much better sounding. The unnormalized files sounds distant and muted.

  • Enhance the midrange:

    If your recording software has an equalizer then by all means give the midrange a boost. Here is an example of an unboosted midrange file and a boosted midrange file. I notice more of an improvement boosting the midrange on this file then I did normalizing the other file. In each case the sound file is exactly the same size, yet much clearer. If you do no other enhancements to your sound files, at least boost the midrange.

  • QuickTime notes:

    OK so far I have been using AU files. This will get you the default browser handlers. AU is the most commonly used format for cross-platform applications. However if you convert your sound file to a QuickTime file you will have some distinct advantages. QuickTime is truly cross-platform, the QuickTime plug-in is part of most browser software. Most every web surfer of even the most modest experience is familiar with QuickTime controls. QuickTime is also a progressive download player, which means that it will allow users to play anything that has been downloaded so far. This is pretty handy if the file is large and the user wants to see if this file is useful or not to him without waiting for the entire download.

    Here, try out a QuickTime file of a cut from a Sam Spade movie starring Humphrey Bogart and Peter Lorre. Outhouse accidents like this were common in the 1940's. If you are on a fast connection this is not a good test for you. I hate you anyway so don't go telling me that it loaded before you could click the start button! Anyway, I used QuickTime Pro to export the sound as a 20 kbps streaming music file then linked it just as I have the previous sound files. It loses a lot of clarity, here is how Mr. Spades Outhouse sounded before it was converted, of course it sounds better, it is 7 times larger than the streaming file but you can weigh the advantages over the disadvantages yourself in each instance.

  • Sound formats:

    So anyway, as I was saying before you got me all red-faced, white-knuckled and brown-trowsered was that browsers can recognize many formats for sound clips.
    AU (.au) from Sun is the most commonly used format for cross-platform applications.
    Audio Interchange File Format (.aiff, .aif) is widely used on Macintosh and Silicon Graphics computers, it requires that the correct browser plug-in be installed. Very large files.
    MIDI (.mid, .rmi) is a common format for synthesized music. Again, the proper damn browser plug-in is needed.
    Real Audio (.ra) is a streaming audio format from Real Networks and it needs a fricka fracken fudge mudgelin plug-in too.
    Windows sound (.wav) widely used in Windows applications. It again requires a *@#$%^&! plug-in.

    It looks like we are stuck with AU files if you want to be truely cross platform with no plug-ins that need to be down loaded. If you do have to go with a plugin, hey, go with QuickTime, they ship with the browsers and nothing needs to be hunted down and downloaded by the user (a major pain in the padinkis for some users)

  • Nuts and bolts:
    Enough of the asthetics and onto the nuts and bolts of including sounds. The HTML to link to a sound like every other link you have created:

    A normal visible link that when clicked will download a sound and play it:
    < A HREF="../path/">LinkName</A>

    You can embed (loads when page loads) QuickTime sounds in your page for cool effects. The HTML to play a sound or music in the background is:

    Visible embeded QuickTime controls that will play a sound:
    < EMBED SRC="../path/" CONTROLS="console" WIDTH="137" HEIGHT="17" ALIGN="BOTTOM" autoplay="false" loop="false"></embed>

    An invisible embeded link that will automatically play a looping sound as the page opens:
    < EMBED SRC="../path/" WIDTH="137" HEIGHT="17" ALIGN="BOTTOM" autoplay="true" loop="true" hidden="true"></EMBED>

    Hey you idiots, use this last one carefully, you can really irritate someone who can't turn your stupid music off. No matter how cool you think your tunes or sound file is, it is going to sound really annoying to someone. Remember, these are the people you are trying to invite back to your page. If you give them something like this example that they cannot turn off then the chances are that if it chaps their hide, they will not come back for more of your abuse.

    This reminds me of what happened to me one morning. I was dreaming that I could not turn off a radio that was blaring a really bad song. I turned the radio off but it still was playing loudly. I pulled the plug out of the wall but it still screeched on. I started smashing it with a chair and broke it to tiny bits but each bit STILL blasted the tinny scratchy stupid song. Well I woke up and I was really POed, it was my clock radio trying to wake me up and the @#$%^&!! thing was STILL blasting that horrible tune at me with its blown out speaker and jacked up sound. I ripped the sucker out of the wall and stood out on my front porch stark naked twirling that awful clock radio around by the cord and released it to let it fly 50 feet away out into some pine trees. True story. Um... hey did I just share too much? Well sorry, but you get the idea, right? Give your visitor some control or warn him or make sure your particular audience is going to enjoy your offering.

Top of page

Back to Web Building