MP3_FEATURED

Web Audio: MP3 Streaming

Intro/Why MP3?

MP3 & StreamingA 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.

A Brief History

Contrary to popular belief, the Moving Picture Experts Group, Audio Layer III format – or MP3 – is not a recent occurrence. It has been around forever. Actually, the mid-1980s, but, for the Internet, that’s close to the dawn of time. Developed in Germany by the Fraunhofer Institut, in the early 90s it was integrated it into the MPEG-1 specification as a high quality, low bit rate audio compression format.

Since MP3 technology is not proprietary, individual developers have been free to create their own software for encoding and playing MP3s. In tandem with the rise of personal file sharing, portable digital audio players, and (legal) online audio stores that use MP3 and related formats, MP3 has helped to revolutionize how audio is distributed and has made a regular place for itself in daily digital life.

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:

www.mp3machine.com
www.pure-mac.com/mp3.html

Settings, etc…
SettingsSo 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

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.

Listen to “Stereo at 96 kbps”

A far cry from CD quality, but the the sound is clear and nuances of both the musicians and the street noise are present.

Listen to “Stereo at 40 kbps”

You can hear the music, but subtle sounds are a bit distorted and much of the frequency response is lost.

Listen to “Mono at 40 kbps”

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.

Sample Rate

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.

Meta DataMany 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.

Meta-Data
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: http://hotwired.lycos.com/webmonkey/98/41/index4a.html?tw=authoring

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: http://transom.org/

You placed your audio inside the folders: /sounds/2002/guests/

And the name of your audio file is: 200206.hodgman8.mp3

Then the URL for this audio file will be: http://transom.org/wp-content/uploads/2004/03/200206.hodgman8.mp3

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

SettingsThis 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.

Finally…

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:

Listen to “Web Audio: MP3 Streaming”

‹a href=”http://transom.org/wp-content/uploads/2004/03/20040310.palin_.explosion1.mp3″›Listen to The Day My Mother’s Head Exploded: Version #1‹/a›

Will give you a link that looks like:

Listen to The Day My Mother’s Head Exploded: Version #1

Click on this link. The streaming audio should soon follow. Now you know both how and why.

That’s it.

Joshua Barlow

About
Joshua Barlow

Joshua came to us from National Public Radio Online, where he produced for both news and cultural Web sites. Projects he helped create and produce include Changing Face of America, Election 2000, MLK Celebration 2001, and Lost & Found Sound, which won the 2000 Webby Award in the radio category. He served as NPR’s photo journalist for their coverage of Election 2000. In addition to his work for the Web and public broadcasting, Joshua has served the U.S. State Department in Croatia as a monitor for their 2000 presidential election, and is a freelance composer, who has written for dance, theater, film and, most recently, the Department of Homeland Security.