Date: Sun, 20 Feb 2005 18:45:27 -0500 (EST) From: Vadim Makarov To: Rpps43@aol.com Subject: Quality of encoding Hi Reinhard, I was going to write you a small lecture on audio encoding, but it seems you've quickly figured it yourself. I'll recap what I wanted to say anyway, because these things are nice to know. As you probably know, MP3 encoding is lossy. It achieves significant compression of raw audio data (44100 Hz 16-bit waveform stored on CD) at the expense of some loss in the perceptible sound quality to the listener. How much quality is lost depends on the compression ratio, encoding mode, and on the encoder used. For example, encoding at 128 kbps bitrate compresses the data 11 times. The maximum bitrate available in MP3 is 320 kbps, which compresses the data 4.4 times. Audio engineers and studios do NOT use lossy compression for storing audio data, because they may want to process it further and that quickly reveals the compression artefacts and distortions. However, storage of finished songs that will NOT be processed and will only be used for listening (e.g. tracks ripped from CDs) in lossy MP3 format is fine. Some time ago I started to wonder what bitrate and other compression settings I should use for the files in the collection. I wanted to set it high enough so that there is no perceptible loss of quality for all listeners, and never have to regret and return to that issue again. It turns out, the minimum bitrate at which no listener could detect difference between the compressed recording and the original (with quality stereo recordings from CDs) is between 256 and 320 kbps. This also assumes that the other settings during MP3 encoding are: "joint stereo", "CBR (constant bitrate)", and that a good latest encoder is used. There are several encoders and several versions of each encoder available that will all produce MP3 file of the same specified bitrate, but the sound quality upon decoding will be all different. Luckily the best MP3 encoder named LAME is freely available. You should search for downloadable binaries of it http://www.google.com/search?hl=en&q=LAME (if you want to run this encoder as a separate program, it runs from the command line interface). I'll give a small example. Victor Radugin sent be recent recordings of the Anthem of Russia made by the Alexandrov Ensemble, encoded as 192 kbps MP3s. Few days ago, I also got from him the original CD with these tracks. I have ripped them and encoded at 320 kbps. Then, I compared the 192 kbps version and 320 kbps version in half-decent headphones. While the sound is almost identical, with critical and concentrated listening I could blindly detect differences (i.e. listen and tell which of the two versions is playing not knowing which of the two files is playing). Namely, the differences I have pinpointed are: 1. Tiny percussion sounds are less clear in the 192 kbps version. You have to concentrate and listen to that particular instrument in the orchestra, ignoring much louder instruments playing at the same time, to hear the loss of clarity in the tiny sounds. 2. A loud trumpet sound that gets "croaky" at one point partially loses that "croakiness" and sounds mellower and less crisp in the 192 kbps version. 3. There are several barely perceptible (against the background of other much louder instruments playing at the same time) sounds of some wind instrument appearing in the left and right channels several times in the 320 kbps version. In the 192 kbps version, most of these sounds could not be heard. As you see, the difference is there, even though it doesn't matter for a casual listener. It matters, however, for critical listening and for preserving the full sound picture. In our activity, we want to orient ourselves to satisfying the most critical listener. Do you agree? If you agree, then you and me should use the abovementioned encoder and settings. There is an issue with file sizes for some users (better MP3s are larger), but I think it will become a non-issue in a few years. Disk storage and network capacity improve continually. Let's disregard these temporary limitations and make the right files today, so that we don't regret and have to re-do it later. Besides MP3 encoding, there is one more point you need to be aware of. It is the extraction of raw audio data from CDs. The audio CDs are specified and drives are made in such a way that the reading of audio data does NOT have to be completely error-free. There are two layers of error correction in the data, but they are not designed to fully correct all errors in all permissible cases. If the drive cannot extract the audio data completely correctly, it will proceed ANYWAY, delivering a version with some errors - because it can be listened to despite the errors, maybe small distortions and a few pops won't matter that much, and some audio players have algorithms for masking the pops in the sound in case it has been read from CD with errors. Obviously this is not what you want when you are extracting the audio data from CDs for subsequent high-quality compression. You most likely won't encounter this problem with completely clean, unscratched, quality-pressed CDs read on a quality-made compatible drive with clean optics. If, however, the CD is scratched or some other problem is present, then the audio data read from it can have some discrepancies with what has been originally recorded on the CD. (Note that this behaviour is unacceptable for data CD. Data CDs have an additional third layer of error correction and as a result store less data than audio CDs (650MB on data CD versus 747MB of audio data on audio CD). The data CD has a much higher guarantee of error-free reading and fails explicitly if files can't be read without errors.) So, how to improve the chances of extracting error-free data from audio CDs? There are applications that try to read each track several times and use other tricks to make sure the audio data extracted is really exactly what has been pressed on the CD. One of them is free and is available at http://www.exactaudiocopy.de/ (it has a bit geeky interface, but is otherwise good. I'm using it. It also contains a handy editor for WAV files, convenient for splitting and trimming pieces and for other simple tasks). Note that audio extraction from CDs (into WAV file) and encoding into MP3 are two separate steps that you can perform independently. However, most applications optionally allow to do them in one operation (i.e. a ripper application also includes an MP3 encoder that is run on the data after their extraction). The short version of the above recommendations is given in the first few paragraphs of the museum FAQ: http://www.hymn.ru/faq-en.html End of lecture. Vadim