[Boot multiple Operating Systems! (Click here).]

MP3 in OS/2- by Samuel Audet

MP3s -- What They Are And How They Work

MP3 is the filename extension that people started to use for MPEG-1 and MPEG-2 Layer III files. They are audio files, very similar in some ways to what WAVs are. However, they are up to 11 times smaller than regular PCM data found on music CDs while still sounding almost exactly the same as the original to the human ear. With this ratio you can store a 74 minute CD in 68 megs of space. Compare that to the 740 megs that WAV would need!

You might also have heard of such things as MPEG-2 AAC, VQF and RealAudio. These are all based on similar psychoacoustic models that scientists have been studying since the beginning of the century. But unlike MP3, these newer coding schemes can achieve up to 15:1 compression without perceptual loss.

What all these formats do to compress the data so small is to switch the time domain PCM file into small pieces of frequency domain, filtering out anything our ears can't hear and removing all redundant data the decoder can duplicate before passing it on to a storage or transfer device.

Why MP3?

So why use MP3 you ask? MPEG-2 AAC isn't available to the public yet and the only proof we have it even exists is AT&T's a2b music site where they sell music encoded in a format that AAC will resemble. The final AAC specifications are not available yet as the MPEG committee, of which AT&T is a member, is still working on them. VQF is an expensive commercial algorithm for which players and encoders exist. But, you guessed it, they are not available for OS/2. However, the situation for VQF players is not as bad as RealAudio, for which no source code or specifications are available at all.

What you can do in OS/2 with MP3s

The first thing you can do with MP3s is to store music on your hard disk instead of music CDs or on evil audio cassettes that degrade with time and get tangled up in your tape deck. Of course, you can also use it to store even more music on a CD using a data track -- imagine 11 hours of music on one CD! However, with MP3s on a random access device like your hard drive, you can delete them, add new ones, decode them to edit the resulting WAV, or do whatever you want with them very easily. One of those new 11 gig hard drives can hold 200 hours of CD quality music in MP3 format. With MP3s you can also distribute your own home made music on the 'net. Such sites that deal with amateur music encoded this way can already be found on the web and it appears that much more of this sort of distribution is coming in the near future.

The second use the MP3 format can be put to is as an alternative to RealAudio, since MP3s can be "streamed" just as RA files can be. However, there are two problems that show on the horizon. First, no "MP3 Server" software exists, so we use regular HTTP instead. But HTTP uses TCP, and not UDP like RealAudio servers do, which means a slower transfer because TCP can not 'forget' lost data during network problems in order to catch up with playback. The second problem is that MP3 doesn't sound as good as RealAudio encoded at the same bitrate. This is not a problem for normal speech, but for real-time music it means that a 48kb/s MP3 will sound like a 32kb/s RealAudio file -- leaving us poor 33.6k modem users in the dark.

How can we do this in OS/2?

There are several utilities that already exist for OS/2 to either Encode, Decode and Play MP3s (partly thanks to me <g>). Of course, I will recommend PM123 for playback, mpg123/2 (ZIP, 103k) for decoding and CD2MP3 PM for encoding. But there are also a couple of other good players, which include WarpAmp (ZIP, 257k), Z (ZIP, 114k), and at least one other nice encoding interface: MP3 PM (ZIP, 252k). Have a look at the OS/2 Supersite in the multimedia sound directory (and subdirectories) to see what's available. New apps are being released all the time so this is one area where OS/2 does not lack!

To make some MP3s of your own you can use the following (or one of the others you found above):

Now take your microphone out of the dusty closet. After the Internet phone and VoiceType fiasco, it's finally time to use it again. On your OS/2 Desktop make a new WAV file by using the Digital Audio program object in your Multimedia folder or the WAVAudio.WAV template in your template folder. Open it and choose a sample rate of 11kHz, mono and 16 bit. Eight bit PCM streams are not really used any more and MP3 encoders will not accept them. Choose the microphone as input and start talking into it. When you're finished, close the recording session and start CD2MP3 PM.

The easiest way to try out L3Enc or ToMPG is to unzip one of them into a single directory and launch it from there. Add or Drag your newly created WAV into the WAV list and choose 16kb/s as a bitrate (almost good enough for 14.4k modems, but not quite), since voice can get away with such low bitrates unharmed. Start the conversion process and once finished you can try out the newly created MP3 in PM123 (or whatever MP3 player you have).

While this is nice, nicer still is putting it on your web page. This is how:

Create a file with .M3U extension containing the following text:

(substitute your own web site domain, directory and filename where appropriate)

Upload both files to your web site and open PM123.

In PM123, use "Open URL", and type in http://www.yourdomain.com/yourdirectory/yourmp3.mp3. Isn't that cool? Free audio streaming!

The M3U file can also be used by Netscape. If you setup PM123 in Netscape to intercept M3U URLs, PM123 will read the URL found in the file and play it. (The same mechanism is used to play .RAM and .RA files for RealAudio.)

Note, however, that ToMPG does not downsample properly. If you want to encode a high quality WAV into a low quality MP3, be sure to downsample it with another professional tool, such as Sox or use L3Enc instead. L3Enc is 9 times slower in encoding than ToMPG, but gives better quality overall.

The same can be done for radio or home made music. Use an appropriate cable to connect your radio to your sound card's "line in" and record some data at 44.1kHz, stereo, 16 bit and encode it, but this time at 128kb/s. Much better than audio cassettes, don't you think? Of course, if your sound card picks up noise from your hard disk, that's bad. Since most OS/2 sound editors record to memory, you might want something that can easily record to the HD. I have modified the applets that come with GUS PnP drivers and they can now record WAV files directly to the hard drive.

To create MP3s from a music CD, you can use a CD Grabber which can usually copy CD tracks to WAV files on your hard disk (or possibly save them directly as MP3 files without first saving as WAV files). CD2MP3 PM can make the process automated if you can find a suitable grabber that can run in non-interactive mode. Two of them, Leech and Alfons should work for most people. Once one of these can be found by CD2MP3 PM, just specify the tracks that you want to grab, use your favorite encoder at a bitrate of at least 128kb/s and watch the process go. It can encode in the background, so you're free to do other work on your computer as it does this.

Standard Disclaimer and Legal Notice

As with all copyrighted material, commercially distributed music is protected by the laws of the United States and most other countries. Copying the music tracks from a CD may be illegal depending on the conditions described on the album's liner. While it may be safe to make copies of copyrighted music to MP3 files for your own personal use, the unauthorized distribution of that music in MP3 form is almost definitely illegal and can result in stiff penalties or even jail time. While there is nothing illegal about the MP3 encoding format (just as there is nothing illegal about owning blank audio tapes), what you do with it can by subject to law. OS/2 e-Zine! does not endorse or condone the activity of making illegal copies of music and distributing them over the Internet or any other medium. In other words: it's probably not a good idea to encode all your Bob Dylan albums and upload them to your web site.

More information on OS/2 software for MP3 can be found at:

More information on MP3 can be found at

* * *

Samuel Audet is an OS/2 fan learning about programming in C/C++/Java, mathematics and physics, and author of such programs as Hot Scroll and PM123. He will be studying Computer Engineering for the next few years at Ecole Polytechnique de Montreal.


[Our Sponsor: Indelible Blue - OS/2 software and hardware solutions to customers worldwide.]

Copyright © 1998 - Falcon Networking ISSN 1203-5696