Creating the best sounding files: Encoding 101

Source: ScratchLIVE.net
What is encoding?
Encoding is the process of changing the format digital audio is stored in. There are two broad types of encoding; compressed and uncompressed. Uncompressed audio is mainly found in the PCM format of audio CDs. For the most part, audio encoding means going from uncompressed PCM, to some kind of compressed audio format.
Compressed audio is split into two groups, lossless and lossy. Losslessly compressed audio can be decoded back into the exact uncompressed audio you started with. This is useful for archiving audio at the highest quality possible, and for people for whom storage space is not an issue. Lossy compression involves some loss of information hence the term “lossy”.
File formats and codecs
Uncompressed
WAV and AIFF
WAV and AIFF are the standard file formats for uncompressed PCM audio. Generally they will be the source material for your lossy encoded files, unless you skip the step of making uncompressed files and go straight from CD to lossy compressed encodings.
The best practice would be to archive your uncompressed files somewhere, and keep them to make new encodings from as technology improves, or for purposes of keeping a backup.
For more information check out the Wikpedia pages on them: WAV and AIFF
Compressed
MP3
MP3 is the compressed format most prevalent on the internet and most universally supported by media players. It uses lossy compression to greatly reduce the amount of data needed to store the audio. For DJing applications, care should be taken not to reduce the amount of data too far, to maintain the audio quality of your files.
AAC
AAC is a more recent technology, intended as the successor to MP3. It is the default encoder in Apple iTunes and is part of the MPEG-4 specification. While AAC has many improvements over MP3, it is less widely adopted at the time of writing, for instance AAC support in Scratch LIVE will be added in version 1.8, and isn’t currently on release.
Ogg Vorbis
Ogg is an open source container format which can contain all sorts of media, Vorbis is the open source lossy audio compression format which uses the Ogg containers.
Check out more information on Ogg Vorbis here:
Encoding tools
What is an encoding tool?
Encoding tools are programs which create audio files in a particular format, generally with options for adjusting various aspects of the file encoding process.
Here are a couple of basic options for getting started with making your own files.
iTunes
iTunes comes pre-installed on all Mac computers, and is available free from Apple for Windows. iTunes can encode files of various formats and settings
For more information on iTunes, check out the introduction to iTunes article.
LAME Frontends
LAME is a free MP3 encoder which is generally considered to give the highest quality results for VBR encodings at a given bitrate.
RazorLame is a LAME frontend for Windows, however it doesn’t rip CDs.
Max is a Mac LAME frontend which includes CD ripping functionality.
Encoder settings
Bitrate
A file’s bitrate is how many bits per second are used to represent the audio. So a 128 kbps file uses 128,000 bits per second to encode an audio signal. The more bits used, the less information is discarded to create a compressed file.
Bitrate therefore determines the size of a file.
Variable Bitrate
Variable bitrate (VBR) is a way of saving disk space. The bitrate setting chosen is used as the maximum bitrate to be used, and when the encoding algorithm decides it can get away with using less bits to accurately represent a part of the audio, it does. Thus the bitrate changes over the length of the file, hence the term variable bitrate. Variable bitrate files can take slightly more CPU to decode than constant bitrate files, due to the changing amount of bits.
Constant Bitrate
The meaning of constant bitrate or CBR is obvious. The same number of bits are used to encode every second of audio.
Joint Stereo
Joint stereo is a technique where instead of encoding the left and right channels separately, the sum and difference of both are encoded instead. Since both sides will tend to be very similar, the difference will not require a lot of data, and thus the size of the file is smaller than ‘normal’ stereo. This means more of the bits can be used for the ‘important’ information, and thus the quality will tend to be improved. It should be noted that some experts think joint stereo techniques can impart artifacts on the audio, but in general joint stereo is a good thing.
Joint Stereo: The Myths and The Realities
Some recommended starting points
If you have plenty of storage, and want the best quality you can, the standard is 320 kbps CBR Joint Stereo. If you find that you don’t have enough room to store all your music at that quality, a good compromise would be 224 kbps VBR joint stereo.
It seems like a well established fact that you can’t get away with bitrates lower than 192 kbps in a performance setting.