The WebDeveloper.com Secret Guide to RealAudio
OK, let's get the basic stuff out of the way first. Making RealAudio files is easy and can be completely free. First, you make a good audio recording in your favorite format, which is usually a .WAV file. Then, you encode it using the free RealProducer program for Windows (click here to find an encoder for Mac, Linux, or Unix). And if you wish, get a free server for high-efficiency streaming (or read the rest of the article to learn how to skip the server altogether!).
On the other hand, if your time is worth something, I also recommend you look into RealNetworks' reasonably-priced production tools, which can do almost all the work for you, including creating HTML and SMIL files, batch encoding, and streaming of live events.
One Silly Little Letter
What's the difference between a RealAudio file (.ra) and an audio-only RealMedia file (.rm)? Just the last letter!
Actually, the difference is a bit more subtle and creates numerous problems for understandably confused Web developers who have been creating and using RealNetworks' encoders and players for more than a year or so.
In the beginning, there was the RealAudio format and it ended in .ra. Then as things became more generalized to video (and now SMIL, embedded links, etc.), the decision was made to change the extension to .rm, for RealMedia.
So what will changing the .rm extension of a pure RealAudio file to .ra do? Several things:
- it will let owners of older (very old) RealPlayers play the file by clicking it in the browser. You might not realize this, but you can't launch a .rm file by clicking on it. And that leads us to the second effect of changing the extension...
- it will let people download your content more easily. Newer players have a "record" button, which is usually disabled by default. However, that button is dependent on the "Selective Recording" setting in RealProducer.
Now, in the "new mode" of operation of RealMedia, when you create a page with links to your RealAudio content, you never create a hyperlink directly to the .rm content file itself. You instead link to a .ram file, which stands for RealAudio Metafile. This metafile is simply a one-line text file containing the URL of your actual (.rm) content file (to confuse things even further, the latest "new new mode" RealProducer Pro G2 creates .ram files that point by default to a .smil file, which then points to the .rm file!). Ignore any instructions you may have seen anywhere, even from RealNetworks, about using relative URLs or file references. Just use the URL of the target .ra or .rm file as the contents of your .ram file and it will work every time.
Stream It, Dano
Doing this complicated two-step lets you do something very important: you can now stream RealMedia files using a standard HTTP server. If your RealAudio files are encoded to a single rate, and that rate is less than or equal to the data rate that a viewer's Internet connection can handle, the audio or video will actually stream automatically, without the necessity for you to buy, license, download, or configure a RealAudio/RealMedia server.
This streaming is limited in flexibility, but for most sites that aren't solely music- or video-oriented, this is a fantastic feature. It means you can simply "drop in" RealAudio files easily, without having to worry about a separate server, and without your visitors having to wait until the entire file downloads before they can hear or see your content. Be warned, however, that not using a direct RealMedia server means that a clever visitor will be able to bootleg your file by grabbing the content file out of their browser cache, or in numerous other ways. Basically, your content is not secure at all if you're not using a RealMedia server, so don't post high-quality full-length RealAudio samples of your newest hit song if you don't want them spread all over the world by tomorrow morning.
Now, if your RealAudio files happen to be encoded to a higher rate than the connection can handle (such as 44.1 KHz stereo audio attempting to go over a 28.8 Kbps connection), and if your viewer has a newer RealPlayer with the PerfectPlay option checked, the file will be downloaded to their machine, then played automatically (assuming you've also enabled PerfectPlay when encoding it). Or they can right-click on the link, and "save as" to grab it.
RealNetworks has a technical document that contains an interesting section called Choosing RealAudio Codecs. It shows charts detailing exactly what frequency response you will get from picking one of the almost three dozen different codecs that they use. To put it mildly, it's quite a complex decision, which is why RealNetworks --and you -- would love for everyone to download their new G2 player. G2 can update itself automatically and play any RealMedia content ever created, and using RealProducer, you can have it automatically adjust itself to the user's available bandwidth using their SureStream technology.
Unfortunately not everyone lives on the cutting edge of technology, so if you want people with older players to hear your content instead of clicking off to another site in disgust, you have to give them something they can deal with (assuming they have a RealAudio player at all, which most people actually do).
Choosing the Right Codec
Based on a detailed study of RealNetworks' documentation and some practical experience, I recommend the following if you want to stream audio without problems. In each case, if there's a reasonable alternative for better frequency response and quality, I list it second...compatibility always comes first! (note: RA3 means the RealAudio Player Version 3, etc.). Some of these codecs have different names (indicated where known) and may or may not be available, depending on whether you're using Sound Forge or a RealAudio Encoder or the new RealProducer program.
For absolute minimum bandwidth requirements (14.4 Kbps modems):
Voice: 8 Kbps Voice (supported by every RealPlayer ever released) or 8.5 Kbps Voice (compatible only back to RA4, but higher quality)
Music: 12 Kbps Music.
For typical bandwidth requirements (28.8 to 33.6 Kbps modems):
Voice: 15.2 Kbps Voice (doesn't have the ultimate bandwidth, but it's compatible way back to RA2) or 16 Kbps Voice-Mono (much better response, but you'll need RA5 or later to play it)
Music: 16 Kbps Music-Mono High (yes, it's mono, but you get 5.5 KHz of response and compatibility back to RA3. If you want stereo, use 20 Kbps Music-Stereo, but you'll go down to 4 KHz...trust me, it's not worth it). If they have a pristine 33.6 Kbps connection and RA4 (or higher), you could also try 32 Kbps Music for 5.5 KHz in stereo mode or a whopping 8 KHz in mono.
Now, if you're willing to let them download first and play later, or if they have ISDN or better, these are some good things to look at:
40 Kbps Music (aka ISDN), which is backwards compatible back to RA3, gives you 8 KHz in stereo or 11 KHz in mono, and sounds pretty good for the file sizes you'll get. Here's a song written and performed by my 4-year-old son, using some of the above schemes:
80 Kbps Music (aka Dual ISDN), also RA3 compatible, for 16 KHz stereo or 20 KHz mono. This is probably the highest setting you should ever use.
The absolute top performer is 96 Kbps Music-G2 Stereo, which gives a blistering 24 KHz audio response but is playable only on the newest G2 player. In testing, I've found this format to sound virtually indistinguishable from MP3 on much pop music material, while taking 1/3 as much time to encode as MP3 and about half the disk/download space...and 80 Kbps Music - Stereo is pretty close. Why MP3 gets all the publicity, I'll never know! There are far more people with RealAudio players than MP3 players. Give it a shot.