Location of lowpass filter from opamp feedback capacitor?

Started by bartimaeus, March 01, 2023, 11:37:28 PM

Previous topic - Next topic

bartimaeus

Take your average non-inverting opamp soft-clipper, with a pair of diodes in the feedback loop. Classic TS stuff. There's a little capacitor there to work as a lowpass filter, with frequency based on the setting of the gain control.

Where is this filter located? Pre-clipping? Post-clipping? Or some hybrid of the two?

I've tried some spice simulations to compare it with a discrete pre-gain filter, but I've found it surprisingly difficult to remove all the confounding variables.

Dormammu

Quote from: bartimaeus on March 01, 2023, 11:37:28 PM
Take your average non-inverting opamp soft-clipper, with a pair of diodes in the feedback loop. Classic TS stuff. There's a little capacitor there to work as a lowpass filter, with frequency based on the setting of the gain control.

Where is this filter located? Pre-clipping? Post-clipping? Or some hybrid of the two?

I've tried some spice simulations to compare it with a discrete pre-gain filter, but I've found it surprisingly difficult to remove all the confounding variables.
In my opinion, there are 2 filters in the TS clipping circuit —  hi-cut and mid-boost.
Mid-boost can climbe pretty high.   :)



And here is the low-pass filter itself:




It remains to understand (for me) — what exactly do you want to do with this circuit.    :icon_lol:




bartimaeus

Thanks for the reply! I am specifically curious about the "location" of these filters relative to circuit clipping. Said another way: does these filters affect the pre-distortion signal? or do they affect the distorted signal?

I suppose the cap limits the speed at which the opamp can respond, which i suppose would be considered post-distortion? It does limit how "hard" the clipping can be in that sense... how close it can be to a square wave.

This probably sounds silly to ask in the analog domain. But it's important when creating digital emulations of these circuits.

Dormammu

Quote from: bartimaeus on March 02, 2023, 12:27:54 AM
1 - Said another way: does these filters affect the pre-distortion signal? or do they affect the distorted signal?

2 - I suppose the cap limits the speed at which the opamp can respond, which i suppose would be considered post-distortion? It does limit how "hard" the clipping can be in that sense... how close it can be to a square wave.


1 - of course amplified signal.
2 - no, the influence is very small, basically remove unnecessary high-frequency "sand", which the post-clipping low-pass filter does even better.

FiveseveN

Quote from: bartimaeus on March 02, 2023, 12:27:54 AM
i suppose would be considered post-distortion?
Yes. The Lord of the Dark Dimension does bring up an important point: there's a low-pass with about 10 times lower corner frequency right after, so how much impact could it have?
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

Elektrojänis

I think, the cap in the same feedback loop with the diodes is more complex than simple pre/post -definition. It does interact with the drive control, but that's not all. When the dieodes start to conduct (clipping) their impedance will go lower than the feedback resistance (the pot and the other resistor in series). In a way this will change the filter frequency even within one cycle of the signal waveform. However, I'm not sure if it can be analyzed like this to provide eny specific frequency where the filters corner frequency is at a specific moment. It's probably very hard to define a frequency if the time period for the analysis is zero.

Practically for our hearing it probably averages out some way or the differences to some pre/post filter will be very subtle.

I've always wondered how effective that feedback cap actually is in softening the clipping as it's effect will be less when clipping.

merlinb

Once the signal is clipping, the cap has very little impact on the waveform, so you can think of it as a pre-clipping filter.

Dormammu

Quote from: Elektrojänis on March 02, 2023, 03:12:30 AM
I think, the cap in the same feedback loop with the diodes is more complex than simple pre/post -definition. It does interact with the drive control, but that's not all. When the dieodes start to conduct (clipping) their impedance will go lower than the feedback resistance (the pot and the other resistor in series). In a way this will change the filter frequency even within one cycle of the signal waveform. However, I'm not sure if it can be analyzed like this to provide eny specific frequency where the filters corner frequency is at a specific moment. It's probably very hard to define a frequency if the time period for the analysis is zero.

Practically for our hearing it probably averages out some way or the differences to some pre/post filter will be very subtle.

I've always wondered how effective that feedback cap actually is in softening the clipping as it's effect will be less when clipping.
This cap has such a small effect (on the sound) that it can be ignored. Some types of opamps are self-excited if they do not have such a cap.

