Soft and hard clipping together?

Started by PBE6, March 24, 2014, 04:45:42 PM

Previous topic - Next topic

Lurco


PBE6

Quote from: Lurco on March 27, 2014, 02:36:32 AM
"dynamic forward resistance" ?

Are you talking about the feedback diodes, or is this a strategy for making a smooth transition from Tubescreamer to Dist+?

teemuk

#22
QuoteGain is not unity in such case, if it was the clipping could not even work.

QuotePlease clarify.

Ok, this example naturally applies to inverting scheme: We have the said inverting gain stage configured to unity gain. There is also a silicon diode pair in feedback loop, which will limit the output to about 600mV peak values. If we input 100 mVpeak signal we get 100 mVpeak signal out. If we input a higher signal, say 5 Vpeak, we get an output limited to about 600 mV. After forward voltage has been exceeded the dynamic resistance of the diode has decreased and the gain of the stage has decreased as well. This causes the clipping of the signal: dynamic resistance of the diode in feedback loop decreases the gain. If the stage gain was "stuck" on unity the output would follow the input instead and no clipping could happen.

It really isn't all too different in the non-inverting scheme: Dynamic resistance of the diodes keeps decreasing similarly but in non-inverting scheme 100% feedback results to unity gain, unlike in non-inverting scheme where gain can keep decreasing below "1".

PBE6

Don't forget, the reason a standard non-inverting opamp provides gain is that the feedback and ground resistors form a voltage divider. This lowers the voltage at V_ below Vout, and the opamp increases the gain to compensate. In the non-inverting buffer configuration, there is no voltage divider so the voltage at V_ is equal to Vout, which itself is equal to V+, and only unity gain is applied.

If you start with the standard non-inverting gain formula:

A = 1 + Rf/Rg

then you would also expect unity gain if you placed a forward biased diode in the feedback loop, since its resistance decreases dramatically once it starts to conduct (implying that Rf(total) = Rf||R(diode)-->0). However, this equation does not apply when using a non-linear feedback element like a diode.

The gain actually depends on the difference between V_ and V+. When there is a forward biased diode in the feedback loop, V_ will always be less than Vout by the forward voltage drop of the diode. Working out the gain equation under these assumptions gives you:

Vout = Vin + V(diode)

A = Vout/Vin = (Vin + V(diode))/Vin

Of course this equation only applies when the diode is conducting.

ashcat_lt

Quote from: PBE6 on March 27, 2014, 11:53:30 AM
Don't forget, the reason a standard non-inverting opamp provides gain is that the feedback and ground resistors form a voltage divider. This lowers the voltage at V_ below Vout, and the opamp increases the gain to compensate. In the non-inverting buffer configuration, there is no voltage divider so the voltage at V_ is equal to Vout, which itself is equal to V+, and only unity gain is applied.

If you start with the standard non-inverting gain formula:

A = 1 + Rf/Rg

then you would also expect unity gain if you placed a forward biased diode in the feedback loop, since its resistance decreases dramatically once it starts to conduct (implying that Rf(total) = Rf||R(diode)-->0). However, this equation does not apply when using a non-linear feedback element like a diode.

The gain actually depends on the difference between V_ and V+. When there is a forward biased diode in the feedback loop, V_ will always be less than Vout by the forward voltage drop of the diode. Working out the gain equation under these assumptions gives you:

Vout = Vin + V(diode)

A = Vout/Vin = (Vin + V(diode))/Vin

Of course this equation only applies when the diode is conducting.
It may work out about like this in practice, but the reason is that R(diode) isn't actual 0 when "forward biased".  The resistance of the diode is better thought of as being exactly enough to divide the output voltage down to its forward drop. 

Mark Hammer

You know, just about any circuit that uses a 9V supply, and sticks an op-amp gain stage ahead of some sort of clipping components going to ground, is really a "double clipper".  The Distortion+ is the poster child for that, but other pedals/circuits do it too.  The limitations on voltage swing of most op-amps make such that you can only expect to bring the signal up to maybe +/-3V before the chip says "Nuh-unh, can't do that".  Figure out how much gain needs to be applied to the average guitar signal to bring it to that amplitude and it ain't all that much.

So the chip clips, and then hands the signal off to the diodes, which clip yet again.  Myself, I have no idea how to classify what happens in the op-amp itself.

PBE6

Quote from: ashcat_lt on March 27, 2014, 12:13:09 PM
Quote from: PBE6 on March 27, 2014, 11:53:30 AM
Don't forget, the reason a standard non-inverting opamp provides gain is that the feedback and ground resistors form a voltage divider. This lowers the voltage at V_ below Vout, and the opamp increases the gain to compensate. In the non-inverting buffer configuration, there is no voltage divider so the voltage at V_ is equal to Vout, which itself is equal to V+, and only unity gain is applied.

