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

Timo Vetter fetter-timo at gmx.de
Mon Oct 25 20:22:16 CEST 2010

No. With FFT based filters you have always bin leakage.
The last two posts should give you a starting point.

I guess the filter is ok. I mean its designed exactly for this purpose.
Don't know tho.
When upsampling you should (i don't) filter too not only before
downsampling. Because even with inlet~ lin you get hf edges.

If you find out how to split a signal perfectly, tell me please!
I remember the iemlib filter (hp4_butt + lp4_butt [butterworth filter
have the fastest roll off without ringing]) from extended being able to
split a signal, when you give them the same hz. But maybe it was another
Q. Also this holds only when you recombine the signal directly after
filtering. If you distort one part you change phases there.
Recombination can then lead to various effects around the split
frequency. These can't be seen by the help patch H10.
I found that the iemlib filter are (somewhat) samplerate independent.
But only the "voltage"-controlled ones are even able to adapt to on the
fly samplerate changes, via block or switch.

You may want to read this (at least the clipping section):
And if you want to go crazy on analogue modelling

Modelling an opamp feedback in pd seams to be real pain. I thought about
a feedback loop like this:
input + feedback (maybe 20000 hz? or 1 sample?)
signal split into lp and hp
apply gain and softclipping (a topic for itself) to lp then send to feedback
recombine lp + hp
maybe some EQ
a wet/dry pan

And that's the simple version.
Also bass sounds may react poorly if overdriven too much. So maybe even
a split into HP MP LP is needed. With independently settable gain for LP
or even another distortion.
There is somewhere a diy bass overdrive with good documentation.

If you finish this I hope I get an abstraction too.
Always wanted one like this.

Am 23.10.2010 17:34, schrieb Pierre Massat:
> This is very interesting. Although i must confess that i have no idea
> how to model your feedback loop in Pd.
> As for the lp filter, i have never used an upsampled filter. Is it
> enough if i use the filter built in Miller's J07 Upsampling example?
> It's a 3rd order butterworth lp and the subpatch is upsampled 16 times.
> More generally, what is the best way to split a signal into low and
> high frequencies? I thought of using fft, with, say, a gain equal to 1
> for frequencies between 0 and X Hz, and equal to 0 above. Would this
> work? This would be the sharpest lp filter, wouldn't it?
> Pierre
> 2010/10/14 - <fallen_devil at gmx.de <mailto:fallen_devil at gmx.de>>
>     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
>     >> already know that)
>     >>
>     >
>     > 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.
>     _______________________________________________
>     Pd-list at iem.at <mailto:Pd-list at iem.at> mailing list
>     UNSUBSCRIBE and account-management ->
>     http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list