The standard Clip Fix uses a relatively simple algorithm to determine clipped audio. It looks for flat peaks and the necessary “flatness” of the peak for correction to be applied is determined by the slider control (“Threshold of Clipping %”).
Because it is working from the maximum sample present value rather than an absolute amplitude, audio that has the peaks clipped flat at say -18dB will still be de-clipped correctly. In fact, when using the effect, you will generally need to reduce the overall amplitude to allow space for the peaks to be reconstructed, so the audio that is being corrected should always be substantially lower than 0dB. The information on the plug-in window recommends allowing 10dB of headroom.
The way that “flatness of the peaks” is determined (as far as I can tell) is by the plug-in looking for the maximum sample value, then comparing individual samples with that maximum value. If they lie within the range that has been set (the default is 95% of the maximum value) then the sample is included in the area for reconstruction.
Obviously this does allow some samples to be incorrectly selected for correction as all samples that are above 95% of the maximum are assumed to be clipped. In practice this is not a problem because of the simple but clever way that Clip Fix corrects clipped audio. Clip Fix will “mark” the region that has “clipped samples” on a wave peak, and will then look at the slope on either side of that region. The slope will then be extrapolated (using cubic spline interpolation) across the marked region. In the case of a few samples that have NOT been clipped having values over 95% of the maximum, they will in all probability already lie extremely close to the “correct” waveform as determined by Clip Fix, so the amount of correction that is applied is insignificant.
Using cubic spline interpolation is also nice in that the reconstructed audio is unobtrusive. It does not carry the “tonal character” of the surrounding audio, but will generally have the effect of restoring greatly clipped peaks more than slightly clipped peaks (which is what is required). Any samples below the (95%) threshold are unchanged by the plug-in, so unnecessary distortion is kept to a minimum and the effect produces subjectively pleasant results.
In such cases as “Fuzz Guitar”, then although the audio may sound similar to clipped audio, it will often look very different to Clip Fix. Harmonics and phase shifts present will often present a spiky waveform rather than a flat topped waveform, and in this case the audio will not be considered “clipped”. However in the case of a simple “diode clipping” fuzz that has been DI’d (plugged directly into the recorder), then waveform may match the “flat topped” characteristics that Clip Fix is looking for, and the audio would be “corrected”, making the sound “cleaner”.
The main limitations of Clip Fix are that it only works on audio that has peaks that have been clipped (probably why it is called “Clip Fix”).
Other forms of distortion can not be repaired by this effect.
In the case of a live recording of a band, you may have a perfect example of clipping on the lead vocal microphone, but by the time the sound has travelled across the room to your recording microphone and been mixed with the sound of the other instruments and the audience, the waveform that you have recorded will look nothing like the flat topped clipping that Clip Fix can work on and the audio would be hardly affected at all by Clip Fix. The only way that Clip Fix could work in this scenario is if you had a direct “off the desk” separate track with the lead vocal microphone.
Another example of when Clip Fix will not work is when there is “polarity inversion” of the clipped audio - (the issue that started this thread). As I said way back then, audio equipment should be better behaved and polarity inversion should not happen… but sometimes it does. This is the issue that my modification addresses.
For anyone interested, the algorithm that I have used is describe near the begining of this thread.
As the audio is being processed, ESP-Clip-Fix will look for inverted clips and if found will convert them to flat clipping. The audio is then processed by Clip-Fix in the normal way.
How could I refuse 
I have used the name “ESP Clip Fix” simply to distinguish my modified version from the original so that I can have both versions installed simultaneously. (I use the “ESP” prefix for all of my plug-ins). If it was included in the “official release” then there would be no need for the distinction, so calling it “Clip Fix” would be fine.
I doubt that I will have time before the new year, but it should not take long to do.
My code may not be the optimum due to my lack of knowledge in using Nyquist, but I’m sure that there are some developers that could cast an eye over it and tidy it up if necessary. Also, I am unable to test the modification on long sections of audio as my computer is too low specification, so it would require testing by others.
As the issue of inverted polarity is not very common, I was thinking of adding a check box for enabling (polarity correction) such that my code was normally bypassed. What do you think?