If you start with the standard non-inverting gain formula:

A = 1 + Rf/Rg

then you would also expect unity gain if you placed a forward biased diode in the feedback loop, since its resistance decreases dramatically once it starts to conduct (implying that Rf(total) = Rf||R(diode)-->0). However, this equation does not apply when using a non-linear feedback element like a diode.

The gain actually depends on the difference between V_ and V+. When there is a forward biased diode in the feedback loop, V_ will always be less than Vout by the forward voltage drop of the diode. Working out the gain equation under these assumptions gives you:

Vout = Vin + V(diode)

A = Vout/Vin = (Vin + V(diode))/Vin

Of course this equation only applies when the diode is conducting.
It may work out about like this in practice, but the reason is that R(diode) isn't actual 0 when "forward biased".  The resistance of the diode is better thought of as being exactly enough to divide the output voltage down to its forward drop. 

This sounds reasonable and most likely true. I just wanted to point out that the non-inverting clipping stage doesn't ever provide unity gain as it caused me quite a bit of consternation when I was trying to develop a rough model for the Tubescreamer gain stage output.

ashcat_lt

Yeah, no, like I said, in practice your thing is pretty close to truth.  If you look at that equation from the right angle (not "a" right angle...) you might notice that it's basically saying that the output is about the same as if you used a hard clipper and the mixed that with a unity gain clean version of the signal.  That is, a Rat with a clean blend sounds a whole lot like a TubeScreamer.  In my attempts at modeling these things for JSFX plugins I found this was the best way to get the TS thing happening.

YouAre

Quote from: Mark Hammer on March 27, 2014, 01:00:23 PM
Myself, I have no idea how to classify what happens in the op-amp itself.

I would call this hard clipping. No matter what, you're not getting above a certain threshold.

I'll stop harping on semantics now.

pinkjimiphoton

my flying spaghetti monster uses soft clipping in the feedback of the opamp, and a hard clipper on the arse end. sounds great.

i think it depends on how many stages you got to work with... if you have enough, i think soft clipping sounds great  when it's re-clipped later.. very rich fuzzy distortion rich in overtones.
  • SUPPORTER
"When the power of love overcomes the love of power the world will know peace."
Slava Ukraini!
"try whacking the bejesus outta it and see if it works again"....
~Jack Darr

Keppy

With feedback loop clipping, the output is limited to the input plus the voltage drop of the diodes. This means that:

1) The signal maintains some of the dynamic range of the input. For example, with .6v diodes in each direction, 1v p-p in is limited to 2.2 p-p out, 2v p-p in is limited to 3.2v p-p out.

2) With a large enough input signal the opamp will still hard clip. For example, if the opamp can only put out 6v, and you feed it 5v, it will try to put out 6.2v with the diodes above but instead be hard clipped at 6v. You could combine soft and hard clipping just by putting a booster before a feedback clipping stage.


With shunt clipping, the output is limited to the forward voltage of the diodes per side, period.


One could theoretically arrange things so that a signal would be soft clipped in the feedback loop but retain enough dynamic range to only be hard clipped by the shunt clippers in louder moments. The key to this would be using shunt clippers with a higher voltage drop than the feedback clippers, or else dividing down the signal between the two. For the example above, using shunt clippers of 1.5v per side would do it. A 1v signal would be limited to 2.2v in the soft clip stage and not clip hard, whereas the 2v signal would come out of the soft clip stage at 3.2v and be hard clipped to 3v in the shunt stage.


Of course, there are other factors to play with, like the relationship between current and forward voltage of diodes as well as what happens when you exceed the gain-bandwidth product of an opamp. Those issues would seem to take a little more math than I'm prepared for.
"Electrons go where I tell them to go." - wavley

ashcat_lt

Keppy, I think we've pretty much covered all of that so far, but thanks for chiming in!    ;D

Something I've been trying to say for this entire thread - something I only just learned myself recently - is that real world diodes are not switches which go from infinite resistance to zero resistance at a given voltage.  The "forward voltage drop" actually just identifies the voltage that causes some specified amount of current to flow through them, and is in fact not any kind of hard limit.  The V-I curve of a diode is, in fact, an exponential curve all the way up and all the way down.  It just happens that below that "knee region" the slope is extremely steep - the effective resistance gets really big really fast - and on the other side it flattens out so that it takes bigger and bigger changes to get any appreciable change.  But if you zoom in on any part of an accurate enough representation of the curve, it will be "curvy" all the way until it explodes.  In practice, they work almost like that switch except right around what we call the forward voltage where the bend in the curve is noticeable.

