Tuesday, March 31, 2020

Distortion (continued)

After figuring out what was going on in the distortion circuit, I set out to make a nice switchable distortion for the XM8.

Matching hard and soft

Through some experimenting I came up with the following circuit. It has the same amplitude for the output of both soft and hard clipping. Distortion starts at around 10mV input and output is at 3-400mV. Combining these two involves having an additional cap and resistor in the feedback circuit, and the hard clipping circuit has to be attenuated, meaning we should either switch output attenuation or do this in a VCA later.



Matching hard and soft clipping at 20mV input



Various diodes

I tried simulating various diodes. It seems that all silicon diodes (wow, I just realised I've spelt it silicone elsewhere! Blush...) such as 1N4148, 1N914 and 1N4001 give about the same result in the simulation. An 1N34 germanium diode on the other hand clips MUCH softer:


Soft clipping with 1N34 germanium at 10mV

Soft clipping with 1N34 germanium at 50mV


Soft clipping with 1N4001 at 5mV

Soft clipping with 1N4001 at 10mV

Soft clipping with 1N4001 at 25mV

Soft clipping with 1N4001 at 50mV




Matching hard and soft (silicone) without varying amplification or attenuation

The following circuit gives similar amplitude on the output of both hard and soft clipping, without any changes in amplification or attenuation when switching between hard and soft.

I have simulated this with a 31k resistor but that may be changed to 33k without any issue. With a 33k resistor, low pass cutoff is at 26.7kHz with a 180pF feedback capacitor, 32kHz with 150pF.

The input should be at around 15mV when signal is 5V, which will not clip. Soft clipping starts at around 20mV and hard clipping slightly later. Output is around 7-800mV





I've simulated the circuit with two separate opamps but this may be build using only one and with a single SPDT-switch like the DG419:



PS: Connecting the point between each of the two diodes in the feedback circuit changes nothing. That means that we can actually get away with two diodes less, putting the switch at the bottom of the hard sync instead of top.

Here's a closer look at the effects of clipping at various inputs.

Matching clipping at 15mV input

Matching clipping at 30mV input

Matching clipping at 55mV input

These show the effect on only one type of clipping in 10mV steps from 15mV to 55mV: 

Input, 15mV to 55mV in 10mV steps

Hard clip, 15mV to 55mV in 10mV steps

Soft clip, 15mV to 55mV in 10mV steps




From the plots above it becomes quite clear that distortion changes very quickly in the beginning and slower later. It may be an idea to use an exponential VCA on the input to get a more even rate of change. This, the actual sound and whether or not the audible volume is similar between hard and soft clipping has to be tested in real life.

Filtering (again)


As explained in the previous post, there is more to the tube screamer distortion (of which this is a variation) than just clipping. It also does selective filtering/gain of the input through the use of two shelving filters, and the low pass filter even changes as gain/distortion is increased, rounding off the curve more at increased soft clipping distortion, see https://www.electrosmash.com/tube-screamer-analysis for more about this.

This change may bring more "life" to the distortion circuit as clipping does not stay static when increasing gain. In the circuit above, gain is done pre-clipping, so clipping just becomes "wider". It may be possible to put an OTA in the feedback circuit instead of the tube screamer's potentiometer and thus keep functionality similar to the TS. Again, this has to be tested in practice to see what sounds good.

And in any case, selecting a cap for LP filtering at a lower frequency than that in the TS should be tested.

Voltage controlled distortion using OTA in feedback


Now, this is pretty cool. Last night I thought about how to replace the variable resistor in the feedback circuit of the TS with an OTA. Today I experimented a little and came up with something that seems to work fairly well.

By controlling the OTA with a 0-2.5V CV, we decide how much current should come out of it, which is exactly what changing the resistance does. I was able to find component values that gives fairly good controllability - at 0V CV no current flows through the OTA, and all current in the feedback loop flows through the diodes, giving maximum distortion. At 2.5V CV enough flows through the OTA to turn off the diodes (at least it looks like it).

I am not sure if this is the exact same result as with a potentiometer. Nor am I sure if the filter calculations hold true and if low pass cutoff changes like it does with changing potentiometer resistance. But it is definitely something worth trying.

Changing the CV input resistor to 20k lets us use 0-5V CV btw.

Hard clipping works well too btw, but the OTA cannot be fully off as then no current will flow.

20m input, slight skewing due to 1nF cap in feedback
15mV input, no distortion when OTA CV is 2.5V

Hard clipping, 15mV input



Hard clipping circuit

Voltage controlled input attenuation

One can also control the input, and thus the distortion, using an OTA circuit. The following circuit will let the clipping circuit see an input of around 15mV when CV = 0 and 130mV when CV = 5. CV is offset by R2 to slightly turn on the OTA even in the absence of CV.

At 5V the output is 1.1V which is rather high, but I've chosen to have this as the max and intead limit max distortion in software.

OTA controls input amplitude
At 0V CV output from the OTA buffer is around 20mV and signal distorts slightly. Replace R6 with 3.9k resistor for less distortion if wanted.
At 5V CV output is 130mV and the circuit clips heavily. Output after clipping is around 1.1V




Further work:

Output VCA - output should be around 5V when input to circuit is 20mV (e.g. input is 5V), and it should be possible to amplify output to 150-200% to do max volume in software and allow higher max volume than 5V (inputs may be above 5V when mixing multiple waveforms and  oscillators).


For the XM8 I may also want to look into mixing of dry/wet signal, and inclusion of a bit crusher. (https://en.wikipedia.org/wiki/Bitcrusherhttps://www.reddit.com/r/diypedals/comments/1zck7p/bitcrusher_schematics/) Looking into how the PT2399 works would also be of interest for the global FX. https://www.electrosmash.com/pt2399-analysis

No comments:

Post a Comment