1// generated automatically
2// DO NOT MODIFY!
3declare id "bmp";
4declare name "BigMuffPi";
5declare category "Fuzz";
6declare shortname "BMP";
7declare description "BigMuffPi";
8declare samplerate "96000";
9
10import("stdfaust.lib");
11
12bpmin = pre : fi.iir((b0/a0,b1/a0,b2/a0),(a1/a0,a2/a0)) with {
13    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
14    Inverted(b, x) = ba.if(b, 1 - x, x);
15    s = 0.993;
16    fs = float(ma.SR);
17    pre = _;
18
19
20    b0 = 3.7454979802542e-6*fs;
21
22    b1 = 0;
23
24    b2 = -3.7454979802542e-6*fs;
25
26    a0 = 2.08287704934496e-5*fs + 0.000219016314271736;
27
28    a1 = 0.000438032628543473;
29
30    a2 = -2.08287704934496e-5*fs + 0.000219016314271736;
31};
32
33bpmamp1 = pre : fi.iir((b0/a0,b1/a0,b2/a0),(a1/a0,a2/a0)) with {
34    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
35    Inverted(b, x) = ba.if(b, 1 - x, x);
36    s = 0.993;
37    fs = float(ma.SR);
38    pre = _;
39
40
41        Sustain = vslider("Sustain[name:Sustain]", 0.5, 0, 1, 0.01) : Inverted(0) : si.smooth(s);
42
43    b0 = Sustain*fs*(2.26293387153501e-12*fs - 1.17905906929765e-5) + fs*(2.26293387153501e-14*fs - 1.17905906929765e-7);
44
45    b1 = -4.52586774307001e-12*Sustain*pow(fs,2) - 4.52586774307001e-14*pow(fs,2);
46
47    b2 = Sustain*fs*(2.26293387153501e-12*fs + 1.17905906929765e-5) + fs*(2.26293387153501e-14*fs + 1.17905906929765e-7);
48
49    a0 = Sustain*(Sustain*fs*(-1.13446519814126e-9*fs - 2.89110812782566e-6) + fs*(1.12312054615984e-9*fs + 2.8621970465474e-6)) + fs*(1.2821120020393e-10*fs + 6.26521815410076e-7) + 0.000146000960455196;
50
51    a1 = Sustain*(2.26893039628251e-9*Sustain*pow(fs,2) - 2.24624109231969e-9*pow(fs,2)) - 2.5642240040786e-10*pow(fs,2) + 0.000292001920910392;
52
53    a2 = Sustain*(Sustain*fs*(-1.13446519814126e-9*fs + 2.89110812782566e-6) + fs*(1.12312054615984e-9*fs - 2.8621970465474e-6)) + fs*(1.2821120020393e-10*fs - 6.26521815410076e-7) + 0.000146000960455196;
54};
55
56bpmamp2 = pre : fi.iir((b0/a0,b1/a0,b2/a0),(a1/a0,a2/a0)) with {
57    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
58    Inverted(b, x) = ba.if(b, 1 - x, x);
59    s = 0.993;
60    fs = float(ma.SR);
61    pre = _;
62
63
64    b0 = fs*(7.66731214399861e-12*fs - 3.99490857178962e-5);
65
66    b1 = -1.53346242879972e-11*pow(fs,2);
67
68    b2 = fs*(7.66731214399861e-12*fs + 3.99490857178962e-5);
69
70    a0 = fs*(3.920487958595e-10*fs + 2.00478727462711e-6) + 0.000489785157611555;
71
72    a1 = -7.84097591718999e-10*pow(fs,2) + 0.000979570315223111;
73
74    a2 = fs*(3.920487958595e-10*fs - 2.00478727462711e-6) + 0.000489785157611555;
75};
76
77bpmtone = pre : fi.iir((b0/a0,b1/a0,b2/a0),(a1/a0,a2/a0)) with {
78    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
79    Inverted(b, x) = ba.if(b, 1 - x, x);
80    s = 0.993;
81    fs = float(ma.SR);
82    pre = _;
83
84
85        Tone = vslider("Tone[name:Tone]", 0.5, 0, 1, 0.01) : Inverted(0) : si.smooth(s);
86
87    b0 = Tone*(3.68688858465455e-10*pow(fs,2) - 0.00316091270975185) + 8.67101574539126e-7*fs + 0.00401435914138484;
88
89    b1 = Tone*(-7.37377716930911e-10*pow(fs,2) - 0.00632182541950369) + 0.00802871828276969;
90
91    b2 = Tone*(3.68688858465455e-10*pow(fs,2) - 0.00316091270975185) - 8.67101574539126e-7*fs + 0.00401435914138484;
92
93    a0 = fs*(3.68688858465455e-10*fs + 3.03485551088694e-6) + 0.00486780557301784;
94
95    a1 = -7.37377716930911e-10*pow(fs,2) + 0.00973561114603569;
96
97    a2 = fs*(3.68688858465455e-10*fs - 3.03485551088694e-6) + 0.00486780557301784;
98};
99
100bpmout = pre : fi.iir((b0/a0,b1/a0,b2/a0),(a1/a0,a2/a0)) with {
101    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
102    Inverted(b, x) = ba.if(b, 1 - x, x);
103    s = 0.993;
104    fs = float(ma.SR);
105    pre = _;
106
107
108        Volume = vslider("Volume[name:Volume]", 0.5, 0, 1, 0.01) : Inverted(0) : si.smooth(s);
109
110    b0 = -1.74325899023428e-9*Volume*pow(fs,2);
111
112    b1 = 3.48651798046856e-9*Volume*pow(fs,2);
113
114    b2 = -1.74325899023428e-9*Volume*pow(fs,2);
115
116    a0 = fs*(4.33884681055068e-10*fs + 6.86809013445937e-9) + 2.65226702159437e-8;
117
118    a1 = -8.67769362110135e-10*pow(fs,2) + 5.30453404318874e-8;
119
120    a2 = fs*(4.33884681055068e-10*fs - 6.86809013445937e-9) + 2.65226702159437e-8;
121};
122
123antialiasing = pre : fi.iir((b0/a0,b1/a0,b2/a0,b3/a0,b4/a0),(a1/a0,a2/a0,a3/a0,a4/a0)) with {
124    LogPot(a, x) = ba.if(a, (exp(a * x) - 1) / (exp(a) - 1), x);
125    Inverted(b, x) = ba.if(b, 1 - x, x);
126    s = 0.993;
127    fs = float(ma.SR);
128    pre = _;
129
130
131    b0 = fs*(4.68362091734077e-13*fs + 7.44521670106066e-7);
132
133    b1 = 1.48904334021213e-6*fs;
134
135    b2 = -9.36724183468154e-13*pow(fs,2);
136
137    b3 = -1.48904334021213e-6*fs;
138
139    b4 = fs*(4.68362091734077e-13*fs - 7.44521670106066e-7);
140
141    a0 = fs*(7.55757331680132e-11*fs + 8.45438325675249e-7) + 0.000114185647251642;
142
143    a1 = 1.6908766513505e-6*fs + 0.00045674258900657;
144
145    a2 = -1.51151466336026e-10*pow(fs,2) + 0.000685113883509854;
146
147    a3 = -1.6908766513505e-6*fs + 0.00045674258900657;
148
149    a4 = fs*(7.55757331680132e-11*fs - 8.45438325675249e-7) + 0.000114185647251642;
150};
151
152    symclip = ffunction(float symclip(float), "clipping.h", "");
153    sclip = symclip(_);
154    clip(x) = atan(x)/ma.PI;
155
156process = bpmin : bpmamp1 : clip  : bpmamp2 : sclip  : bpmtone : bpmout;
157