audio

Understanding Lossless vs Lossy audio compression (MP3 vs FLAC vs WAV)

Introduction

I've recently spent some time reading through some audio forums to increase my knowledge of audio amplifiers. I was building a headphone amplifier and wanted additional input into how the achieve the best bang for buck.

What I noticed is that there are many misconceptions about various computer audio elements that are causing many people to spend lots of money and time trying to achieve benefits in the wrong places.

Over the next few weeks I'm going to write some articles to try and dispel some of these misconceptions. My articles are going to concentrate on what can and can't effect the audio quality in a computer system (your PC), and the technical reasons why this is so.

The idea here is not to attempt to prove any subjectivists wrong over their beliefs, but to provide the information to enable them to make their own decisions.

In this article, I'm going to start off with a rather low-tech explanation of the difference between MP3 (as an example of lossy compression), FLAC (as an example of lossless compression) and WAV (an example of no compression) files.

For simplicity sake, when I refer to audio files in this article, I'm referring to CD quality 44 KHz 16 Bit rips to WAV, FLAC and MP3.

What is digital audio?

Here is a little info to form a basis of what digital audio is to help understand the following parts of this article.

Audio typically starts by being produced in the analogue world, that is, what musicians play on instruments and what we hear with our ears - this is all analogue. This analogue sound is a bunch of sound waves that are processed by a ADC (an Analogue to Digital Converter) to create a bunch of samples using a process call pulse code modulation. Don't worry about the full technical details in those links unless you're interested in them, you won't need to read or understand them to follow this article. A great detailed page to start on if you're interested in the gory details is the Wikipedia page on digital audio, but again, this is only for information and is not required for this article.

To listen to this digital audio it must be converted back into an analogue wave (sound). This is done using the opposite process by a device called an digital to analogue converter (DAC). The DAC takes the data generated by the ADC and converts it back to analogue so we can hear it.

WAV Files - No compression

WAV files are simply a set of numbers that represent the wave form (or samples) taken from the analogue world and require little to no processing to deliver to a DAC (a Digital to Analogue Converter).

A wave file just contains the numbers that the ADC produced, saved to a file. To reverse the process, the numbers are read from the file and given to a DAC that converts it back to analogue. Quite simple, not much can go wrong here.

Lossless Compression - FLAC

Flac files contain the same data as WAV files except they are compressed using a lossless compression algorithm.

I consider the algorithm used for FLAC files too complicated for this article, so instead of explaining it's implementation I'll use a simple form of lossless compression to explain how lossless compression works and why it will never lose any information due to its compression.

I'll describe a technique of substitution which is simple to understand and illustrates lossless compression well.

Let's take this simple block of text that we want to compress, but we don't want any loss of information.

i have a feline, it sat on a mat. i like the feline because his fur is black. the feline that sat, is black. the mat is black, the feline is black. his fur is on the mat.

Now, I'm providing a very loose example here that will yield poor compression, but this is only to show you how the process works.

Let's assign a number to represent each word exists in that text, we'll call this the 'map':

feline = 1
i = 2
have = 3
a = 4
it = 5
sat = 6
mat = 7
on = 8
the = 9
like = 8
his = 10
fur = 12
is = 13
that = 14
black = 15
because = 16

Now that we have a number for each word, we can replace each instance of the word with its corresponding number.

2 3 4 1, 5 6 8 4 7. 2 8 9 1 16 10 12 13 15. 9 1 14 6, 13 15. 9 7 13 15, 9 1 13 15. 10 12 13 8 9 7.

Now, as you can see that the text is compressed into a much smaller sentence. Now this is rather poor compression as you need to include the 'map' of words to numbers. This will be more effective for larger blocks of text with more repeating words. For example if our text was repeated many times the compression is more effective. Remember this technique is only for illustration purposes and is not a practical implementation of lossless compression.

As you can see, to get the original text back you would just replace each number with its corresponding word. There will be no lost information and the result will be identical to the original block of text.

As shown in this example, the data in a Flac file when uncompressed is exactly the same as the data that was used before compression, that is, there is no loss of data what-so-ever.

This is very different from lossy compression.

MP3 lossy compression

MP3s use what is called lossy compression, that is, information is lost in the compression process and the original can never be recreated from the compressed version.

The main technique behind MP3 compression is to remove parts of the audio data that is believed to no be perceivable to humans, that is, we won't hear the difference. The higher the compression rate, the more information is removed and the lower the quality. Now whether we can perceive this removed data is not part of this article, although I may touch on that in a later article.

To illustrate lossy compression, I'm going to use an even less effective compression example (and somewhat ridiculous one at that) as I want to illustrate the idea in a simple manner.

Let's take our original block of text again

i have a feline, it sat on a mat. i like the feline because his fur is black. the feline that sat, is black. the mat is black, the feline is black. his fur is on the mat.

Now if I was to attempt to compress this block of text by removing (or changing) things that I don't think make a difference, the text can still convey its message but the original will be lost, here is my attempt.

i have a cat sat on a mat i like the cat coz his fur is blck the cat that sat is blck the mat is black the cat is blck his fur is on the mat

Now, in my poor attempt to compress this block of text, I've replaced 'feline' with 'cat', removed all punctuation, misspelt 'black' as 'blck' etc. Now if I sent that text to a friend and asked them to reproduce the exact original, this could not be done it might be close, but is very unlikely to be the same. But the text still portrays a very similar message (albeit poorly).

Summary

Ok, so I've attempted to show you how lossy versus lossless compression techniques differ and why lossless is lossless, there is never any degradation of the data, when played back it will be exactly the same as the original, every time.

