Playing Sound Files from Web Pages

The Home of .

The Cast of Characters:
  Rolande Kendal, mysterious Inventor from Montreal
  (of whom there are no known pictures),
  Dr. Mark Huckvale, of the University College of London,
 Fabricio Zuardi, a dynamic young
  Programmer from Brazil,
  Calamus Kreboski, "The Bee Man of Al'Ahdin",
  Me, and    Swami Mike.
 

Tell Me A Story

 

Go Straight To The Good Stuff


Home   The Good Stuff   The Details
The Long-Winded Story:

I had been working on putting sound into web pages, and wrestling with the problem of browser incompatibility, since the Summer of 2005. Both Mr. Rolande Kendal, of Montreal ("FreedomAudio", "AudioCentric"), and Dr. Mark Huckvale, of the University College of London ("Demonstration of Different Ways to Play a Sound from a Web Page"), were invaluable resources back then. The solutions I came up with (audio players based on now-obscure plugins) were not working as well as I had hoped, so I had to go back and try again in the Fall of 2006.

This time, with the help of Dr. Huckvale's updated page, I came up with a two-pronged, "belt and suspenders"* approach that seems to work quite well.

The first strand relies on a free Shockwave-based streaming mp3 player developed by Fabricio Zuardi. The Shockwave plugin comes with most new browsers as standard equipment, so it has become widely available. As you know, these players come in two flavors: Jukebox and Button. While snazzy, Jukebox Players all seem to have the same fatal flaw. Once you click on a selection, the Player continues on through the entire playlist, unless you explicitly stop it. Also, with a Jukebox, you are collecting your sounds in one place, which implies that they are related:

  • The Fricative
  • The Plosive
  • The Glottal Stop
  • The Dulwich Horror
  • and so on. (If you'd like to see a Jukebox example, click here: Massage Music Top Twenty ).

    Therefore, the Button Player is preferable, as the application itself is small and loads quickly. And, you can scatter your sounds at will throughout the page:

    Click on Square to STOP, Arrow to START  Independent Fife & Drum Co.  'XSPF Player' courtesy Fabricio Zuardi.

    Since there is no guarantee that any given User will actually have the Shockwave plugin, and a compatible version at that, a backup strand is absolutely required. Another thing to bear in mind is that many Users are searching the Internet from Work. While they may have the latest and greatest in Software on their Desktop, Company Firewalls and Corporate Policies can be very restrictive towards Active-X Components, so it's a good idea to have a Plan B for your sound files.

    I looked at Mark Huckvale's 'AudioButton', tested it against the Gecko & Mozilla browser crowd, and realized that he had come very close to developing a sound player that was universally applicable. Because it was compiled in Java 1.0, it was still compatible with every version of the JRE that I could find to test it against: Netscape 4.7.2, 6.0, 6.1, 6.2, and 8.1, as well as Firefox and Opera. It also works in Netscape 7.0 on the Apple Macintosh.

    Yes, it uses Sun's old .AU format, but despite the dismissive comments about "low fidelity" and "voice only", I have found it to be more than adequate for on-line music samples. Only someone who has to listen to their Herbert Von Karajan and Bernard Haitink on a tube amplifier is going to care about the difference between the .mp3 and .au version of a song played through a PC**.

       Middlesex County Volunteers: German '69        Kevin J. O'Neil: Let Me Go     'AudioButton' courtesy Dr. Mark Huckvale, UCL.
     
    One outstanding problem was stopping the sound playback. The sound sample might be very long, or the User might not want to listen to it anymore. Clicking on a Button simply makes the music start playing again, and if you click on a different Button, you will soon have multiple sounds all playing at once.

    Using Javascript to make an external call to the Stop() method of an applet is easy in IE, so of course it won't work for Netscape & Co. For a while, I experimented with a single Stop button that called Javascript to perform a soft reload:
         function Estop() { history.go(0); this.focus(); }.

    Click Here to Stop:
    Stop Playing

    This actually worked quite well, but it seemed like it might not be the most elegant solution. So I took the liberty of revising Dr. Huckvale's AudioButton Applet by adding both a Stop function and two more image variables. This produced a three-state button: 'Play', 'Playing', 'Played'. Then I added a (File) Length Parameter. Using this, the Applet can tell, without the Button being clicked, when to stop and switch the Button display from "Playing" to "Played". The end result was compiled in Java 1.0.2, so as to retain the upwards compatibility:

     Independent Fife & Drum Co.     'AudioAladdin Player' by Michael D. Cohen.


    Home   Tell Me A Story   The Details
    The Good Stuff At Last:

    If you're still with me after all this exposition, here is how to see this in action. Click on either of the two links below, "Listen to....".

    A window with the Shockwave player will pop up. If you have the Shockwave plugin, a vertical row of blue circles with arrows in them will appear.

    Then, try the link that says "Click here if no Sound". Another window will pop up with the AudioAladdin Applet player. As long as you have any version of Java installed, a vertical row of buttons with blue arrows on them will appear. Please allow a little time for the audio files to load.

    Click here to listen to:  Bulgarian Music  or  Punk Music .


    Home   Tell Me A Story   The Good Stuff
    The Ugly Details:

    Remember: you can't control what the User has on their Desktop. Neither which Browser they're using,
    nor which Plugins they have. But AudioAladdin is both Browser- and Plugin-Independent. License this
    amazing Application today. Serious Discounts are available for Non-Profit Organizations.

    All the gritty technical stuff is coming soon. In the meantime, if you have any questions, you can contact me by e-mail.

    But, since progress marches on...here's a cool, cool demo of what you can presently do with several free Adobe Flash
    players, as well as AudioAladdin:  Story Demo.

    Mike Cohen
    Woburn, Mass.

    *   This is in the American sense of the portly gentleman who wears both a belt and suspenders to ensure that his trousers stay up. It has nothing to do with Ladies' undergarments.
    ** Again, in the American sense of Personal Computer, although I understand some Police Constables can be quite musical.