By this time almost every Internet citizen knows something about the turbulent history and controversy surrounding the MP3 file format. Readers interested in the historical and technical details should consult the excellent material at MP3'Tech, but in this article we shall simply accept the MP3 as a fact of Internet life and consider its use as a commonly-employed streaming audio format.
The MP3 format has become enormously popular, rivaling RealAudio in the quality of its sound and the proliferation of MP3-powered sites. Of course, Linux can claim its fair share of encoders, decoders and players, tag writers, database managers, and other MP3 amenities. Damien Morel's excellent DAM's MP3 Page lists more than 40 Linux MP3 players available for use in X and at the console. Let's take a look at two of the most most popular players: XMMS and mpg123.
XMMS is the X MultiMedia System. Among its many virtues, XMMS supports a plug-in architecture that lets you add such niceties as effects-processing interfaces, OpenGL spectrum analyzers, and modules for various types of input/output files (including MPEG and AVI movies). The default setup for XMMS includes support for playing a variety of audio formats, including WAV, AIFF, various types of MOD music files, and of course standalone and streaming MP3s.
RPMs and tarballs are available from the XMMS web site. Installing the RPM is easy:
rpm -i xmms-latest.rpm will install the binary, the documentation, and the default plug-ins. The tarball should be unpacked in your home directory with
tar xzvf xmms-latest.tar.gz. Then just follow the familiar pattern of
./configure; make and (as root)
make install. That's all there is to it, you're ready to roll with XMMS.
xmms at an
xterm prompt. If you're new to the program you'll be pleased to find that you'll be able to change its appearance with skins, play with DSP effects in real time, and set up playlists of arbitrarily mixed media types. Unfortunately, we can't go into all the features of XMMS, we just want to know how to connect to a streaming MP3 broadcast.
There are three ways to connect XMMS to an audio stream. You can specify a network URL as a command-line option:
You can also select Play Location from the XMMS main menu (or use Ctrl-L at the keyboard) and enter the URL in the pop-up dialog box, or you can specify XMMS as the MIME type player
Multipurpose Internet Mail Extensions. MIME types enable the exchange of non-ASCII data such as audio and video over the Internet.
Michael Hipp's mpg123 is certainly the best-known MP3 player for the console. It is included with most mainstream Linux distributions, and rightfully so: mpg123 is still the fastest Linux decoder for standalone and streaming MP3s.
Unfortunately, some versions of mpg123 prior to 0.59s contain a bug that corrupts the URL for an audio stream, and as of Feb. 15, 2001, the properly working code is available only via the mpg123 CVS (Concurrent Versions System). Fortunately, CVS is also included with almost every major Linux distribution, and retrieving the repository code is easy. In X or at the console, run this command from your home directory:
cvs -d :pserver:email@example.com:/home/hippm/cvs login
You will be prompted for a user ID and a password: Enter
guest for both, then run this command to download the mpg123 CVS files:
cvs -z9 -d :pserver:firstname.lastname@example.org:/home/hippm/cvs checkout mpg123
When the CVS files have finished transferring, log out of the remote server:
cvs -d :pserver:email@example.com:/home/hippm/cvs logout
Downloading the CVS sources to your home directory will create a new
$HOME/mpg123 directory. Enter that directory and read the INSTALL and README files for any late-breaking news or changes to the installation process. Building mpg123 is quite straightforward: The author has provided a simple multi-platform makefile, and you need only type
make linux-help to view the Linux-specific compile-time options. I used
make linux-pentium, the build was quickly done, and
make install (as root, of course) put the new mpg123 into my system.
Connect mpg123 to an MP3 stream by pointing it to the stream's URL at the command prompt, just as we've done with RealPlayer and XMMS:
Mpg123 is also suitable as your browser's default helper application for playing MP3 streams in X or console mode. Configuring Netscape for mpg123 is identical to the XMMS configuration, substituting
xmms in your MIME type definitions. And with no need for a graphic interface, mpg123 will be our natural choice when we configure the Lynx text-mode web browser later in this article.
Creating content With BladeEnc
Most of us probably get our MP3s from popular sites such as MP3.com or the various Napster services, or we rip them from our CD collections (ripping is a term for the process of lifting the audio data from a CD and converting it to WAV and/or MP3 format). Linux users are perhaps most familiar with Mike Oliphant's wonderful Grip, a front-end for a variety of CD and MP3 utilities.
Grip is pre-configured for a number of MP3 encoders, including my favorite, Tord Jansson's BladeEnc.
After downloading and unpacking it (with
tar xzvf bladeenc-latest.tar.gz), installing BladeEnc follows the familiar routine of
./configure; make; make install. You can configure Grip to use BladeEnc as the default encoder, but the encoder is perfectly usable on its own at the command prompt. It may even be preferable to work with it that way: perhaps you've recorded some masterworks of your own as WAV files in Kai Vehmanen's great ecasound and you want to convert them to MP3s to stream over your own Internet broadcasting station. The process is simple enough, and this command :
will create MP3s from every WAV file found in the current directory. It really is that easy to make MP3s from your original material. BladeEnc has many other control options, but I leave their exploration to the interested reader.
The future of MP3
It may appear that MP3 has everything going for it to remain one of the most popular streaming audio formats: high-quality audio with low resource requirements, excellent streaming performance, and an enormous installed software base. However, not all the news is good: MP3 is a proprietary format patented and licensed by Fraunhofer IIS-A, a fact of some concern to many programmers of MP3 encoders. In 1997, Fraunhofer sent an order to developers of free and open-source encoders to cease and desist unless they started paying royalties. The company has also stated that it intends to charge licensing fees for broadcasting MP3s, perhaps by the end of the year. It seems that if you're looking for "...a fully open, non-proprietary, patent-and-royalty-free, general-purpose compressed audio format for high quality (44.1-48.0 kHz, 16+ bit, polyphonic) audio and music at fixed and variable bit-rates from 16 to 128 Kbps/channel," you won't get it from MP3. Perhaps you should be looking at Ogg Vorbis.