WAV versus FLAC

If people report an audible difference between WAV and FLAC, almost invariably WAV is reported to sound better.
Of course there are counter claims, no audible differences at all and when these two opposing views are expressed in a forum it often becomes lively.

Most of us are not really scientist. Out testing is causal. Most of the time it is a sighted test. You know what is playing and of course the purest of the purest, the uncompressed lossless format will win.
There might be some expectation bias involved.

Is it possible that these formats do sound different?
As both are lossless a simple typical computer style test is:
• Take a WAV file
• Convert it to FLAC
• Convert the FLAC back to WAV
If you look at both WAV-files in the file system you might see a difference in size.
For some a reason to post in a forum like:


I convert WAV to FLAC and back and the file size is different. FLAC is not lossless, FLAC is BROKEN!!!!!


You better don’t. Often in these conversions some space is created in the header for tags.
If you store tags in the header, you need some space. If you run out of space the whole file must be rewritten so allocating some space a priori is a good strategy.

You need an additional step, the null test.
• load both in an audio editor
• time align
• subtract the 2 tracks.
Many have done this and the result is always the same: zero’s only.
Obvious the content is bit identical.
These types of experiments teach us that is cannot be the content of the file causing the audible difference.

Ok, might it be the player doing “something”.

An additional and intriguing experiment is to record the SPDIF out.
This is exactly what is send to the DAC.
It the player treats WAV and FLAC different, we will record different bits
• Play the WAV,
• Play the FLAC
• Record both
• Do the null test.

This type of testing is a bit rare as it does require some technical skills and recording gear.

“mitchco” compared WAV and FLAC this way and found zero difference.

 

All these testing invariably yield the same result; WAV and FLAC are bit identical.

 

Next question; if 2 files are bit identical, can they sound different?
PC based audio is PCM audio, you have the samples and the sample rate.
Correct reproduction requires to things:

Yep, the second one is known as jitter.
A logical conclusion, as PCM audio consist of 2 components, both must be right.
Any comparison of possible differences e.g. between audio formats should take both aspects into account.

 

What happens if you play WAV?
A codec will interpret the content, translating it to raw PCM.
As the content is almost identical to raw PCM, this codec has almost nothing to do so have very little impact on CPU use.
However, as the file is uncompressed, you do have a lot of I/O

 

What happens if you play FLAC?
Exactly the same, a codec will interpret the content, translating it to raw PCM.
However, as the audio is compressed, it must be unpacked. This requires more CPU.
The file is about half size compared with WAV, so I/O is substantially reduced.

 

Do we have to conclude that CPU activity is more damaging than I/O?
There are a lot of claims that I/O is detrimental to, one should use a memory player, loading the entire song in memory before playback starts (and preferably spin down the HD).

What would happen if we translate the WAV and the FLAC to PCM first, load the result in memory and start playback. Will they sound different?

 

On my PC, using Sysinternals Process Explorer (the benchmark tool for CPU usage analysis), playing a WAV file in Foobar required a scant 0.327 seconds of total CPU time from a single core of my multicore processor. This works out to about 0.2% CPU usage. Playing the exact same file in FLAC format, required 0.312 seconds of total CPU time—also about 0.2% CPU usage. These numbers are essentially the same, and the FLAC number is even slightly lower. Why? It’s likely because the CPU has to read half as much data with FLAC compared to WAV. But these numbers are so small, they really don’t matter. Other background tasks in the operating system consume far more CPU than FLAC decoding. So this alone should put the myth to rest.

NwAvGuy

Differences in CPU on a Nokia N97

ABX testing

Somehow it sounds predictable, WAV is as close as you can get to raw PCM, it the purest format. So it must sound better!

Why not use Foobar and do a ABX test.
At least the subjective part (the expectation bias) is removed from the equation by doing this.

 

It is hard to find exact documentation on the Internet about how Foobar ABX comparator works.
I understand it convert all audio to 32 bit PCM files first and then randomize them.
Great, you have 2 WAV files you can’t identify so indeed a blind test.
Not so great: if the hypothesis is that differences in sound quality between WAV and FLAC are due to the computational effort required during conversion to raw PCM, this ABX test won’t help as you are comparing bit identical  raw PCM to raw PCM.

