For anyone who wants it.
Here is a simple sinefold distortion, with a hardclip threshold
//Xander'
import("stdfaust.lib");
//sinefold function
distortion(x) = aa.sine(strength * x)
with {
strength = hslider("strength", 1, 1,100,0.01) : si.smooth(0.999);
};
//clip function
clip = min(thresh_linear) : max(0 - thresh_linear)
with {
threshold = hslider("threshold", -0.3, -100,0, 0.01) : si.smooth(0.999);
thresh_linear = pow(10, threshold/ 20);
};
//variable for individual input, including effect and input and output gain
stereo = *(pregain_linear) : (distortion : clip) * postgain_linear
with {
pregain = hslider("pregain", 1, -100,20,0.01) : si.smooth(0.999);
pregain_linear = ba.db2linear(pregain);
postgain = hslider("postgain", 0, -100,20,0.01) : si.smooth(0.999);
postgain_linear = ba.db2linear(postgain);
};
process = stereo, stereo;