
Click the picture for full-size screenshot; most of the recording is fine, but at a few points this clip occurs.
As you can see it's not a regular clip: whenever the signal was too high, its polarity was apparently inversed. I doubt this is a unique problem although I haven't read much about it on the Net and the declippers I tried can't deal with it. Below I'll provide some background information on how this recording was made but I'm mostly interested in developing a fix. If there already is a fix that I don't know about, then ignore everything below and tell me.
According to me... making this fixable should be quite easy. We need only turn the "inverted" clips into regular clips (with a flat line at the max. of the waveform):

Surely it would be possible to construct an algorithm that detects the start of the clip, i.e. the sudden extremely negative slope, i.e. the drop from a very positive to a very negative value of the wave? Then in the same fashion to find the end of such a clip, by detecting the sudden postive slope?
After having thus identified the beginning and end of the clip, the area in between can be assigned a constant value corresponding to the highest values of the wave, which are found just before the 'drop' and just after the 'return'. As illustrated by the red line in the picture above.
As soon as the red line is made we have a regular clip that surely can be fixed with a regular clipfixer. So basically all that has to be programmed is a detection of the inverted clipping area. Unfortunately I'm not an experienced programmer - not even a real sound engineer. But by the maths courses and little programming I had as a chemistry student I'm convinced that fixing this wave should be possible. Of course it's not a real fix but a phoney reconstruction, but still much better than the sound I get now.
So yeah, this is what my post is actually about: is there anyone who can take this idea and turn it into a simple program / plugin? Compatibility with Audacity would be great but I can't make any demands of course. I'm just presenting this here in the hope that something good will come out of it.
By the way, if you need a sample of the recording, let me know. Is there upload functionality on these forums or should I host myself?
The promised background info.
This recording was made in the following setup:
Microphones etc. --> Samson TM500 Mixer --> MD Recorder --> Laptop
I was testing a Sennheiser wired mic instead of the AKG wireless set we usually use. Lacking a compressor I tend to use the first available link in the chain to limit the volume of each mic to a certain level, to keep the dynamic range within bounds. (The system isn't only used for recording but also for live amplificaton and I can't blow people's ears off just to get a good recording, y'know.)
For the wireless mic this link is the receiver's volume setting. The receiver would clip where appropriate and its max. output signal to the mixer was set not to clip anything further down the chain. These recordings never gave distortion like this and were straightforward to edit. I guess the AKG box handles clipping nicely.
However the Sennheiser wired mic obviously doesn't have a receiver with a volume setting, but is inserted straight into the mixer by XLR, so it clips there instead. In this situation I know I made sure that the signal sent through to the MD recorder and laptop was at an appropriate level (but of course the damage had already been done there). So I'm suspecting that the mixer just doesn't deal so well with clipping. I wish I had a compressor but that's just no option financially.
Then again I'm just a chemist doing some amateur sound engineering on the side - so my methods may well be primitive / stupid. Feel free to give advice on how to improve that.
