Web Audio: MP3 Streaming
A few years ago, if you wanted to provide your web audience with streaming audio on demand, the Real Audio format seemed the most practical method for doing so. The encoding process was simple, the format was both Mac and PC friendly, and, with the introduction of Surestream technology, users could access the audio appropriate for their connection speed without forcing Webmasters to create separate files for both dial-up and broadband modems.
Yet, as with most proprietary technology, to get the best of what Real Audio was designed for, you had to pay some real bucks. While you could get an encoder for free, to use Surestream you were required to either license or rent space on a Real Media (now called Helix) server. A free version of the server has been available for a while, but there is a limit on how many users you could accommodate at once. You also had to know how to install and maintain that server. Not exactly brain surgery, but still… Are we not partial to simplicity where we can find it?
If your needs (or means) are simple, streaming MP3 might be your best option.
What is Streaming?
Streaming means that you don’t have to download an entire file before you can listen to it – you listen to it AS it downloads and passes through your computer audio player. Another important feature of streaming media is that users are limited to listening to your audio only when they are online. The file is not saved to their hard drive where they can distribute and manipulate it any way they want. There are ways around these restrictions, but the user has to go to some extra effort to accomplish this. Remember, in reality, if you really want to copy audio off the web, just plug a mini-disc recorder into the sound card and press record.
Don’t sue me, I’m just saying…
Pick an Encoder
Because MP3 was developed under an open patent, there is no shortage of MP3 software – both commercial and freeware. Although discussing the difference between different encoders could justify an entire series of articles, we’ll suffice to say that the features valued most are a friendly interface, ability to customize file settings, and workability with other audio file formats and programs.
In my experience Apple’s iTunes (MAC, PC), NullSoft’s Winamp (PC), and MusicMatch (PC) work well in these regards. More often than not, it is a matter of personal taste(and need), so don’t be frustrated if you have to try a few before finding the right one. For more info and a list of encoders, you can visit the following:
So now you’ve picked an encoder, and it’s time to…well, encode. The process itself is very simple – usually you just select the original audio files from a CD or hard drive, then pick “encode” or “import.”
The most common audio formats to encode from are .AIFF and .WAV. Better MP3 encoders will have a few more formats to chose from, but if you need to convert from an unsupported file, programs like Audio
Hijack (MAC) can record audio from any application on your computer and convert it to the necessary format. In fact, it will also convert directly to MP3. If you don’t mind doing the encode in real time, that may be the encoder you want.
Before you go ahead with encoding, here are some important settings you need to be aware of.
Bit Rate is what decides the quality of the audio you encode, the level of compression for the end file size, and what kind of connection speed is required to stream your audio online. It is basically the amount of data dedicated to frequency response in an audio file. It is measured, as with modem speed, in kilobits per second(kbps).
If you do not want to encode multiple files, you need to pick a bitrate for streaming that accommodates both dial-up and broadband users. Here’s a quick cheat-sheet for picking your bit rate:
16-22 kbps: Meant for 28.8 dial-up modems. OK for talk, but is often garbly and the fidelity is comparable to AM radio. Very few 28.8 modems are still being used, so consider bypassing this one.
32-44 kbps: Ideal for the majority of users who still use a 56.6 connection. The overall sound is warmer and there is almost no garble in speech. You can sometimes hear audio artifacts in music, and other wide response sounds. For talk radio, this is fine.
64-96 kbps: For ISDN and higher. Fuller response and no garble. However, if your audio is really speech based, you are sacrificing a whole lot of dial-up users for not a whole lot of improvement.
128-192 kbps: This is really where the broadband bill seems worth it. Music sounds relatively full. You can hear nuances in original sound design. Some claim they can’t hear the difference from CD until they listen with headphones.
With each of these options, you can vastly improve the fidelity by encoding in mono. In doing this, you dedicate twice the bitrate for your audio channel. If stereo is not essential to tell your story, consider not using it.
To exemplify the difference between bit rate options, I took a field recording of the Washington, DC performance group Capueira de Angola and encoded a small clip 3 diifferent ways.
A far cry from CD quality, but the the sound is clear and nuances of both the musicians and the street noise are present.
You can hear the music, but subtle sounds are a bit distorted and much of the frequency response is lost.
By encoding in mono at the same bit-rate, you double the amount of ambience and frequency response present.
Variable Bit Rate (VBR)
Select this option to maintain a guaranteed minimum bit rate. In English, this means the encoder will adjust the entire bit rate to the frequencies the encoder considers most important. The difference is most noticeable in lower bitrate audio and makes for a slightly larger file.
Actually determines the frequency range in your audio file. If there are no major bass events in your piece, no acoustic overtones worth preserving, then 22.05 khz should be fine. It will help your encoder dedicate itself to the range important to your piece. Try to avoid going beneath 11.025, because at that point, no matter how well the encode went, you just sound paper thin.
Many of the better encoders will allow you to custom filter out certain or specific frequencies according to your needs.
Meta-Data will provide your user with information about the audio you are streaming.
Cataloguing info for your audio. Title, producer, artist, genre, copyright, etc… Fill out the ones relevant to your audience. Though not all MP3 players display every category, having at least the title and artist will help users bookmark the stream to your audio when they want to come back.
Upload Your Files
Once you have encoded your files and are satisfied that the settings are optimal, you now have to upload your new MP3s to your web space. If your web host allows for FTP (file transfer protocol), then that is the ideal way to go. There are quite a few FTP programs, but I have personally been partial to Leetch (PC), and Fetch (MAC).
If you need to learn the basics of FTP, I highly suggest Wendy Owens’ article about Fetch over at WebMonkey.com. Here’s the link:
Also, it is usually a good idea to create a special folder for MP3s in your web space. Just for the sake of keeping things tidy.
Once your files are uploaded, find the web address, or URL for these files in a browser. Confused about URLs? OK. Real quick…
If the URL for your web space is:
You placed your audio inside the folders:
And the name of your audio file is:
Then the URL for this audio file will be:
For download, you can just use YOUR URL for a link. To successfully link for streaming, you need to take a couple more steps.
Write the M3U File
This picture illustrates everything you need to create a .m3u file. Read on to get the step by step instructions…
A .m3u file, exactly like a Real Audio ramfile, is a plain text document that contains the URL to your audio file. There is no special code to remember. Just the URL. You link to this .m3u file from a web page, which then calls up the original MP3. It is this process that initiates the actual stream.
Here’s how you create an M3U file:
1) Open up a plain text file in a text or HTML editor.
2) Copy and paste the URL to your MP3 into the top line. Make sure there are no other characters aside from the URL itself.
3) Save this file in plain text format with the extension “.m3u” For simplicity, if your MP3 file is named “myfile.mp3″ – then I would suggest naming this file as something like, “myfile.m3u”
4) As you did with the actual MP3s, create a folder for the .m3u files (Be creative and call it something like “m3u”).
5) Upload your .m3u files to the “m3u” folder. Make sure your FTP program is set to ASCII, or AUTO mode. This will ensure your files remain plain text.
Insert the URL to your .m3u file into the browser address window and press enter. This action should automatically open your computer’s default MP3 player and, after a moment for the file to preload a bit, your MP3 stream should begin playing. This is how you know it works.
Link & Stream
Just as you would link to a web page, or any other file for download, use the normal HTML link tag to call up your streaming MP3. A tag that looks like:
‹a href=”http://www.transom.org/sounds/2004/shows/20040310.palin.explosion1.mp3″›Listen to The Day My Mother’s Head Exploded: Version #1‹/a›
Will give you a link that looks like:
Click on this link. The streaming audio should soon follow. Now you know both how and why.
Web Director, Transom