How the frick does good distortion actually work and/or how do I analyze it?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I've always thought that distortion algorithms were just a constant, instant mapping from input to output. So to analyze different distortion plugins I own, I've run them through a clean, aliased sawtooth wave at a very low frequency to get a rough picture of what the distortion looks like. The issue is that even using the same saw wave at different frequencies gives different results and in one case, even the same saw wave at the same frequency but reversed (i.e. rising instead of falling) does not result in a mirrored shape but one with inversed polarity instead, weirdly enough.
I know that the plugins I've tested do filter the signal, but does that explain all the other behavior?
I feel like I'm missing something critical here. Can someone help me out?

Post

If there's any sort of pre/post filtering in the distortion plugin that you can't bypass, it's likely that phase of the input signal is going to be affected.

Post

It is definitely being affected, the filtering done pre-distortion is certainly not linear phase.

Post

EvilDragon wrote: Fri Jan 17, 2020 12:08 pm If there's any sort of pre/post filtering in the distortion plugin that you can't bypass, it's likely that phase of the input signal is going to be affected.
Not necessarily just pre/post filtering, since there might also be feedback, which essentially turns the distortion itself into a filter of sorts, which means it might even produce different results for different cycles of a static waveform. Most commonly this involves some variation of using feedback to keep the non-linearity from running into constant saturation, for example by dynamically adjusting bias to counter the DC offsets in the output, but really the possibilities are kinda endless.

That said, the very first thing you usually want to do to improve the sound of a static waveshaper is to put some EQ in front to cut the low-frequencies. If you don't want to lose them, then just boost them back up afterwards. This way you actually get more interesting distortion action in the higher frequencies (as the lowest frequencies aren't so dominant), rather than just turning everything into a square-wave at the fundamental frequency.

Post

mystran wrote: Fri Jan 17, 2020 3:55 pmMost commonly this involves some variation of using feedback to keep the non-linearity from running into constant saturation, for example by dynamically adjusting bias to counter the DC offsets in the output
Or to artificially create DC offset in the input to avoid turning everything into a square-wave at the fundamental frequency :D

Post

mystran wrote: Fri Jan 17, 2020 3:55 pmwhich essentially turns the distortion itself into a filter of sorts
To put what mystran said in a short and catchy form, I would say that generally DSP-wise a distortion is rather a highly nonlinear filter than a mere waveshaper.

Post

That's interesting. I've never thought about distortion that way!

Post

Z1202 wrote: Fri Jan 17, 2020 9:57 pm To put what mystran said in a short and catchy form, I would say that generally DSP-wise a distortion is rather a highly nonlinear filter than a mere waveshaper.
Hm. I think this is the crux of the matter. Do you have any recommended resources (books or websites) that explain non-linear filters or distortion algorithms that go beyond wave shaping?

Post

Others may have better suggestions, but Figure 8.1 in the following book gives a somewhat familiar-looking example to give you one approach. It's a recursive filter but has nonlinear elements:

V. John Mathews and Giovanni L. Sicuranza. Polynomial Signal Processing. John Wiley and Sons, Inc., 2000, page 306.

Although I've played around with such filters, I prefer filter, asymmetric wave-shaper, filter, asymmetric wave-shaper, filter, asymmetric wave-shaper, ... i.e. multiple stages of wave-shapers with filters before and after. As long as the filters are carefully designed, the wave-shaper can be rather crude, in my experience.

Regards,
Dave Clark

Post

Nice, thanks, Dave!

Post

I'm not really into distortions, but from my very limited experience and knowledge, distortions usually make quite heavy use of the "nonidealities" of electronic components. In comparison, with typical analog VCFs there is usually a small number of nonidealities which is essential for the sound (e.g. in a Moog VCF the most essential nonideality is probably just the tanh saturation arising from a differential transistor pair). The problem is aggravated by the fact that some (or even many) of these nonidealities are not intended, but simply "happen" by nature of electronic components. I'm not sure how many nonidealities are essential in a typical distortion, still I've yet to see a qualitative analysis of any distortion box other than a simple diode clipper which lists the equations of even a simplified model, something even comparable to the mentioned model of the Moog VCF.

Post

Z1202 wrote: Mon Jan 20, 2020 2:03 pm I'm not really into distortions, but from my very limited experience and knowledge, distortions usually make quite heavy use of the "nonidealities" of electronic components. In comparison, with typical analog VCFs there is usually a small number of nonidealities which is essential for the sound (e.g. in a Moog VCF the most essential nonideality is probably just the tanh saturation arising from a differential transistor pair). The problem is aggravated by the fact that some (or even many) of these nonidealities are not intended, but simply "happen" by nature of electronic components. I'm not sure how many nonidealities are essential in a typical distortion, still I've yet to see a qualitative analysis of any distortion box other than a simple diode clipper which lists the equations of even a simplified model, something even comparable to the mentioned model of the Moog VCF.
The nonideality in something like a Moog VCF is distortion. It's just a matter of degree. A transistor is a nonlinear device. It will therefore distort unless you take measures to linearise the circuit such as using negative feedback. A diode is also nonlinear. The assumption in this thread is that distortion is a desirable property of analogue circuits that we need to emulate. The analogue circuit has set the standard for good distortion. I'm a guitar player with an analogue background so I love analogue distortion but I think the situation will change in the future because DSP is not limited by the transfer function of a diode or transistor.

Post

You could try thinking about harmonics? Odd vs even

Post

petereroe wrote: Tue Mar 03, 2020 8:03 am You could try thinking about harmonics? Odd vs even
Heard that so many times, but fail to see how that actually works. Myth or truth?
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

BertKoor wrote: Tue Mar 03, 2020 4:54 pm
petereroe wrote: Tue Mar 03, 2020 8:03 am You could try thinking about harmonics? Odd vs even
Heard that so many times, but fail to see how that actually works. Myth or truth?
Truth! Odd-order harmonics (produced by symmetric non-linear gain) sound different than even-order harmonics (produced by asymmetric non-linear gain).

One of the reasons tube guitar amps sound good is because the class A triode sections produce a lot of even-order harmonics. A popular distortion pedal circuit I have seen uses that same idea with opposing parallel diodes in the feedback loop of an opAmp - BUT they use two diodes in one direction and only one in the other - which produces different gain in positive vs. negative swings - producing even-order harmonics.

IMO, even-order harmonics add sparkle and clarity to the sound while odd harmonics add more of a thicker "bloated" sound. Blending of those two, along with pre and post filtering, is key.

It is surprising how much effort has gone into designing "good sounding" distortion! :lol:
Last edited by Fender19 on Sun Mar 08, 2020 11:32 pm, edited 2 times in total.

Post Reply

Return to “DSP and Plugin Development”