• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Converting WAV to FLAC which FLAC Level is sufficient

Almost all compression formats include the option to store a chunk of data verbatim. The reason for this is that there will always exists inputs that the chosen algorithm can't compress. When such a block is encountered, the most efficient action is to simply store it unaltered since applying the coding method would actually make it larger. This is an unavoidable mathematical fact in any lossless compression scheme.
Plus you get the meta-data features of flac.
 
As the compression is reduced the harder it was to appreciate the difference. That is, it is easier with FLAC 8 than with FLAC 4, hence I expected it to be more difficult or imposible with FLAC 0.
I don't know if you took a look at that link for the decoding speeds but here:
To decode a audio file compressed with FLAC -8 (which seems the slowest of the FLAC options in that graph to decode) that stupidly slow (by modern standards) Athlon XP takes 1 minute and 40 seconds which is 120 times less than the total time of the audio lenght (3h 18m 21s 240ms).
In simple words now, with our modern PCs, you already have the decoded stream available before it even arrives to the physical USB port when it requested the data (if you use a USB DAC).
 
Let's look at this somewhat methodically


PS C:\Users\admin\Music\Rosalyn Tureck> ls
Directory: C:\Users\admin\Music\Rosalyn Tureck
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/19/2019 5:44 PM Bach- Goldberg Variations [Disc 1]
PS C:\Users\admin\Music\Rosalyn Tureck> cd '.\Bach- Goldberg Variations `[Disc 1`]'
PS C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]> ls 01*
Directory: C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/21/2019 11:19 PM 12777301 01 Bach- Goldberg Variations, BWV 988 - Aria.flac
-a---- 3/21/2019 11:19 PM 49921244 01 Bach- Goldberg Variations, BWV 988 - Aria.wav
-a---- 3/21/2019 11:19 PM 49921508 01ori Bach- Goldberg Variations, BWV 988 - Aria.wav

Here we have a bit perfect EAC extraction, which is the 01ori file. It has been compressed to flac with the xiph encoder using -d8 then decoded back to wav. As you can see the file lost a bit of metadata, but that is all there is to it as shown by this comparison in delta-wave

1560960209689.png


What has been shown here is that FLAC decoding is bit perfect. Not a surprise to everyone who knows how flac works, but worth restating.

In the next step, I just downloaded foobar (which I don't usually use), audacity (which I also don't usually use) and some virtual cable device driver and I recorded, manually, foobar's output into audacity.

Here is the result, zoomed to show one of the most drastic differences I could visually identify

1560960590711.png


As a control, I recorded 2 wav to wav files using the same process -

(edit: wrong chart - will update)
(edit 2: hiccup on that one, will redo)

1560963802593.png

As another control, I compared the recorded wav file to the original

1560961249504.png


as you can see, the result is very good and the level of differences closely matches the one observed between flac and wav playback.

Now, again, two controls on the FLAC file being played by foobar in a "quiet" system - there are differences but well below audibility

1560962363559.png


And - the very interesting part, even if I don't like it, the same control recording flac vs flac with 4 threads of Prime95 running.
I have re-run that test a few times because I was a bit surprised by it.


1560962545979.png


So, a lot of the minor differences can be explained by the different decoders (it seems foobar relies on ffmpeg but not 100% sure), the number format and accuracy issues (including in delta wave), process.

But I am forced to admit that system load does matter, at least when it is extreme... In that case, the differences are still below my audibility threshold, but it is very hard to deny that they can exist (when the decoding happens on the PC).

One final comment: I did this experiment thinking "Let's show Maty how wrong he is on that". I do not like the result, I don't believe it is audible in my system (my cooler noise level was quite high anyway) but still, there is an objective difference and what you see here is the summary of multiple tests.

I am open to comments ofc.
 

Attachments

  • 1560960992451.png
    1560960992451.png
    93.4 KB · Views: 188
Last edited:
Let's look at this somewhat methodically


PS C:\Users\admin\Music\Rosalyn Tureck> ls
Directory: C:\Users\admin\Music\Rosalyn Tureck
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/19/2019 5:44 PM Bach- Goldberg Variations [Disc 1]
PS C:\Users\admin\Music\Rosalyn Tureck> cd '.\Bach- Goldberg Variations `[Disc 1`]'
PS C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]> ls 01*
Directory: C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/21/2019 11:19 PM 12777301 01 Bach- Goldberg Variations, BWV 988 - Aria.flac
-a---- 3/21/2019 11:19 PM 49921244 01 Bach- Goldberg Variations, BWV 988 - Aria.wav
-a---- 3/21/2019 11:19 PM 49921508 01ori Bach- Goldberg Variations, BWV 988 - Aria.wav