That gain-bandwidth thing is actually pretty easy to sort out, in that it is essentially just a lowpass filter.  If you know how much gain you're asking from the opamp, and you divide that into the open-loop bandwidth, you get the cutoff frequency.  It's interesting to note that a Rat wide open has it's GBP filter rolling off at the bottom end of the guitar frequencies.  I was used to looking at graphs of the Rat frequency response without this figured in, and it looks about like a bandpass centered around 750 (IIRC), very much like what you see on the Tech of TS page.  But it don't sound like that.  The GBP filter skews the whole thing to actually slope downward all the way across.

And if we're going to add that into the discussion, then we also have to add in the idea of slew-rate limiting.  It seems to be somehow connected to the GBP thing, but it is not exactly the same phenomenon.  Slew rate limiting is like distortion and filtering at the same time.  A real Rat has a lot of this.

A typical TS stage has much less gain than Rat does, so the GBP filter will roll off higher, and you'll have less slew-rate distortion in the audible spectrum even given the same opamp, and of course any part of the signal that has pushed it past the diodes into the "not exactly unity gain" section will be affected much less by these as well as the other filter action in the gain section.

Keppy

#32
Quote from: ashcat_lt on March 28, 2014, 11:02:05 PM
Keppy, I think we've pretty much covered all of that so far, but thanks for chiming in!    ;D
The background info was definitely covered, but I don't think the conclusion was, at least not totally. The part I wanted to draw attention to was the progressive clipping from soft to hard IF the shunt diodes are sufficiently larger that the feedback diodes, which was the OP's question. Every design I've seen that uses both (except the Plimsoul linked earlier in the thread) seems to use the same diodes in both locations, or uses larger diodes in the feedback loop. Sorry if it looked like I didn't read the thread (I did), but I thought a summary would help my post make more sense.
"Electrons go where I tell them to go." - wavley

PBE6

Haven't gone back to try this in a while, but I was just noodling around on Excel and made some pretty pictures I thought I would share.
This is what soft clipping followed by hard clipping looks like (theoretically):

Soft: Ge
Hard: Si


Soft: Si
Hard: LED


Soft: Si
Hard: LED+Si


(In all of the above, the blue dashed line is the input signal, the green dashed line is after soft clipping and the red solid line is after soft & hard clipping)

Will have to find out what these sound like and take some actual readings tonight.

JFace

Check out the Madbean Yellowshark for this. It is an excellent sounding overdrive.

deafbutpicky

I've come to the conclusion that harmonics aka hardness of the clipped edges of a signal deliver harmonics we can perceive
as hard or soft clipping and can be manipulated  with filters somewhat, but dynamic response is best achieved by multiple gain stages.
-> high gain: put more effort into the filtering afterwards,
-> low to medium: step by step clipping.
A new one to me: watch out for the source/emitter behaviour (Vds or Vce) as there it seems where the magic happens (mushy saturation), especially with following stages diving them into saturation.

composition4

So if we've sort of established that soft clipping followed by hard clipping might be a bit inaudible and just end up sounding like hard clipping, what about having 2 or more clipping stages in parallel instead of series.  So for example for a three stage clipper.. Actually I just wrote up an explanation of what I mean but a quick and dirty schematic would be more informative..



something like that with 5 or 6 stages

Don't know, just a random thought, has probably been tried and "just sounds like any other clipping"

PBE6

Looks interesting, I there may be some issues with the mixing though:

http://sound.westhost.com/articles/audio-mixing.htm

I think an inverting opamp mixer like the one in Figure 4 of that article would work better.

I imagine the resultant mix would favour the 3-diode clipping just because the signal would usually be much stronger. I think that would mean more of the original signal would get through, maybe end up sounding more like soft clipping that way? But with more sizzle. Interesting, would love to hear how it sounds!

EDIT: Possibly more like hard clipping actually, just did a quick calculation and the top of the mixed waveform is still flat.

PRR

You usually put a resistor (~~1K) between the opamp and the diodes. Otherwise the diodes must clamp the full ~~30mA which the opamp can supply. Power supply demand goes way up. The clipping is quite abrupt.

Then I'd mix with ~~5K resistors. The passive mixer will work OK.
  • SUPPORTER

electrip

Quote from: PBE6 on October 30, 2014, 01:51:38 PM
Haven't gone back to try this in a while, but I was just noodling around on Excel and made some pretty pictures I thought I would share.
This is what soft clipping followed by hard clipping looks like (theoretically):

[ommitted pics]

(In all of the above, the blue dashed line is the input signal, the green dashed line is after soft clipping and the red solid line is after soft & hard clipping)

Will have to find out what these sound like and take some actual readings tonight.

Those waveforms don't look 'right'.
Whats the math behind it (formula)?

electrip