antonis

What merlin said.. :icon_wink:

When signal is clipping, gain pot resistance is replaced by diode(s) dynamic resistance so, for a cap conventional value, LPF corner frequency is launched at ultrasonic frequencies..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

amptramp

There are four other parts connected to the inverting input of the op amp and this means there will be a considerable capacitance to ground from that point.  If you add capacitance to ground, the feedback will get less as the frequency rises and the amplifier response will rise until it reaches the open-loop gain of the op amp.  At this point, the falling open-loop response of the op amp will interact with the rising closed=loop response due to the reduced feedback and you will get oscillation or at least a ringing transient response due to phase shift.  Adding a feedback capacitor keeps the overall response below the open loop response and reduces the probability of oscillation.

One other thing to note in this circuit is that the pot is connected to the output of the op amp and even though resistors in series add, you should not swap the position of the 47K resistor and the pot.  Pots have a high capacitance to ground and this would cause even more capacitance to ground at the inverting input.

Dormammu

amptramp
Disagree. To prevent oscillations, a resistor in the mid-boost circuit serves well, in fact it is there for this.

bartimaeus

Thank you all for your help!

I should have said "low-shelf" filter, not "lowpass" filter to avoid confusion with the normal post-gain filter. My mistake.

But I think some of you are missing the point. I realize that in many drive pedals, that cap is too small to matter through a guitar speaker. Though presumably it matters a little, if we ONLY wanted to stop oscillations we could use 10pF instead haha!

However, let's say I use a 10nF cap in the feedback loop. Clearly this will have a dramatic effect. I am curious how this circuit works in all cases, not just a stock Tubescreamer.

It's very interesting to hear that the effect of the capacitor changes during clipping. If we find the series resistance of the diodes, can we calculate the new cutoff frequency? Or does the resistance vary too much at different signal amplitudes?

To illustrate why I'm curious, here is a simulation of three circuits. According to simulation, the frequency response of all three appears to be identical. But their clipping characteristics are each unique.





It seems possible to create an overdrive with a more dynamic/complex frequency response than the original TS by increasing the capacitor value to replace the RC filter. But maybe it is too difficult to make that sound good...

antonis

I think you have to look for "diode incremental resistance" and blend it with "integrator"..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

Rob Strand

#13
The root cause of the problem is AC analysis replaces the diodes with an small signal equivalent circuit.  For the case of your circuits the diodes are biased off so the simulation is exactly like the diodes aren't there at all.

In operation as a clipper the diodes are biased at different levels depending on the *instantaneous* signal level.   This is called large signal behaviour.  The diodes cannot be replaced by a simple small signal equivalent circuit.

You should expect different filtering behaviour depending on the signal level.   For very small signals the diode will look like that are out of circuit since they aren't conducting.  For large signal where circuit spends most of the cycle clipping the diode impedance is low and the effective RC filter is a very high frequency (essentially per Merlin's comment).

The short answer is there is no equivalent RC filter that duplicates the effect of the cap in parallel with the clipping diodes.   The filter is a non-linear filter and they just behave differently.
If you tried this:
- circuit 1:  clipper with cap in parallel with diodes
- circuit 2:  clipper followed by an RC filter
then even for one frequency and one signal level you could not get the waveforms to match.

As far as how to analyse these more complex situations.   What you need to do is a transient analysis.    You need to set the input level and frequency of an input sinewave then look at say the output spectra.   

In order to characterize the circuit for different frequencies and different levels you can expect to do many simulations.   The results are difficult to interpret as well.   Because the circuit is non-linear you will get a spectrum for each combination of input levels and frequency.   In order to simplify the comparisons you might look at some lower order harmonics and some higher order harmonics in order to judge how they roll-off.   The spectrum is dependent on level of clipping and the cap.

Vivek posted some stuff on how to automate this but it's not for the faint hearted.

If you want to start somewhere simple:
- Start with say 300Hz sinewave input at a level which cause some level of clipping.
- Set up the comparison of the two circuits I mentioned earlier.
   So the cap so the roll-off with no diodes is about 3kHz to 5khz or so.