If you came here believing that WAV files are superior to FLAC (or other lossless compressed files) then I hope I have dispelled that misconception and you can happily compress your WAV files to FLAC knowing that you're not losing any data in the process.

Note also, that the FLAC file format allows other additional meta data like ID3 tags to be embedded in the file, such as track name, artist info, images, etc. The WAV file format does not provide this facility and is a major drawback.

I hope this has helped you, if it has or if you think I've got something wrong or could explain something better, please leave a comment.

Choosing a USB DAC Headphone amplifier - Aune mini USB DAC mini review.

I don't normally do reviews, but sometimes you find a product that just deserves a positive review.

Before I get into the review - or plug may be a better description - I want to give my opinion (everyone has one) on some claims made in the audio industry.

Choosing a USB DAC Headphone Amplifier

Diminishing returns

From my own research - once subjective claims are removed from the mix - I found there there are some significant diminishing returns in this area - that is, don't expect the increase in performance (if any) to be proportional to the amount you spend - keep this in mind when shopping for audio gear - there are a lot of very expensive products that while they often look fantastic, and seem to contain awe inspiring components, their increase in performance is usually only via the placebo effect. Be a sceptic, and don't waste enormous amounts of money based on anecdotal subjective claims regardless of the number of followers - the audio world can be like a battle of religions with many followers.

Huge range

These days there is an enormous range of USB DAC Headphone amplifiers and what ever other combination of hardware you want to mix in. These range from as low as US$40 to many $1000's.. If you're like most online shoppers, you'll use eBay as a starting place for your USB DAC shopping - there are a lot of choices, so many it takes some work to understand the differences.

DACS, bits, hertz, my head hurts!

So let's go through what I have learnt in this area, I want to break this down so it's simple for you to decide what you really need or can and will use.

Different DACs can process different signal combinations. Common ones are:

  • 16 bit 48 KHz
  • 24 bit 96 KHz
  • 24 bit 192 KHz

If your source music is from CD or tracks ripped from CD to mp3, flac, wav, etc then this source audio is 16 bit 44 KHz, such, a device that can do 16 bit 48 KHz will be sufficient - there is no benefit of having a larger bit depth or higher sampling frequency here.

If you have sources that are 24 bit 96/192 KHz then you may want to put extra consideration into the DAC capabilities.

Typically devices that support 24 bit 96/192KHz over USB require additional drivers - this might be an issue if you want portability and ease of installation.

Whereas, devices that support 16 bit 48Khz over USB typically don't require additional drivers.

24 bit 96Khz is usually available via optical or coaxial SPDIF connectivity.

Amplifier Circuit Type

There are many types of amplifier circuits, valve, mosfet, opamp, etc - the most common in USB DAC Headphone Amps are OpAmps.

OpAmps are a good choice here as they offer very low distortion, have little colouration on the output signal are cheap and are often simple to replace and test various types to suit your taste.

The Aune mini USB DAC

With that out of the way, let's look at the Aune.

If you're in the market for a USB DAC and Headphone amplifier the Aune Mini USB DAC Headphone amplifier is an excellent choice.

I purchased mine directly from the manufacturer's eBay store which I highly recommend as their service is excellent - their store representative Candy is very helpful and responds very quickly to email - usually within minutes. I have no affiliation with these guys, I just like their products and service.

Here is a picture of mine:

As you can see the front panel is a solid 8mm thick piece of aluminium, is well finished and has aune engraved (CNC machined) on it.

The components and build quality are excellent for this price range, I was very surprised when I opened mine:

As you can see, it contains quality components and is well constructed.

The underside again shows quality construction, no dry dodgy solder joints (I can't say the same for some other cheap Chinese ones that I own):

The Aune specifications:

  • Originated from the DIY project HIFIDIY.NET Mini USB DAC
  • Compatible with Windows XP/Vista/7 & Mac OS X 10.x and Linux (most variants)
  • Can be used as a DAC or headphone amp
  • OPA chip: BB OPA2134
  • Headphone AMP: Burr-Brown OPA2604+TIP41C*2+TIP42C*2 (Pull and push)
  • Digital Coaxial/USB input, RCAx2/6.35mm stereo analog output
  • Headphone amplifier built-in (TIP41C*2+TIP42C*2 (Pull and push) )
  • USB controller chip BB PCM2707
  • DIR chip -- TI DIR9001
  • Main DAC chip -- Burr-Brown PCM1793:
    - 24bit/192kHz Sampling Advanced Segment Audio Stereo DAC
    - Dynamic Range: 113 dB and THD+N: 0.001%
    - 8x Oversampling Digital Filter (from Official data-sheet)

The Aune supports 16 bit 48 KHz over USB and up to 24 bit 192KHz over SPDIF so you have the portability to play 16 bit 44 KHz sources and the SPDIF available if you need the higher source input.

Technical Note

Unlike most USB DACS, the Aune uses the PCM2707 as a USB receiver only, it then passes the received data to the PCM1793 DAC via i2s for A/D conversion - the PCM1793 has a reputation as a higher quality DAC than is commonly used and includes 8x oversampling.

Now on to the performance

I'm using my Aune with a pair of AKG K702 headphones, the Aune has no problems driving the K702s and sounds great. It is very detailed, lots of separation and has a fantastic sound stage.

I won't go into any more detail trying to describe my interpretation of the sound in 'audiophile speak'. I don't consider myself an audiophile and prefer to judge things by their performance and less by their look and status or reputation - let's try and keep the placebo effect well away from our judgement.

Conclusion

My Aune is my favourite headphone amp, it's very versatile, attractive, cheap and a solid performer. You really can't go wrong with this little amp, it's excellent value for money! As I said before, you can purchase these directly from the manufacturer's eBay store where you're sure to get great service and prompt registered delivery.

Syndicate content