Is 32-bit processing off a bit? Or am I doing something wrong?

Started by patmaddox, May 24, 2016, 09:56:38 PM

Previous topic - Next topic

patmaddox

Here's something interesting... if I use 32-bit with CDP_NOCLIP_FLOATS=1, I can increase the gain above 0 dBFS and then back down, with no clipping, as expected. BUT the resulting file is no longer identical to the original file! You can see it for yourself in this experiment. If you uncomment lines 57-62 you'll see that the comparison fails. And indeed, running "sndinfo diff" on the original and processed files shows that they differ starting from the very beginning. Finally, if I invert one and mix it with the other, the gain is reduced but they don't null.

So something seems to be off. I'm staying in floating point from start to finish... and while the processed file sounds identical to the original file, they are not bit-for-bit identical.

Any ideas as to what's going on? Is it CDP's fault, or mine? :)

rwdobson

I would be the one to reply to this, but as it happens I am about to go away for a week and cannot run the tests until i get back.  However, I would not expect floats to be bitwise identical after any rescaling operation (even a seemingly "exact" inverse may not prove to be so in practice, in floating-point - the lowest f/p bits are very flaky!), as there will inevitably be a cocktail of truncation and rounding errors. The precision of 32bit floats is nominally just one bit better than 24bit integers (or 6/7 decimal digits), so there will always be likely to be more or less correlated errors in the lowest bit(s). Basic conversion float/int should result in bit-identical values, but using "pure" floats I would not expect always to "get away with it" in terms of bit-identical results. The differences will need helium-cooled hardware (and ears) to detect.

patmaddox

Thanks for that explanation. I probably should have run some tests in other audio processing software before posting here!  :o

I don't know much about DSP. And I've heard that 32-bit has "virtually unlimited headroom" and you can test it out by increasing the gain a bunch in a daw, and bringing it back down, and everything sounds fine. I just assumed that meant the operations were "perfect" in increasing and lowering the gain would produce an identical file.

There's definitely no audible difference. And now I have a better understanding of what happens â€" thanks!