My opinion:
DA conversion is a delicate process.
Claims about the audible threshold  of jitter vary but we probably talk nano or even pico seconds.
I think it is perfectly possible that electrical activity going on inside a PC disturbs the clock of the sound card so maps itself into sample rate jitter.
Increased system activity will decrease the sound quality.
This is pretty much like having a video card and the more system activity, the more your screen starts to blur!
One might argue that if sound quality fluctuates with system load, this indicates a design flaw.
As a consequence, on a well-designed system you won’t hear any difference and on the ones with a crappy sound card, you do.

What do we need

Somebody with that bloody expensive gear able to measure the jitter on the digital out when playing WAV or FLAC.

 

I have done more than 10 audio shows where we bootcamped and showed that both with FLAC/ALAC and AIFF/WAV that flat PCM files (AIFF/WAV) always sounded better.

So I setup a test as follows:

MacBook Pro (bootcamp Win764ULT) <==USB={USB Analyzer}==>DAC/Conveter-->Prism dScope III.

Then hanging onto to the DAC was my TEK Scope which can decode I2S and my Wavecrest DTS and a Standford 760 FFT analyzer which I use to test power supplies as it is capable of full range 1nV readings.

So in this test I compared software programs which were bit true and sound different and also some USB cables which sound different and of course file types which sound different. I have like 200 hours in testing.... so far I can't see any difference.

YET!!!!! 82% of the time people picked the Flat PCM file over the lossless.

John Atkinson and Charlie Hansen both said that I could have spent that time designing something cool. So for now that is what I am going to do!

USB Cables was kind of interesting as I did find some cases were the cables caused data errors and excess jitter on the USB side. While this does not have anything to do with Audio related Jitter errors it did seem to effect the data stream. Especially with Async feedback pipe and the host missing some of these which caused buffering errors.

Thanks
Gordon
J. Gordon Rankin


1. If we measure the power rail that feeds the main processor in the DS we can clearly see identifiable disturbance patterns due to audio decoding and network activity. These patterns do look different for WAV and FLAC - WAV shows more clearly defined peaks due to regular network activity and processing, while FLAC shows more broadband disturbance due to increased (but more random) processor activity.

2. If we measure the power rails that feed the audio clock and the DAC we see no evidence of any processor related disturbances. There is no measurable difference (down to a noise floor measured in micro-volts) between FLAC and WAV in any of the audio power rails.

3. Highly accurate measurements of clock jitter and audio distortion/noise also show no difference between WAV and FLAC.

The extensive filtering, multi-layered regulation, and careful circuit layout in the DS ensure that there is in excess of 60dB of attenuation across the audio band between the main digital supply, and the supplies that feed the DAC and the audio clock. Further, the audio components themselves add an additional degree of attenuation between their power supply and their output. Direct and indirect measurements confirm that there is no detectable interaction between processor load and audio performance.

An Linn engineer about the Linn DS

Memory playback

If the differences between WAV and FLAC are due to different noise patterns when generating the bit stream to the DAC, memory playback is the answer.
Read, decode the entire file first and store it in memory before playback starts.
Now there won’t be any difference in system activity due to the different noise patterns anymore.

More about memory playback.

Epilogue

When I wrote this article in 2012, the differences in sound quality between FLAC and WAV was often fiercly debated. Over the years the debate died down. Like so many night and day differences in audio, it is most of all a matter of sloppy testing. The proponents use a sighted test alsmost all of the time. This tells you a lot about the believe system of the observer and very little about the phenonemon observed.
Today FLAC rules as it offers both lossless audio and excellent tagging saving some bandwidth in the process.

 

References
  1. Is this test valueable? - Bibo01
  2. FLAC versus WAV - What's best forum
  3. FLAC versus WAV - Computer Audio Asylum
  4. dBpoweramp's FLAC Lossless Uncompressed - Michael Lavorgna
  5. is PCM=FLAC ? - Steve Hoffman forum

  6. Foobar2000:Components 0.9/ABX Comparator(foo abx) - Hydrogenaudio Wiki