WAV files exported from Audacity are not bit-identical

This section is now closed.
Forum rules
Audacity 1.2.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
DjBR
Posts: 54
Joined: Sun Apr 05, 2009 3:43 pm
Operating System: Please select

WAV files exported from Audacity are not bit-identical

Post by DjBR » Sun Apr 05, 2009 3:50 pm

I did some couple of tests here and I am intrigued by this behaviour in Audacity.
If I open a FLAC file, a lossless file, and export it as WAV, the resulting file is not bit-identical with source. Foobar2000's bit-comparator will tell me that there are thousands of samples mismatching.

• this behaviour persists even when not saving any WAV metadata-tags.
• this behaviour persists with any lossless source, even a clean WAV file - if it gets exported, it won't come out as the same.
• It happens on Aud 1.2.x and Aud 1.3.x Win32 (did not test linux yet).

Any clues?

kozikowski
Forum Staff
Posts: 69384
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: WAV files exported from Audacity are not bit-identical

Post by kozikowski » Mon Apr 06, 2009 4:21 am

You started the movie in the middle of the second act. What was the original and what format and specification was it? Did you restore that original specification and are you sure? Audacity likes to occasionally scramble export services particularly in the early 1.2 version.

FLAC will not manage floating point sound files. So if the original was 32-bit floating -- Audacity's famous default -- the FLAC output is undetermined if it works at all.

Koz

DjBR
Posts: 54
Joined: Sun Apr 05, 2009 3:43 pm
Operating System: Please select

Re: WAV files exported from Audacity are not bit-identical

Post by DjBR » Mon Apr 06, 2009 9:28 pm

Sorry dude, no film.

This behaviour happens opening a WAV file.
Example: opening "Depeche Mode - Wrong.wav"
exporting to "Depeche Mode - Wrong 2.wav" - nothing filled in the Metadata Editor export dialog.

result in foobar2000/bit-compare tool:

Differences found in 1 out of 1 track pairs.

Comparing:
"C:musicDepeche Mode - (2009) Wrong (Single - CDBONG40) [FLAC]1 - Wrong 2.wav"
"C:musicDepeche Mode - (2009) Wrong (Single - CDBONG40) [FLAC]1 - Wrong.wav"
Differences found: 13729839 sample(s), starting at 0.0000000 second(s), peak: 0.0003052 at 54.1567347 second(s), 1ch

Files are identical in size:
1) 32.5MB (34 080 524 bytes)
2) 32.5MB (34 080 524 bytes)

But not lossless, what's going on, what is it that I am missing.

This behaviour does not happen with cooledit pro2, there must be something ticked in Aud.

steve
Site Admin
Posts: 81652
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: WAV files exported from Audacity are not bit-identical

Post by steve » Mon Apr 06, 2009 10:58 pm

By default, Audacity works with 32 bit audio. If you import a 16 bit WAV into a 32 bit project and export it back as a 16 bit file, then the down-sampling from 32 bit to 16 bit audio will produce (probably inaudible) differences in bit values.

If you are simply cutting, deleting and pasting, then it is safe to set the project format to 16 bit and so avoid bit-depth conversions. If you are processing the sound (for example, amplifying, filtering...) then the sound quality is likely to be better by processing in 32 bit and accepting the very small errors that converting from 32bit to 16 bit will bring.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DjBR
Posts: 54
Joined: Sun Apr 05, 2009 3:43 pm
Operating System: Please select

Re: WAV files exported from Audacity are not bit-identical

Post by DjBR » Tue Apr 07, 2009 12:35 am

Thanks steve,

My setting was "Default Sampe Format" = 32-bit float, then...
I have set the "Default Sample Format" in Edit-> Preferences -> Quality, to 16-bit, I would assume that would solve the case. However, I have exported a copy, without doing anything to the file. and here is the result:

---
Differences found in 1 out of 1 track pairs.

Comparing:
"C:musicDepeche Mode - (2009) Wrong (Single - CDBONG40) [FLAC]1 - Wrong 3.wav"
"C:musicDepeche Mode - (2009) Wrong (Single - CDBONG40) [FLAC]1 - Wrong.wav"
Differences found: 13733103 sample(s), starting at 0.0000000 second(s), peak: 0.0003052 at 51.1036054 second(s), 2ch
---

it's still not lossless....

kozikowski
Forum Staff
Posts: 69384
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: WAV files exported from Audacity are not bit-identical

Post by kozikowski » Tue Apr 07, 2009 2:41 am

So this happens with straight WAV to WAV? Then the FLAC is irrelevant. We're talking simple import/export errors.

Does it get progressively worse? Keep making a new import/export with the last pass's export.

Koz

steve
Site Admin
Posts: 81652
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: WAV files exported from Audacity are not bit-identical

Post by steve » Tue Apr 07, 2009 4:43 am

It appears that Audacity is applying dither to 16 bit files on import.
I don't think that it should do that, so I will pass this on to the developers and see what they say.

In the mean time, the workaround is to switch off dither in the Quality tab of preferences.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 69384
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: WAV files exported from Audacity are not bit-identical

Post by kozikowski » Tue Apr 07, 2009 4:53 am

It is supposed to do that, but only if you export to a CD authoring system that doesn't have its own. Slight dither is the way Music CDs allow frequency response to 20KHz.

Koz

steve
Site Admin
Posts: 81652
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: WAV files exported from Audacity are not bit-identical

Post by steve » Tue Apr 07, 2009 5:38 am

No, I don't think it is supposed to do it.

In the case of CD's guessing the frequencies up to 20kHz, that should be handled by the CD player working from "nearest 16 bit values" and using algorithms built into the player to calculate the probable frequencies. This is one of the main things (apart from analogue circuitry and transport control) that distinguishes a high quality CD player from a $20 CD player. What the CD player does, is to read the 16 bit data, then upsample that data so that there are intermediate values between the read values (very much like optical scanners that offer an "optical resolution" and then a higher "interpolated resolution" - the interpolation is the scanner guessing at intermediate values between the optically read pixels so as to smooth out the curves and produce subjectively higher quality images).

In this case, it seems that Audacity is applying the dither when Importing the file, not on Export. On Importing a 16 bit file into a 16 bit project, Audacity is capable of reading the data bit perfect, but with the default settings it is failing to do so.

There is another similar instance that got raised on the developers mailing list recently when it was noticed that Audacity was applying dither when inverting tracks. Dithering should not occur for the process of inverting, as each inverted sample can be given an exact inverse value and there are no "rounding" errors that need to be smoothed out by dithering.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DjBR
Posts: 54
Joined: Sun Apr 05, 2009 3:43 pm
Operating System: Please select

Re: WAV files exported from Audacity are not bit-identical

Post by DjBR » Tue Apr 07, 2009 4:05 pm

Ok, I don't know if you guys had tried this yourselves... but here we go... Yes, FLAC is irrelevant, this whole thing can be observed with standard CD WAV files...

And I can confirm that if you keep exporting the copy from the copy, the file keeps getting changed...

I just selected the "Dither" to "None" (it was "Shaped" in the High-Quality, and "None" in Real-Time", now I got "None" and "None" in both) and now it is working properly saving losslessly, it's doing what the fellow above explained. But I don't think there is a need for that, dithering...

Locked