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