Here we have a bit perfect EAC extraction, which is the 01ori file. It has been compressed to flac with the xiph encoder using -d8 then decoded back to wav. As you can see the file lost a bit of metadata, but that is all there is to it as shown by this comparison in delta-wave

View attachment 27918

What has been shown here is that FLAC decoding is bit perfect. Not a surprise to everyone who knows how flac works, but worth restating.

In the next step, I just downloaded foobar (which I don't usually use), audacity (which I also don't usually use) and some virtual cable device driver and I recorded, manually, foobar's output into audacity.

Here is the result, zoomed to show one of the most drastic differences I could visually identify

View attachment 27919

As a control, I recorded 2 wav to wav files using the same process -

(edit: wrong chart - will update)

As another control, I compared the recorded wav file to the original

View attachment 27921

as you can see, the result is very good and the level of differences closely matches the one observed between flac and wav playback.

Now, again, two controls on the FLAC file being played by foobar in a "quiet" system - there are differences but well below audibility

View attachment 27924

And - the very interesting part, even if I don't like it, the same control recording flac vs flac with 4 threads of Prime95 running.
I have re-run that test a few times because I was a bit surprised by it.


View attachment 27925

So, a lot of the minor differences can be explained by the different decoders (it seems foobar relies on ffmpeg but not 100% sure), the number format and accuracy issues (including in delta wave), process.

But I am forced to admit that system load does matter, at least when it is extreme... In that case, the differences are still below my audibility threshold, but it is very hard to deny that they can exist (when the decoding happens on the PC).

One final comment: I did this experiment thinking "Let's show Maty how wrong he is on that". I do not like the result, I don't believe it is audible in my system (my cooler noise level was quite high anyway) but still, there is an objective difference and what you see here is the summary of multiple tests.

I am open to comments ofc.
Yes, when running highly demanding tasks measurable differences can occur:
https://hydrogenaud.io/index.php/topic,100481.0.html
 
Let's look at this somewhat methodically


PS C:\Users\admin\Music\Rosalyn Tureck> ls
Directory: C:\Users\admin\Music\Rosalyn Tureck
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/19/2019 5:44 PM Bach- Goldberg Variations [Disc 1]
PS C:\Users\admin\Music\Rosalyn Tureck> cd '.\Bach- Goldberg Variations `[Disc 1`]'
PS C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]> ls 01*
Directory: C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/21/2019 11:19 PM 12777301 01 Bach- Goldberg Variations, BWV 988 - Aria.flac
-a---- 3/21/2019 11:19 PM 49921244 01 Bach- Goldberg Variations, BWV 988 - Aria.wav
-a---- 3/21/2019 11:19 PM 49921508 01ori Bach- Goldberg Variations, BWV 988 - Aria.wav

Here we have a bit perfect EAC extraction, which is the 01ori file. It has been compressed to flac with the xiph encoder using -d8 then decoded back to wav. As you can see the file lost a bit of metadata, but that is all there is to it as shown by this comparison in delta-wave

View attachment 27918

What has been shown here is that FLAC decoding is bit perfect. Not a surprise to everyone who knows how flac works, but worth restating.

In the next step, I just downloaded foobar (which I don't usually use), audacity (which I also don't usually use) and some virtual cable device driver and I recorded, manually, foobar's output into audacity.

Here is the result, zoomed to show one of the most drastic differences I could visually identify

View attachment 27919

As a control, I recorded 2 wav to wav files using the same process -

(edit: wrong chart - will update)
(edit 2: hiccup on that one, will redo)

View attachment 27928
As another control, I compared the recorded wav file to the original

View attachment 27921

as you can see, the result is very good and the level of differences closely matches the one observed between flac and wav playback.

Now, again, two controls on the FLAC file being played by foobar in a "quiet" system - there are differences but well below audibility

View attachment 27924

And - the very interesting part, even if I don't like it, the same control recording flac vs flac with 4 threads of Prime95 running.
I have re-run that test a few times because I was a bit surprised by it.


View attachment 27925

So, a lot of the minor differences can be explained by the different decoders (it seems foobar relies on ffmpeg but not 100% sure), the number format and accuracy issues (including in delta wave), process.

