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

/ WebHome / Sounds / Share.DistortionFreeClipperDiscussion


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
How can that be???

Well this is one stab at the problem... In order to avoid clipping harmonic distortion, I use the Hilbert Transform to rotate the entire spectrum up by 6 KHz. Then I clip by applying strong Gain and then its inverse Attenuation [remember the DSP saturates at +/-1]. Then I rotate the entire spectrum back down to where it belongs.

This sound really ought to run at 96 KHz sample rates or even higher. 480 KHz would be just dandy! The clipping creates odd harmonics of the clipped waves, and so since we rotated up by 6 KHz, the first harmonic will be at 18 KHz, then 30 KHz, and finally 42 KHz. The rest of the series will alias back down again, with 54 KHz going back down to 42 KHz, and so on... Of course the 20 KHz waves will alias even more strongly.

But since most music has very little power above 16 KHz, it is fair to say that what aliased distortion products are present in the baseband spectrum, will be very slight and probably unnoticeable. Once we rotate the spectrum back where it belongs, there will be some harmonics starting at 12 KHz and higher.

[Note that after rotating the spectrum back down to DC, the harmonics no longer yield a musically harmonic series. What was 7 KHz, 21 KHz, 35 KHz..., becomes 1 KHz, 15 KHz, 29 KHz, ... This would probably sound really bad if we hadn't shifted high enough (e.g., 6 Khz) so that the first harmonics are in the highest registers of our hearing where our pitch perception is completely lacking.]

[so I lied... there are some harmonic distortion products, but probably unnoticeable to human ears except under contrived listening situations. Music should sound just fine.]

After rotating the clipped spectrum back down to DC, I apply a 4-pole 16 KHz lowpass filter to do away with all the higher harmonics produced by clipping.

The net result is a cleanly clipped signal that tends to run at peaks of around 2.8 dB higher than you request with the Gain (NOTE: Gain = negative of Threshold for clipping). So I take out that extra amplitude in the final low-pass filter. That extra stuff comes from the harmonics that do survive prior to the low-pass filtering.

So what does it actually mean to have a distortionless clipper? This is very similar in operation to so-called RF Speech Processors found on modern SSB transceivers. The idea is to translate the speech spectrum up to radio frequencies and then apply clipping. The harmonics fall outside the IF passband of the radio and so on moving the speech backdown to baseband frequencies, none of the harmonics survive. The net result is that the fundamentals of the pitches do survive but with diminished amplitude. Diminished just enough to keep the overall sum power below your chosen Threshold. But no flat-topping of the waveforms!!

Why use clipping? Well clipping introduces harmonic distortion -- which we attempt to control here. The other approach is amplitude modulation via limiting. But limiting introduces its own kind of distortion, IMD (intermodulation distortion) as a result of AM modulating the sound with the limiter envelope. Six of one, half dozen of the other.

So what kind of distortion do we have here with this "distortionless clipper"? Well, if all the harmonic distortion products were discarded, then only the wave fundamentals survive, and they must have been amplitude modulated. Hence the result would be pure IMD again. With some harmonic distortion products, we have a less pure IMD situation, but in this case probably mostly IMD... The result is like a superfast attack/release brick-wall limiter. If you drive this clipper too hard, you will certainly notice the distortion. But if you only push by 3-10 dB then you will be hard pressed to hear it.


[PS: You will notice some 6 dB Boost Gain blocks in the processing chains. Those are there because the result of performing the Hilbert Transform gives me a 1-sided spectrum (positive frequencies only!!). If a signal has amplitude A, then the positive frequencies have amplitude A/2, as do the negative frequencies. So the gain blocks simply compensate for our having thrown away half of the signal through the Hilbert Transform.

The Hilbert Transform discards the negative frequencies so that when we rotate the spectrum we don't also get a frequency reversed copy of the DC end of the spectrum following us around. Also, the Nyquist end of the spectrum is fed by zero values from the discarded negative half of the spectrum when we rotate back down to baseband.

Conventional Ring Modulation produces two copies of the baseband spectrum -- one low and one high, and they move in opposite directions. By using the Hilbert Transform to gain a 1-sided spectrum, we avoid those artifacts and we can cleanly shift the spectrum to and fro as we please.]

[PPS: As for running at 480 KHz,... I'm working on that part right now. We don't need Capy to run that fast. Just the Clipper needs to run at that speed. I'm considering a "virtual upsampling" and "virtual downsampling" where the DSP internally interpolates by 10x, does the clipping, and then a low-pass filter prior to 10x downsampling again. Meanwhile Capy continues running at 48 KHz.]

-- DavidMcClain - 25 Aug 2005

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