1 2/* A simple waveshaping effect. */ 3 4declare name "fuzz -- a simple distortion effect"; 5declare author "Bram de Jong (from musicdsp.org)"; 6declare version "1.0"; 7 8import("music.lib"); 9 10dist = hslider("distortion", 12, 0, 100, 0.1); // distortion parameter 11gain = hslider("gain", 3, -96, 96, 0.1); // output gain (dB) 12 13// the waveshaping function 14f(a,x) = x*(abs(x) + a)/(x*x + (a-1)*abs(x) + 1); 15 16// gain correction factor to compensate for distortion 17g(a) = 1/sqrt(a+1); 18 19process = vgroup("dist", (out, out)) 20with { out(x) = db2linear(gain)*g(dist)*f(db2linear(dist),x); }; 21