Diode clipper simulation instability

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Agreed. Especially the osciallations at the start of the ramp are not nice.
The other distortion function (SD1) is more pleasant :p

Post

I think this can be solved without iterations, just wanna give it a try.
- The equation is of form f(y) = g*x + s, where f(y) is g*y + a*sinh(b*y).
- We can't analytically find inverted function, but we can compute it for a range, store in array and interpolate - assuming than g,a,b are constant - and they are :)
- then y = inv_f(g*x+s)

btw. what is the other distortion? it's based on a circuit?
giq

Post

IIRC the Simulanalog method involves the derivative of the input signal. Not sure what implications this has regarding accuracy, but it might be better if you can avoid that.

Richard
Synapse Audio Software - www.synapse-audio.com

Post

Yes, I made another function based on the SD1 distortion pedal. I'm still in the process of thinking about amps, but I don't have the time at the moment :(

Richard > it uses the derivative of the signal to analyze the stability of the algorithm. Then the derivative appears due to the trapezoidal integration, but that's OK IMHO.

Post

Any idea on how to make it stable?

y = f*(in-feedback) + s - 0.00016 * sinhf(feedback*40.0)

sinhf acts like 'a switch' and after a threshold quickly approaches to inf. This causes huge numerical problems when using Newton-Rhapson.
giq

Post

itoa wrote:Any idea on how to make it stable?

y = f*(in-feedback) + s - 0.00016 * sinhf(feedback*40.0)

sinhf acts like 'a switch' and after a threshold quickly approaches to inf. This causes huge numerical problems when using Newton-Rhapson.
I thought you wanted to use a table (sorry, I'm following this thread only superficially). How about solving for the value rather than the argument of sinh? (Or for anything containing the value of sinh).

Post

Table works great :) but I'm curious on different methods of transforming nonlinear ODEs to something solvable
giq

Post

How about off-current inaccuracy in real diodes? How many % is it?

Miles: could you post ODE of your circuit? I can't figure this out from your code :/
giq

Post

If you use a table with precomputed tables, do you still have any problem ? If not, that means your problem is about the convergence of Newton-Raphson. If you still have instability, then your ODE may be stiff, and there is a numerical way to verify it. But since you use a trapezoidal integrator, stiffness shouldn't be a problem, so I guess it's Newton Raphson. Or a standard algorithm bug :hihi:

Could you post some pseudo code showing what you are doing ?

Post

Wolfen: I think that diodes make systems stiff as a hell :) and thats the main problem.

Using table for inverted function improves stability region greatly. Although the limit still exists its quite acceptable.
giq

Post

Maybe try putting a resistor between the diodes and ground?

Post

I think, if you try solving for the value rather than the argument of sinh, then sinh works as a saturator, rather than the booster. That should make the system kind of the opposite of being stiff. At least seems so to me at the first look, maybe I'm wrong here.

Speaking of trapezoidal integration and stiffness. Trapezoidal integration may have a problem with that, particularly in case of strong positive feedback. But I don't think that's the case here.

Post

Yes you are right.. reverse function forms a sigmoid and this helps a lot + as this is 1 dimensional equation, this is instantly solvable and fast

btw. Just realised that these RC values means 7MHz cutoff SIC?!
giq

Post

Inverse function is a really clever idea that should work.

Btw, you can also use Bisection method, should be robust and work fine even in realtime (if you don't like tables). You already know the output is never going to exceed a certain value as it's clipped by the diodes, so you can start the iteration at +/- 1V or something.

Richard
Synapse Audio Software - www.synapse-audio.com

Post

A bit excitation here. Just found a method of doing this analytically for practically any number of dimensions, this reduces aliasing as well. I mean computation of n-dimensional inverse function. Should I share ? ;)

edit: its a bullshit ;) except alias reduction part haha
Last edited by itoa on Wed Oct 08, 2014 10:18 am, edited 1 time in total.
giq

Post Reply

Return to “DSP and Plugin Development”