# [PD] Guitar distortion (analogue) was: (Chebyshev?)

- fallen_devil at gmx.de
Thu Oct 14 21:56:30 CEST 2010

```Am 12.09.2010 19:24, schrieb Martin Peach:
> On 2010-09-12 12:05, Mathieu Bouchard wrote:
>> On Sun, 12 Sep 2010, Martin Peach wrote:
>>
>>> It's not the capacitors, it's the amplifier losing gain when it
>>> approaches the power supply.
>>
>> Yeah, but it seems to be a pattern similar to the one found in
>> capacitors, because capacitor theory has exp(-x) all over it, and the
>> only way that capacitors behave like [hip~] is when the signal is much
>> below the capacity rating (?F)... otherwise they lose gain... when they
>> don't, it's because exp(-x) can be well approximated by x.
>>
>
> I guess it's similar since capacitors charge at a rate proportional to a
> voltage difference, while transistors can supply charge carriers at a
> rate proportional to a voltage difference, so caps charge fastest when
> they are nearly empty and transistors have the best gain with small
> signal inputs.
>
> The whole universe has exp written all over it in fact...
>
>> And then, exp is very close to tanh in several different ways, one of
>> them being this (use gnuplot) :
>>
>> plot [-2:2] [-1:1] exp(x*sqrt(2))-1, 1-exp(-x*sqrt(2)), tanh(x), x
>>
>> I put the plain 'x' at the end to show what I mean above (though you
>>
>
> Of course, all the hyperbolic trig functions are made from exp, by
> definition.
>
> http://en.wikipedia.org/wiki/Hyperbolic_function
>
> Another use of exp is the sigmoid function used in biology, that can be
> used to make a soft transition from one state to another as in 'fuzzy
> logic'.
>
> Martin

Sorry I don't know (jet) how to answer a mail from the archives.

The soft clipping in a normal analogue guitar distortion (like the tube
screamer) comes from the diodes (tubes are warmer). Which have log
written over them (their resistance depending on V). (Are even used some
time as a simple analogue log function)

A analogue guitar distortion is build via a feedback loop like this:

|--var resistor (gain)
|----  ->diode -|
|----  <-diode -|
|----cap as lp -|
|		|
|------ (-)     |
op-amp---|---out
input-- (+)

The resistor defines the max gain
The cap is used as a lp (short cuts high frequency's to a gain of 1)

An op-amp tries to have always the same voltage at both inlets.
Which means if you have 1v at + it increases its output till you have 1v
at - as well. 1+(-1)==0

And finally the diodes:
At negative voltages they blockade completely
At low voltages they have a high resistance so the gain of the resistor
counts. At around .7V their resistance drops leading to a lower gain.

With a tanh(sig) you are simulating the diodes in a simple way.
What usually is forgotten in the digital domain is the lp filtering. You
may want to split your signal into a high and low part. Run the low part
through the tanh and sum it later up with the high part.

It gets really funny if you want to try to model the whole feedback loop
in something like pd. There is a mess of phase changes and whatnot which
surely is part of the interesting analogue sound.

An important thing to mention is that, as someone else noted, you need
to (should) oversample to avoid aliasing with high order functions. Tanh
is one of the worst because it generates very high harmonics.
Where in the analogue field a natural lp filtering happens all the time
(and no aliasing can occur). As an Example: An opamp has a frequency
response up to GHz. But only at a gain of 1. The higher the gain the
lower the frequency response.

I'm bad at explaining things. But if you want to i can search my
bookmarks for the analogue or digital sources i tried to explain here.

```