But I am forced to admit that system load does matter, at least when it is extreme... In that case, the differences are still below my audibility threshold, but it is very hard to deny that they can exist (when the decoding happens on the PC).

One final comment: I did this experiment thinking "Let's show Maty how wrong he is on that". I do not like the result, I don't believe it is audible in my system (my cooler noise level was quite high anyway) but still, there is an objective difference and what you see here is the summary of multiple tests.

I am open to comments ofc.
What happens if you change the OS priority of the audio apps during recording to high, and prime 95 to low?
 
Let's look at this somewhat methodically


PS C:\Users\admin\Music\Rosalyn Tureck> ls
Directory: C:\Users\admin\Music\Rosalyn Tureck
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 6/19/2019 5:44 PM Bach- Goldberg Variations [Disc 1]
PS C:\Users\admin\Music\Rosalyn Tureck> cd '.\Bach- Goldberg Variations `[Disc 1`]'
PS C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]> ls 01*
Directory: C:\Users\admin\Music\Rosalyn Tureck\Bach- Goldberg Variations [Disc 1]
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/21/2019 11:19 PM 12777301 01 Bach- Goldberg Variations, BWV 988 - Aria.flac
-a---- 3/21/2019 11:19 PM 49921244 01 Bach- Goldberg Variations, BWV 988 - Aria.wav
-a---- 3/21/2019 11:19 PM 49921508 01ori Bach- Goldberg Variations, BWV 988 - Aria.wav

Here we have a bit perfect EAC extraction, which is the 01ori file. It has been compressed to flac with the xiph encoder using -d8 then decoded back to wav. As you can see the file lost a bit of metadata, but that is all there is to it as shown by this comparison in delta-wave

View attachment 27918

What has been shown here is that FLAC decoding is bit perfect. Not a surprise to everyone who knows how flac works, but worth restating.

In the next step, I just downloaded foobar (which I don't usually use), audacity (which I also don't usually use) and some virtual cable device driver and I recorded, manually, foobar's output into audacity.

Here is the result, zoomed to show one of the most drastic differences I could visually identify

View attachment 27919

As a control, I recorded 2 wav to wav files using the same process -

(edit: wrong chart - will update)
(edit 2: hiccup on that one, will redo)

View attachment 27928
As another control, I compared the recorded wav file to the original

View attachment 27921

as you can see, the result is very good and the level of differences closely matches the one observed between flac and wav playback.

Now, again, two controls on the FLAC file being played by foobar in a "quiet" system - there are differences but well below audibility

View attachment 27924

And - the very interesting part, even if I don't like it, the same control recording flac vs flac with 4 threads of Prime95 running.
I have re-run that test a few times because I was a bit surprised by it.


View attachment 27925

So, a lot of the minor differences can be explained by the different decoders (it seems foobar relies on ffmpeg but not 100% sure), the number format and accuracy issues (including in delta wave), process.

But I am forced to admit that system load does matter, at least when it is extreme... In that case, the differences are still below my audibility threshold, but it is very hard to deny that they can exist (when the decoding happens on the PC).

One final comment: I did this experiment thinking "Let's show Maty how wrong he is on that". I do not like the result, I don't believe it is audible in my system (my cooler noise level was quite high anyway) but still, there is an objective difference and what you see here is the summary of multiple tests.

I am open to comments ofc.

What does a virtual cable driver do? Is it bit-perfect, or applying DSP to the signal? Make sure Audacity and Foobar are also set to their best settings, as well as the OS-level DSP and volume controls turned off. All of these might have some effect on the capture.
 
What does a virtual cable driver do? Is it bit-perfect, or applying DSP to the signal? Make sure Audacity and Foobar are also set to their best settings, as well as the OS-level DSP turned off. All of these might have some effect on the capture.

Yes, I will have another look as soon as I have time. Being the archetypal "bits are bits" guy (for a few years my main activity involved breaking crypto implementations), this "mess" annoys me profoundly ;)
 
Yes, I will have another look as soon as I have time. Being the archetypal "bits are bits" guy (for a few years my main activity involved breaking crypto implementations), this "mess" annoys me profoundly ;)
So these are pure digital recordings? In this case my results are very consistent with -inf dB null depth. DeltaWave is not needed for digital loopback test since there will be no drift.
 
What does a virtual cable driver do? Is it bit-perfect, or applying DSP to the signal? Make sure Audacity and Foobar are also set to their best settings, as well as the OS-level DSP and volume controls turned off. All of these might have some effect on the capture.

