Fuzz, overdrive and distortion modelling


#1

Generally speaking analog circuits can be pretty well simulated with a circuit simulator, like the freeware ltspice. I mean, I don't think there is black magic behavior in transistors, tubes or transformers that can't be expressed in a circuit-level simulation model.
I don't have a "golden"object or patch available, but here I'll try to break down (guitar) distortion into parts that may or may not be a relevant part of its desirable character.

waveshaping

A common approach to modeling distortion is simulating the amplitude distortion, like a waveshaper. A "naive" sample-by-sample digital implementation a waveshaper often suffers from aliasing artefacts. Combating aliases is an important requirement when modeling high gain distortion. Current objects that have some sort of strategy to reduce aliasing are "dist/inf", "dist/rectifier", "dist/rectifier full" and "dist/hardclip", and the newer "jt/dist/class a".
This video shows quite some fuzzbox waveforms on an oscilloscope, I mainly observe waveshaping behavior, and it seems pretty close to hard clipping, not much evidence of a soft transition between clipped and unclipped or frequency-dependent behavior.

operating point

But remarkable is that the clip levels seem to shift with the amplitude, at this point, you can see that over 180 degrees of a sinewave cycle is clipped away, meaning that the positive side clip threshold moved to a negative level. So the operating point of the waveshaping is dynamic, if the positive side clip level had been static at a negative level, it would gate small signals.
Still waveshaping is not always a sufficiently complete model.

filtered waveshaping

Looking at the schematic of a tubescreamer, there are not just 2 clipping diodes in the feedback path of the opamp, there is also a RC network to the virtual ground, adding some filtering into the distortion.

subsonics

Also some gentle high-pass filtering before distorting is relevant, I have noticed guitar pickups can produce substantial subsonic output by just pushing the strings near the pickup. Without filtering, this would change the operating point of the distortion.

sag

In a guitar tube power-amp, producing loud output may "starve" the powersupply, causing the supply voltage to drop when you hit the strings, called "sag". This changes the operating point of the whole circuit, adding a sort of compression. I have also heard anecdotes of guitar players preferring the sound of a nearly empty battery in a tubescreamer distortion pedal. Something similar can happen there. This video demonstrates a potentiometer between battery and a tubescreamer to control the sag. Remarkable is the production of subharmonics, while a waveshaper can only add overtones. I think (subtle) addition of subharmonics are desirable. And I imagine, when a tube amplifier power supply is sagging, it also increases the amount of mains hum. But I haven't heard of anyone using a mains frequency converter to tune the hum to be in harmony, or bands tuning their instruments consciously to mains (requires convincing the other band members...). For 50Hz mains (Europe), hum is between G and G#, in the US, 60Hz, between A# and B. I also haven't seen any guitar tuner that offers mains frequencies as an alternate tuning reference :slight_smile:

memory

Transformers do not just simply saturate, their response also has a sort of memory called hysteresis.

feedback

Typical guitar tube power-amps use corrective feedback, from after the transformer to the input of the poweramp, reducing gain but increasing its linearity. But as this happens across all the effects listed above, assuming its effect is only linearizing is probably an oversimplification.

analysis

Not every effect necessarily has a substantial or desirable contribution to the final sound, not everything needs to be modeled to obtain a satisfactory model. A good synthetic test-waveform to play and record through "test" pedals and amps that reveal specific properties should be designed. For instance, a pulse is invariant to waveshaping, and will reveal the frequency response of the system after the distortion. And low-amplitude pulse mixed to a low-frequency sine wave can reveal the small signal impulse response at different operating points by varying the phase of the pulse and the sine wave. Then, the recorded wave could be analyzed with Octave or Scilab. Is anyone aware of such an (open source) effort?

But even without further scientific analysis I hope this breakdown could be inspiring in patching up distortion techniques. And if it sounds good, it is good.

Comments welcome...


JT contributions
#2

Hi Johannes !

I heard that the Tanh function is heavily used for "smooth" digital distortion. It's supposed to be a modelling of tube behavior or a good start i guess.

We can decompose the function with exponential but i don't know how to do it without an open math/div function :confused:

Modified tanh function looks tastier.

http://folk.ntnu.no/oyvinbra/gdsp/Lesson4Modtanh.html

On this upgraded equation, it should be really interesting to implement an "hysteresis" behavior on a & b like :
Input or Output informations at n finetune a & b for n+1 and so on. not based on real circuits however :blush:

Arctan or any sloppish static function is commonly used for VST/VA distortion but Tanh seems easier to implementent

I'm not familiar with objects coding so i'm a bit blocked but maybe someone

From VOS's blog: https://varietyofsound.wordpress.com/2010/12/04/towards-stateful-saturation/


#3

You could approximate tanh with a taylor polynomial expansion, maybe you could break the function in several ones to get a better result (for example for x<-1 and x>1 and for-1 < x < 1 )

As for the hysteresis thing.. that might be trickier to implement, especially if you don't want some hard hysteresis like schmitt trigger but something more like the ferromagnetic one. Maybe you could switch between different curves whenever the signal goes over some value, but that won't be realistic since ferromagnetic hysteresis cycle size depend on how much the material is magnetized (therefore you can have infinitely many curves depending on the signal)


#4

A post was split to a new topic: Converting a fuzz model from Spice?


#5

I'm not the best with electronics, but about a yea ago I started by trying to build some fuzz boxes. The pro-co Rat is my favorite, and this circuit analysis was a great resource.

The Tube Screamer and Rat Schematics are similar in a lot of ways, but they both implement pre-filter resistor network to avoid ground pops, and filter out some un-wanted frequencies. Pre-Filtering seems to be a common practice in stomp boxes, and is easily achieved with the current axo build.


#6

I am also not an electronics wiz but my understanding was the pre filtering is to remove the pop caused by the foot switch.
I could well be wrong tho.