A lot of misconceptions exist about audio compression. Bear in mind that the whole idea behind it is to store digital audio but not have it take up too much space on your hard drive. Uncompressed audio is in wav format. You can compress it in 2 ways:
- Lossless compression: no information is lost, compression is about 50%.
- Lossy compression: the codec used tries to determine parts of the file you won’t be able to hear anyway and throws them away. The rest is compressed. Compression is determined by either the bitrate you want to give or the quality you want to give. Compression depends upon the bitrate used but can typically be around 80% while staying transparant.
So, no codec (mp3, ogg, aac, …) can ever be said to provide better or worse sound quality. WhatÂ canÂ be said is that different codecs need a different bitrate (and so, file size) to reach the same quality.
We’ll be compressing lossy. mp3 is an old codec and in theory newer ones such as aac should need a lower bitrate to get the same quality. However…When using the lame mp3 encoder you have an encoder which has excellent tuning. The advantage of using mp3 is that it’s universally supported on all devices. (indeed, most people think about mp3’s when talking about digital audio.) Also note that a song encoded with the same bitrate but by different encoders may have a very diffent quality for different encodings. When encoding to mp3 and if quality is the goal (instead of speed) always use lame! So,Â MP3Â is what we’ll be using here…
Settings to use
You can encode in basically 2 modes:
- Constant bitrate, variable quality. (CBR)
- constant quality, variable bitrate. (VBR)
For streaming purposes, the first mode is preferable. Also, mp3 has a theoretical maximum of 320 Kbit/sec and therefore, if you want to get the maximum available quality out of the codec, you should also use CBR mode. (take care: this gives very large files, if you’re obsessed with quality you may want to use lossless compression instead)
For pc and portable player playback, it is more useful to say: I want a quality which is constant throughout the file. The encoder will then use a smaller bitrate for easy to encode parts of the song and a larger bitrate for difficult parts. The disadvantage is that it is impossible to predict the bitrate which will be used. This is mostly no problem but can be in certain situations…
Several quality presets are available, you can find more in-depth information about thisÂ on the hydrogenaudio wiki.
Basically, what it boils down to is: there are 10 quality presets when working in VBR mode. They are simply named V1, V2, V3, …, V9, V10. Furthermore, you can choose between the old and new vbr algorhythm. (the new one is faster and no longer has significant quality concerns so that is what we’ll be using…)
Preset V2 is the most popular. (and is in fact the old –preset-standard) Recent listening tests have shown it might be overkill with recent lame versions however, most people had difficulty discerning the original from the encoded file at around V5! I used to encode at V4 therefore and am mostly happy with it. However, the lame compression algorhythm changes at V3: the focus of V4 is portable use while the focus of V3 is hifi use. (vastly simplified…). While I personally cannot hear a difference at V5, I want to avoid the situation where with certain files there _is_ a problem and I have to re-encode. I want to encode and be certain that not only me, but also other people who listen to the music while at my place find the quality of all songs, not just most songs, good. So I’m currently trying a few V3 encodings. I am convinced however that in 99,9 percent of cases, V3 or V4 will be good enough.
Once again, if you’re really concerned about quality and not at all about diskspace you should not be encoding to a lossy format anyway. Use a lossless codec instead.