Articles

Creating the best sounding files: Encoding 101

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".

Some common audio formats

Uncompressed            Compressed - Lossless          Compressed - Lossy
Audio CD Apple Lossless Audio Mp3
Audio DVD TTA AAC
PCM WAV and AIFF FLAC WMA
Record Monkey's Audio Mini Disc (ATRAC)
Cassette Shorten
DAT WavPack

Re-Encoding

A common question on the Serato forums is if transcoding (converting a file from one lossy format to another), or re-encoding into the same format with better settings will result in a better quality file. The answer is a resounding "NO". The artifacts from the initial lossy encoding will still be present, along with new (possibly far worse) ones. It is a good rule of thumb to only ever lossy encode from an uncompressed source.

An example of transcoding

Audio CD ➞ AAC ➞ MP3

In the above example, the transcoding step is from AAC to MP3. The quality of encoding will be greatly reduced in the final result. The preferred alternative would be to go back to the original CD:

Audio CD ➞ MP3

Useful audio encoding links

Wikipedia audio compression article
Ars Technica article on digital audio
Wikipedia sound recording and reproduction article


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.

 

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:

Ogg
Vorbis


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. Here are a couple of examples at various bitrates:

16bit 44.1KHz Stereo
File Type Uncompressed 320kps 192kps
5 Min Track 50 MB 11 MB 7 MB
15 Min Track 150 MB 33 MB 21 MB
80 Min Mixtape 700 MB 183 MB 110 MB



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.

Wikipedia article on bitrate

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  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, although it is worth 'future proofing' your music collection by keeping the file quality as high as possible, so VBR is recommended only as a last resort.

It seems like a well established fact that you can't get away with bitrates lower than 192 kbps in a performance setting.

Beyond those starting points, it's up to you to listen to your encodings, and see what you like or not!

Good times :-)




Did you find this useful? Yes No
More Articles | Print this Article