Best way to remove distortion from bad 24/16bit conversion.

Effects, Recipes, Interfacing with other software, etc.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
synth_scotty64
Posts: 14
Joined: Thu Jun 29, 2017 8:59 am
Operating System: OS X 10.9 Mavericks

Best way to remove distortion from bad 24/16bit conversion.

Post by synth_scotty64 » Thu Jun 29, 2017 10:54 am

I have a recording that was done with a 24bit firewire recording system. Although 16bit INT WAV was choosen as the recording file format the software (Ardour) does not seem to have handled the 24bit / 16bit conversion well: Audiolevels exceeding the 16bit value range appear at the "other side" of the curve again - see attached screenshot. Is there any plugin that can detect and eliminate this form of distortion easily ? Currently I go through the samples and use "Repair" - a very laborious task.
Attachments
clipping.png
clipping.png (1.75 KiB) Viewed 1409 times
Last edited by synth_scotty64 on Thu Jun 29, 2017 7:17 pm, edited 1 time in total.

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

Re: Best way to remove distortion from bad 24/26bit conversi

Post by steve » Thu Jun 29, 2017 12:12 pm

The range of 24-bit integer audio is identical to the range of 16-bit integer audio. In both cases, sample values 'should' be normalized to a range of +/- 1. This is (should be) achieved by dividing the integer value of the sample by half the maximum value of the integer format, thus "full range", whether 8, 16, 24 or 32 bit integer, should always be +1 to -1 (in most implementations there is very slightly less than +1 because there is one less positive integer than negative).

So, in short, there is something very wrong with how those 24-bit values have been converted.

There is an experimental version of "Clip Fix" that can repair this type of "overflow inversion". It's not ideal in this case because, from your screenshot, it appears that the peaks are perfectly preserved, just that they have "wrapped around". I'll see if I can find it (it's a post somewhere on this forum), but really you need to be looking into fixing the cause of the problem, which I'm guessing is a matter of changing the recording settings in Ardour.
Learn more about Nyquist programming at audionyq.com

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

Re: Best way to remove distortion from bad 24/26bit conversi

Post by steve » Thu Jun 29, 2017 12:17 pm

steve wrote:There is an experimental version of "Clip Fix" that can repair this type of "overflow inversion".
It's here: viewtopic.php?p=180330#p180330
Please read the text in that post as it indicates important limitations of the effect.
Learn more about Nyquist programming at audionyq.com

synth_scotty64
Posts: 14
Joined: Thu Jun 29, 2017 8:59 am
Operating System: OS X 10.9 Mavericks

Re: Best way to remove distortion from bad 24/26bit conversi

Post by synth_scotty64 » Thu Jun 29, 2017 4:47 pm

steve wrote:
steve wrote:There is an experimental version of "Clip Fix" that can repair this type of "overflow inversion".
It's here: viewtopic.php?p=180330#p180330
Please read the text in that post as it indicates important limitations of the effect.
ESP Clip Fix saved my day :D ! As it says in the quoted post it is not HiFi, but my recording is a voice recording so I am more than satisfied with the outcome. The Plug-In has a tendency to crash Audacity when the selected region is too long (even with 16Gb of RAM), but that is still much more than the 128 samples limitation of "Repair".
Thanks a lot!

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

Re: Best way to remove distortion from bad 24/26bit conversi

Post by steve » Thu Jun 29, 2017 5:08 pm

synth_scotty64 wrote:The Plug-In has a tendency to crash Audacity when the selected region is too long
That's the main reason that it is still buried away on the forum rather than with the "published" plug-in on the Audacity wiki.

Glad it was useful :)
Learn more about Nyquist programming at audionyq.com

DVDdoug
Posts: 10154
Joined: Fri Sep 10, 2010 11:30 pm
Operating System: Windows 10 / 11

Re: Best way to remove distortion from bad 24/26bit conversi

Post by DVDdoug » Thu Jun 29, 2017 6:12 pm

You might want to check with the Ardour community to see if they have a fix. It looks like there's enough "information" in waveform that a programmer could write an algorithm to repair it.

I kind-of know how that's happening and I don't think it's related to the 24-to-16 bit conversion... That shouldn't be happening and it's a serious bug! It could be a defective driver, or it could be Ardour. It probably won't happen if you keep your levels below 0dB. It probably happened in Ardour after recording when you were editing, adjusting levels, mixing, or applying effects, etc. Did you do any of that in Ardour? Did you use any "amateur" 3rd party effect plug-ins?




------------------------------------------------------------
Signed integers are stored in binary as two's compliment where the most significant bit is the sign bit.

So for example, if you make a "dumb" integer-counter program that "counts-up forever", at some point the counter overflows and "rolls over", the sign-bit becomes one (indicating a negative) and it starts with the maximum negative number and starts counting-down* with a negative sign (technically it's counting-up, getting less negative). When it gets back to zero the cycle starts-over.


That's exactly what you're seeing... Binary roll-over... With audio, this can happen if you digitally boost the gain, or boost the bass, or mix, or do anything that pushes the levels above the maximum (0dBFS). But, the programmer should be careful about how "overflow" is handled.

Audio software should not "roll over", but it should clip. Clipping is undesirable too, but it doesn't sound as bad as roll-over.

Note that Audacity (like most audio editors) uses floating-point internally so Audacity itself won't clip or roll-over. But, "regular" WAV files, your ADC, and your DAC will all clip at 0dB.




* If it were "normal" one's compliment, the sign bit would flip to 1, and it would start counting negative numbers "up" from "negative zero".

synth_scotty64
Posts: 14
Joined: Thu Jun 29, 2017 8:59 am
Operating System: OS X 10.9 Mavericks

Re: Best way to remove distortion from bad 24/26bit conversi

Post by synth_scotty64 » Thu Jun 29, 2017 7:22 pm

DVDdoug wrote:You might want to check with the Ardour community to see if they have a fix.
That's exactly what you're seeing... Binary roll-over... With audio, this can happen if you digitally boost the gain, or boost the bass, or mix, or do anything that pushes the levels above the maximum (0dBFS). But, the programmer should be careful about how "overflow" is handled. Audio software should not "roll over", but it should clip. Clipping is undesirable too, but it doesn't sound as bad as roll-over.
I have created a post in the Ardour forum - lets see if this is known to them. The rollover happens in or before Ardour records because I can see the strange waveforms alredy when I zoom in on Ardour.

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

Re: Best way to remove distortion from bad 24/16bit conversi

Post by steve » Thu Jun 29, 2017 7:46 pm

If you could post a short sample in WAV format, I may be able to provide a better quality way to fix it.
See here for how to attach an audio sample (must be WAV format in this case, not MP3) viewtopic.php?f=49&t=72887
Learn more about Nyquist programming at audionyq.com

Post Reply