- Do a transient simulation.   You need about 10 to 100 cycles with about 100 points per cycle.
- Do an FFT.  Use say a Blackman-Harris window.
- Play with the filter values to see if you can get the spectrum to match.
Even doing that will take some time.

Unfortunately that's all I can post today, I've got stuff to do.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

FiveseveN

Yes but before you sink more time into that:
1. Take a Tube Screamer (a "real" analog one)
2. Put the cap on a switch
3. Listen for its impact on the sound (ideally have someone else flip the switch).
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

bartimaeus

Quote from: Rob Strand on March 02, 2023, 05:10:09 PM

Unfortunately that's all I can post today, I've got stuff to do.


Hahaha that's far more than I ever expected :)

And to be honest, now I'm not so sure it'd be useful to simulate this accurately... as you say, it seems not for the faint hearted.

Maybe it's best to test by ear. But at least I know have a good understanding of how complex that capacitor is. It's not the simple low-shelf filter described in articles like the one by ElectroSmash.

Quote from: FiveseveN on March 03, 2023, 12:49:06 AM
Yes but before you sink more time into that:
1. Take a Tube Screamer (a "real" analog one)
2. Put the cap on a switch
3. Listen for its impact on the sound (ideally have someone else flip the switch).

Ok, I will need to try this. But I am sure that if the cap becomes big enough, it will have a noticeable effect. The question is how to use that effect creatively.

amptramp

Of all the diodes I have seen used in the feedback circuit, no one seems to have used voltage-variable capacitance tuning diodes.  These are diodes with a hyperabrupt junction where the capacitance varies with the cube of the applied voltage rather than the square as with normal diodes.  The question there is, can you find diodes that will always have enough capacitance that the 47 pF capacitor becomes unnecessary?  I would vote for AM radio tuning diodes as the best bet because they can go up to hundreds of pF.  Two of these used as clipping diodes should easily have enough capacitance.

Rob Strand

#17
QuoteHahaha that's far more than I ever expected :)

And to be honest, now I'm not so sure it'd be useful to simulate this accurately... as you say, it seems not for the faint hearted.

Maybe it's best to test by ear. But at least I know have a good understanding of how complex that capacitor is. It's not the simple low-shelf filter described in articles like the one by ElectroSmash.
It can be quite hard to interpret the result because the amount of clipping is determined by the diodes and that affects the spectra then you have the cap filtering the spectra.  The final spectra can come from two causes.

By ear can be tricky as well since it depends on how much hard you push the clipper.   Nonetheless probably a lot quicker to get into the zone than similations - which can be quite tedious for this stuff.

Here' something along the lines of what I wanted posted yesterday,

The post filter circuit tweaks the cap.  The circuit with the feedback cap has a post divider to tweak the level of the fundamental.

Schematic:
FYI a lot of the things I used to tweak the values are now commented out.


Spectra matches upto 7khz but has small deviation around 10kHz.  (Yes you can match 10kHz better and give-up the match elsewhere.)

It's pretty clear the spectra with the post cap filter is better than having no filter.

Low frequency spectra:



High frequency spectra:



Waveform - 400Hz:

You can see similarity and difference in the waveform.  The filtered waveform is closer to the diode + feedback caps.


Waveform - 4300Hz:

If we take that same circuit and just plug in a 4300Hz sinewave you can see that the post filtered waveform looks like it is filtering too much and has a shape almost like reverse of the diode+feedback cap.   The unfiltered waveform has a similar peak, the shape has some similarity but also is also quite different.  Neither the unfiltered or post filtered circuits or anything in between look like that could match the feedback diodes + cap.  The spectra is probably closer with the filter but the filter cut-off is too low to get a good match, as 4.3kHz level is too low.

If I matched 10kHz spectra on the 400Hz waveform it will match the 4.3kHz waveform better.  So in retrospect I should have matched higher up in the spectra.   The main point is though you can see things aren't equal, at best you can make them close!



In general I'm not really in favor of comparing time domain waveforms for this stuff but in this case you can see the matching problem.


FYI, the 4k3 example actually makes things a little more complicated than I intended.  The difficulty of matching still holds.   Anyway, when you have input signal frequencies above the cut-off of the parallel diode case ie. above f = 1/(2*pi*100k*680p) = 2.3kHz, then you need a pre-clipper filter as well to get a good match.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.