I did already a diode clip model, but I think this softclip should also be ok:aciddose wrote:Ideally if you're modelling a common diode clamp you'll want a high-pass filter (single capacitor) leading into a resistor and diode pair. There are various ways to model this, all of them are horrifyingly complicated and expensive.
Code: Select all
function clamp(x) local(x2 y sg)
(
sg = sign(x);
x = abs(x);
x2 = x - 0.6;
x <= 0.6 ? y = x : y = x2/3/(1/3+x2)+0.6 ;
y * sg;
);