I know the virtual cable has two variants, a bitperfect one that allows no volume control among other things and the standard one.
That first one could definitely be part of the measured distortion, the Hi-Fi one should be better in theory but more constrained in use.
 
I know the virtual cable has two variants, a bitperfect one that allows no volume control among other things and the standard one.
That first one could definitely be part of the measured distortion, the Hi-Fi one should be better in theory but more constrained in use.
So cables make differences, even the virtual ones:D
 
Yes, I will have another look as soon as I have time. Being the archetypal "bits are bits" guy (for a few years my main activity involved breaking crypto implementations), this "mess" annoys me profoundly ;)

I've done this type of capture many times on the Mac. Also, using external digital connectors (SPDIF converters, dejittering devices, etc.) to a digital recorder on the other side. I've never seen digital transmission lose bits unless there's something in software or hardware that's altering them, like sampling rate change, volume control, or other types of DSP.

Just tried a recording from HQPlayer through virtual audio device into Audacity, while running Prime95 torture test for half of it. Here's the result:

1560968561668.png
 
PierreV, do you have your OS optimized to play multimedia? The last steps I do not have automated and sometimes I forget. When it is not optimized, the differences are less audible.

Two days ago: https://www.diyaudio.com/forums/music/6958-playing-listening-post5826470.html

Beautiful music. I have been listening to it for many years and I'm not tired of it.

By the way, I had not fully optimized the Win 10 for multimedia. I just did it and I listen to the last track, 24. The Verdict/End Titles, again and what a difference! The recording seems different.

One of the things that I took into account when I bought the PC was to make sure all the fans were silent, including the power source (and with low DC ripple too at 5 V).
 
Last edited:
I've done this type of capture many times on the Mac. Also, using external digital connectors (SPDIF converters, dejittering devices, etc.) to a digital recorder on the other side. I've never seen digital transmission lose bits unless there's something in software or hardware that's altering them, like sampling rate change, volume control, or other types of DSP.

Yes, that's what I expected. But even leaving aside all the possible sources of mismatch/eventual resampling, I remain annoyed that this mismatch/eventual resampling varies with the load. Can't wrap my head around it at this point. Will keep experimenting.
 
Not really. Today probably everything would handle level 8 without issues. Back in the days some portable players struggled with higher level FLAC. Anyway, I would stick to 5.

You will gain nothing more than wasted HDD space ;)

24-bit FLAC will probably still be smaller than 16-bit WAV.
 
Yes, that's what I expected. But even leaving aside all the possible sources of mismatch/eventual resampling, I remain annoyed that this mismatch/eventual resampling varies with the load. Can't wrap my head around it at this point. Will keep experimenting.

Strange, but there must be something not configured right. Digital capture should be bit perfect when no DSP is applied.

I just tried a test with an DAC/ADC loopback test on the Mac. This is with a digital-to-analog-to-digital conversion using Element24 interface. One sample captured with CPU running idle, the other with Prime95 torture test running. The difference in RMS nulls was less than 1dB at around -100dB, no additional clock drift, and better than 110dB correlated null in both. In other words, almost exactly the same result with the CPU stressed and idle.
 
Yes, when running highly demanding tasks measurable differences can occur:
https://hydrogenaud.io/index.php/topic,100481.0.html
In your link the differences are found/measured on the analog output stage of a PC sound card.
My previous HTPC had a highly audible SSD(*): any activity there was audible on the analog out of the motherboard sound card, so these findings don't surprise me at all.

(*) The SSD is an example of "any" internal PC component that may cause audible distortions.
 
Last edited:
https://en.wikipedia.org/wiki/FLAC#Compression_levels

1563568147281.png


With a worst case (in this example) decoding rate difference of 15 seconds on a 2gig (that's 3 big CDs) file, I don't see a decoding problem with higher compression rates.

Looking at the compressed sizes, there isn't much advantage above dash 5.
 
In your link the differences are found/measured on the analog output stage of a PC sound card.
My previous HTPC had a highly audible SSD: any activity there was audible on the analog out of the motherboard sound card, so these findings don't surprise me at all.
If you read every post in the whole thread carefully, my results were affected by GPU load, not SSD or any other storage devices. The date of the thread is 2013, I don't have an SSD at that time.

Also, external devices can also be affected by PC interference, and much more severe:
https://www.audiosciencereview.com/...-asus-with-a-pcie-sound-card.6104/post-199165
 
Back
Top Bottom