File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
resources/assets/liveprog Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ desc: High Pass Filter
2
+ author: djneba, adapted from @thepbone lowpass
3
+
4
+ freq:80<10,200,1>Cut-off frequency
5
+ qFactor:0.707<0.10,10.00,0.01>Q factor
6
+
7
+ @init
8
+ freq = 100;
9
+ qFactor = 1.00;
10
+
11
+ function HighPassFilter_Set(frequency qFactor)(
12
+ x = (frequency * 2.f * $PI) / srate;
13
+ sinX = sin(x);
14
+ y = sinX / (qFactor * 2.f);
15
+ cosX = cos(x);
16
+ z = (1.f + cosX) / 2.f;
17
+
18
+ _a0 = y + 1.f;
19
+ _a1 = cosX * -2.f;
20
+ _a2 = 1.f - y;
21
+ _b0 = z;
22
+ _b1 = -(1.f + cosX);
23
+ _b2 = z;
24
+
25
+ this.y_2 = 0; this.y_1 = 0; this.x_2 = 0; this.x_1 = 0;
26
+ this.b0 = _b0 / _a0;
27
+ this.b1 = _b1 / _a0;
28
+ this.b2 = _b2 / _a0;
29
+ this.a1 = -_a1 / _a0;
30
+ this.a2 = -_a2 / _a0;
31
+ );
32
+
33
+ function HighPassFilter_ProcessSample(sample)(
34
+ out = sample * this.b0
35
+ + this.x_1 * this.b1
36
+ + this.x_2 * this.b2
37
+ + this.y_1 * this.a1
38
+ + this.y_2 * this.a2;
39
+
40
+ this.y_2 = this.y_1;
41
+ this.y_1 = out;
42
+ this.x_2 = this.x_1;
43
+ this.x_1 = sample;
44
+
45
+ out;
46
+ );
47
+
48
+ hipass.HighPassFilter_Set(freq, qFactor);
49
+
50
+ @sample
51
+ spl0 = hipass.HighPassFilter_ProcessSample(spl0);
52
+ spl1 = hipass.HighPassFilter_ProcessSample(spl1);
You can’t perform that action at this time.
0 commit comments