k y m a • t w e a k y — the kyma collective || view the current website || February 2015 Archive

/ WebHome / Sounds / Share.DistortionCancelingClipperDiscussion


Share Section



All Sections


Login / Register 
Change password
Forgot password?

Symbolic Sound

Kyma Forum
Eighth Nerve

TWiki Links

TWiki Formatting FAQ
What is TWiki?
%SESSION_ENDIF% twiki.org
Here is another approach that does not completely eradicate the clipping induced harmonic distortion, but goes a long way toward canceling the most offensive products.

The idea is to compare the signal spectrum before and after the clipping stage. Their difference must be the amplitude difference between the peaks that got clipped, as well as the host of harmonic distortion products induced by the clipping.

Lowpass filtering of that difference spectrum to isolate that portion below 2 KHz is then subtracted from the clipped signal to remove those distortion products that lie below 2 KHz. Above 2 KHz the amplitude of harmonic distortion products are down by 30 or more dB and are barely noticeable.

But the twist here is the All-Pass Filter in the direct clipped path just ahead of the lowpass filtered spectral subtraction. That AllPass filter is used to ensure that the phase of the clipped signal matches the phase shifted lowpass filtered signal so that the subtraction can be as deep as possible.

By selecting 2 KHz also for the APF and the same number of poles for it as for the lowpass filter (in this case 4 poles = 24 dB/octave rolloff), you can fiddle with the APF Q value until the cancellation is about as complete as you can achieve. I found that for 4 pole filters that value is about Q = 0.19. It is different for 2 pole filters, being about Q = 0.09, and different still if you use a 2 pole APF against a 4 pole LPF (about Q = 0.15 or so).

In this example the stereo clipper defaults to a clipping gain of 20 dB, which is sufficient to seriously clip just about any audio you pump through the Sound block. You can compare with and without cancellation using the Cancel toggle button. It is an amazing difference.

The one drawback to this approach is that you can't expect the clipper to limit amplitudes to the level indicated by the clipping gain... When you throw away harmonic distortion products, you are rounding off the squarish clipping profile, and hence making the clipped result a bit more like the original signal. Hence the amplitude of the clip reduced signal will approach the original signal amplitude as you pare away more and more of the harmonic distortion products. After all, if all of the harmonic distortion products are completely removed, you have exactly the original signal remaining -- and hence no amplitude reduction.

A hard clipper with really squared-off waveforms can be held to precisely the level you want, but in turn you have to accept serious amounts of harmonic distortion. By relaxing the requirement to hold to a particular level, you can still achieve amplitude limiting and reduced harmonic distortion products.

I have yet to quantify just where the clipper limit is with this arrangement. It does depend on the degree of clipping induced. For example, with 20 dB of clipping gain, I'm seeing full scale peak amplitudes of around -8.4 dBFS. By reducing the clipper gain to 10 dB, I'm seeing peak amplitudes of -7.3 dBFS. Still, had the system not clipped at all, then the harsh clipping boost would be red-lining the level meters continuously and that isn't happening here.

[You can do even better here by using the GraphicEQ? Sound instead of these IIR filters. There the cancellation is complete below the 2 KHz cutoff because this filter is absolutely phase linear. All you have to do in the clipped signal pathway is to introduce an identical delay, and you can easily do this by inserting a GraphicEQ? Sound inline with all gains set to unity.]

This could be considered a kind of "Soft Clipper" but that term is more generally understood as being a clipper that introduces a certain amount of harmonic anti-distortion in the waveshaper of the clipper function. Since you know that squaring off the waveforms will introduce odd-order harmonics, you can plant these same harmonics with opposite sense into the clipping waveshaper. This is most easily done by producing a Tchebyshev polynomial for the waveshaper.

- DM

-- DavidMcClain - 14 Sep 2005

© 2003-2014 by the contributing authors. / You are TWikiGuest