Don't fear compression

I'm going to return to lossy and lossless compression this week. A common concern I see about lossless audio is that it's a form of compression, and compression is bad because the original data is somehow lost.

Audio data is data like any other. It's important to remember that both lossy and lossless are types of compression. But, most importantly, compression can be achieved without loss of data. Therefore, lossless encoding audio can always be recovered to the original data.

To the drawing board

One of the simplest forms of compression is also lossless. It's easy to describe and understand. It's called run-length encoding.

Imagine a sequence of letters:

aaaabbbbb

These letters are data. Therefore they can have a compression algorithm run on them to derive a compressed representation:

4a5b

This is one approach to run-length encoding; sequential identical datums are replaced with a quantity preceding the datum. We've better-than halved the data length.

Importantly, this is a lossless compression algorithm. The exact same data can be recreated from the RLE-encoded data.

Lossless audio

This is what is meant by lossless compressed audio. It's audio that has typically been re-encoded to occupy much fewer bytes but the original source data is recoverable.

So it's important to not fear the compression bogeyman; compression will enable you to store more music at no real loss of inconvenience.

Everything has a cost

It's not true to say that's the end of the matter. The very action of compressing/decompressing the data set; lossy, lossless or whatever; is in itself work and therefore has a cost. This cost is mostly manifest as time, although it's unlikely you'll be able to perceive the milliseconds (if that!) required to perform the work in the example above!

However, we typically perform work on much larger data sets, like music files, which requires more work. Some audiophiles theorise this work can cause interference, in the form of CPU, potentially extra I/O work and more, and this can degrade audio quality.

But that's theory. As the effect is very context dependent (e.g. isolation between hardware components) it's really something you can only judge for yourself.

Thanks to unsplash-logoMatt Artz for the image above.
tags: codecs

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.