@@ -6,16 +6,16 @@ in_pin:Right
6
6
out_pin:Left
7
7
out_pin:Right
8
8
9
- slider1:band_count=6<1 ,20,1>Number of bands
9
+ slider1:band_count=6<2 ,20,1>Number of bands
10
10
slider2:low_freq=200<30,2000>Low freq
11
11
slider3:high_freq=6000<1000,18000>High freq
12
12
slider4:cycle_phase_offset=0.5<0,1>Phase Offset
13
- slider5:cycle_phase_lfo_hz=0<-10,10>Phase LFO (hz)
14
- slider6:cycle_phase_invbeat=0.5<-4,4,0.5 >Phase LFO (/beat )
15
- slider7:filter_mode=0<0,1,1{cut, boost}>-Filter type
16
- slider8:filter_db=12 <0,60,0.1 >Filter strength (dB)
17
- slider9:filter_width_factor=0.3<0.01,0.7 >Filter width
18
- slider10:filter_restoration=1<0,2 >Filter compensation
13
+ slider5:cycle_phase_stereo_offset=0.15<-0.5,0.5>Stereo Offset
14
+ slider6:cycle_phase_lfo_hz=0<-10,10 >Phase LFO (hz )
15
+ slider7:cycle_phase_invbeat=0.5<-4,4,0.5>Phase LFO (/beat)
16
+ slider8:filter_mode=0 <0,1,1{cut, boost} >Filter type
17
+ slider9:filter_db=60<0,60,0.1 >Filter strength (dB)
18
+ slider10:filter_width_factor=0.3<0.01,0.7 >Filter width
19
19
20
20
import ui-lib.jsfx-inc
21
21
import filter-utils.jsfx-inc
@@ -25,7 +25,8 @@ import filter-utils.jsfx-inc
25
25
MAX_BAND_COUNT = 20 + 5;
26
26
27
27
freemem = ui_setup(0);
28
- freemem = (filter_mem = freemem) + 18*MAX_BAND_COUNT;
28
+ freemem = (filter_mem_l = freemem) + 14/*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2*/*MAX_BAND_COUNT;
29
+ freemem = (filter_mem_r = freemem) + 14/*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2*/*MAX_BAND_COUNT;
29
30
30
31
phase_logger_length = ceil(srate*1/(samplesblock ? samplesblock : 256));
31
32
freemem = (phase_logger_buffer = freemem) + phase_logger_length;
@@ -45,50 +46,48 @@ function gain_window(x) (
45
46
0.5 - 0.5*cos(x*2*$pi);
46
47
);
47
48
48
- function calculate_filters() local(i, freq, gain, band_gain, bw, future_samples, future_factor, future_phase, filter_mem_i) (
49
+ function calculate_filters(filter_mem, current_phase ) local(i, freq, gain, band_gain, bw, future_samples, future_factor, future_phase, filter_mem_i) (
49
50
filters_to_mem();
50
51
51
52
// Calculate filter targets
52
53
// Future time is min(samples_to_next_block, [when the next filter will pop off an edge])
53
54
// Predict that far in future, divide by distance
54
55
future_samples = samples_to_next_block;
55
56
cycle_phase_step > 0 ? (
56
- future_samples = min(future_samples, ceil((1 - cycle_phase )/cycle_phase_step));
57
+ future_samples = min(future_samples, ceil((1 - current_phase )/cycle_phase_step));
57
58
) : cycle_phase_step < 0 ? (
58
- future_samples = min(future_samples, ceil(cycle_phase /-cycle_phase_step));
59
+ future_samples = min(future_samples, ceil(current_phase /-cycle_phase_step));
59
60
);
60
61
future_factor = future_samples ? 1/future_samples : 0;
61
62
62
- future_phase = cycle_phase + cycle_phase_step*future_samples;
63
+ future_phase = current_phase + cycle_phase_step*future_samples;
63
64
64
65
bw = filter_width_factor*(log(high_freq/low_freq)/log(2)/band_count);
65
66
66
67
i = 0;
67
68
loop(band_count + 2,
68
- filter_mem_i = filter_mem + 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */*i;
69
+ filter_mem_i = filter_mem + 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */*i;
69
70
i >= band_count ? (
70
- // Magic equations found through trial and error!
71
71
band_width = filter_width_factor*log(high_freq/low_freq)/log(2)/band_count;
72
72
filter_mode == 0 ? (
73
+ // Magic equations found through trial and error!
73
74
band_gain = pow(10, -filter_db/20);
74
75
gain = 1 + (1 - band_gain)*1.2*filter_width_factor*filter_width_factor;
75
76
i == band_count ? (
76
77
freq = 1/(1.18 + band_gain)*low_freq*exp(log(high_freq/low_freq)*(band_count - 0.4)/band_count);
77
78
target_filter.filter_highshelf_gainslope(freq/srate, 1/gain, 1.8 - band_gain);
78
79
) : (
79
80
freq = (1.18 + band_gain)*low_freq*exp(log(high_freq/low_freq)*(0.4)/band_count);
80
- debug.freq = freq/296.0647;
81
81
target_filter.filter_highshelf_gainslope(freq/srate, gain, 1.8 - band_gain);
82
82
);
83
83
) : (
84
84
band_gain = pow(10, -filter_db/20);
85
- gain = pow(10, -filter_db*filter_width_factor*1.5/20);
85
+ gain = pow(10, -filter_db*(0.5 + filter_width_factor) *1.5/20);
86
86
i == band_count ? (
87
- freq = 1/(1.18 + 0*band_gain)*low_freq*exp(log(high_freq/low_freq)*(band_count - 1)*1/band_count);
87
+ freq = 1/(1.18 + 0*band_gain)*low_freq*exp(log(high_freq/low_freq)*(band_count - 1 - min(0.4, filter_width_factor) )*1/band_count);
88
88
target_filter.filter_highshelf_gainslope(freq/srate, 1/gain, 1);
89
89
) : (
90
- freq = (1.18 + 0*band_gain)*low_freq*exp(log(high_freq/low_freq)*(1)/band_count);
91
- debug.freq = freq/296.0647;
90
+ freq = (1.18 + 0*band_gain)*low_freq*exp(log(high_freq/low_freq)*(1 + min(0.4, filter_width_factor))/band_count);
92
91
target_filter.filter_highshelf_gainslope(freq/srate, gain, 1);
93
92
);
94
93
);
@@ -122,10 +121,10 @@ function calculate_filters() local(i, freq, gain, band_gain, bw, future_samples,
122
121
filters_from_mem();
123
122
);
124
123
125
- function step_filters() local(i, filter_mem_i) (
124
+ function step_filters(filter_mem ) local(i, filter_mem_i) (
126
125
i = 0;
127
126
loop(actual_band_count,
128
- filter_mem_i = filter_mem + 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */*i;
127
+ filter_mem_i = filter_mem + 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */*i;
129
128
filter_mem_i[0/*FILTER:A1*/] += filter_mem_i[5/*FILTER:A1_STEP*/];
130
129
filter_mem_i[1/*FILTER:A2*/] += filter_mem_i[6/*FILTER:A2_STEP*/];
131
130
filter_mem_i[2/*FILTER:B0*/] += filter_mem_i[7/*FILTER:B0_STEP*/];
@@ -135,13 +134,11 @@ function step_filters() local(i, filter_mem_i) (
135
134
);
136
135
);
137
136
138
- function shift_filters_down() local(i, filter_mem_i) (
139
- cycle_phase -= 1;
140
-
137
+ function shift_filters_down(filter_mem) local(i, filter_mem_i) (
141
138
// Shunt all filters down
142
- i = band_count*18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */ - 1;
143
- while (i >= 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */) (
144
- filter_mem[i] = filter_mem[i - 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */];
139
+ i = band_count*14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */ - 1;
140
+ while (i >= 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */) (
141
+ filter_mem[i] = filter_mem[i - 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */];
145
142
i -= 1;
146
143
);
147
144
@@ -158,22 +155,15 @@ function shift_filters_down() local(i, filter_mem_i) (
158
155
filter_mem_i[4/*FILTER:B2*/] = target_filter.b2;
159
156
160
157
// Rewrite output - zero gain, so should be same as input
161
- filter_mem_i[10/*FILTER:Y1_L*/] = filter_mem_i[11/*FILTER:X1_L*/];
162
- filter_mem_i[12/*FILTER:Y2_L*/] = filter_mem_i[13/*FILTER:X2_L*/];
163
- filter_mem_i[14/*FILTER:Y1_R*/] = filter_mem_i[15/*FILTER:X1_R*/];
164
- filter_mem_i[16/*FILTER:Y2_R*/] = filter_mem_i[17/*FILTER:X2_R*/];
165
-
166
- // Now calculate_filters will do the correct thing
167
- calculate_filters();
158
+ filter_mem_i[10/*FILTER:Y1*/] = filter_mem_i[11/*FILTER:X1*/];
159
+ filter_mem_i[12/*FILTER:Y2*/] = filter_mem_i[13/*FILTER:X2*/];
168
160
);
169
161
170
- function shift_filters_up() local(i, bw, filter_mem_i) (
171
- cycle_phase += 1;
172
-
162
+ function shift_filters_up(filter_mem) local(i, bw, filter_mem_i) (
173
163
// Shunt all filters up
174
164
i = 0;
175
- while (i < (band_count - 1)*18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */) (
176
- filter_mem[i] = filter_mem[i + 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */];
165
+ while (i < (band_count - 1)*14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */) (
166
+ filter_mem[i] = filter_mem[i + 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */];
177
167
i += 1;
178
168
);
179
169
@@ -182,24 +172,19 @@ function shift_filters_up() local(i, bw, filter_mem_i) (
182
172
target_filter.filter_band(high_freq, 1, bw);
183
173
shift_up_new_filter.filter_band(high_freq, 1, bw);
184
174
// Copy coefficients
185
- filter_mem_i = filter_mem + (band_count - 1)*18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */;
175
+ filter_mem_i = filter_mem + (band_count - 1)*14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */;
186
176
filter_mem_i[0/*FILTER:A1*/] = target_filter.a1;
187
177
filter_mem_i[1/*FILTER:A2*/] = target_filter.a2;
188
178
filter_mem_i[2/*FILTER:B0*/] = target_filter.b0;
189
179
filter_mem_i[3/*FILTER:B1*/] = target_filter.b1;
190
180
filter_mem_i[4/*FILTER:B2*/] = target_filter.b2;
191
181
192
182
// Rewrite output - zero gain, so should be same as input
193
- filter_mem_i[10/*FILTER:Y1_L*/] = filter_mem_i[11/*FILTER:X1_L*/];
194
- filter_mem_i[12/*FILTER:Y2_L*/] = filter_mem_i[13/*FILTER:X2_L*/];
195
- filter_mem_i[14/*FILTER:Y1_R*/] = filter_mem_i[15/*FILTER:X1_R*/];
196
- filter_mem_i[16/*FILTER:Y2_R*/] = filter_mem_i[17/*FILTER:X2_R*/];
197
-
198
- // Now calculate_filters will do the correct thing
199
- calculate_filters();
183
+ filter_mem_i[10/*FILTER:Y1*/] = filter_mem_i[11/*FILTER:X1*/];
184
+ filter_mem_i[12/*FILTER:Y2*/] = filter_mem_i[13/*FILTER:X2*/];
200
185
);
201
186
202
- function correction_amp(freq) local(wi, wr, hi, hr, pr, pi, pm2, zr, zi, tr, ti, i, filter_mem_i) (
187
+ function correction_amp(filter_mem, freq) local(wi, wr, hi, hr, pr, pi, pm2, zr, zi, tr, ti, i, filter_mem_i) (
203
188
hr = 1;
204
189
hi = 0;
205
190
wr = cos(2*$pi*freq/srate);
@@ -209,7 +194,7 @@ function correction_amp(freq) local(wi, wr, hi, hr, pr, pi, pm2, zr, zi, tr, ti,
209
194
210
195
i = 0;
211
196
while (i < actual_band_count) (
212
- filter_mem_i = filter_mem + 18 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R */*i;
197
+ filter_mem_i = filter_mem + 14 /*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2 */*i;
213
198
// Numerator (B)
214
199
zr = filter_mem_i[2/*FILTER:B0*/] + filter_mem_i[3/*FILTER:B1*/]*wr + filter_mem_i[4/*FILTER:B2*/]*w2r;
215
200
zi = filter_mem_i[3/*FILTER:B1*/]*wi + filter_mem_i[4/*FILTER:B2*/]*w2i;
@@ -236,46 +221,22 @@ function correction_amp(freq) local(wi, wr, hi, hr, pr, pi, pm2, zr, zi, tr, ti,
236
221
sqrt(hr*hr + hi*hi);
237
222
);
238
223
239
- /*
240
- function correction_phase(freq) local(wi, wr, hi, hr, pr, pi, pm2, zr, zi, tr, ti, i) (
241
- hr = 1;
242
- hi = 0;
243
- wr = cos(2*$pi*freq/srate);
244
- wi = sin(2*$pi*freq/srate);
245
- w2r = cos(4*$pi*freq/srate);
246
- w2i = sin(4*$pi*freq/srate);
247
-
248
- i = 0;
249
- while (i < correction_N) (
250
- zr = correction_b0[i] + correction_b1[i]*wr + correction_b2[i]*w2r;
251
- zi = correction_b1[i]*wi + correction_b2[i]*w2i;
252
- pr = 1 + correction_a1[i]*wr + correction_a2[i]*w2r;
253
- pi = correction_a1[i]*wi + correction_a2[i]*w2i;
254
- pm2 = pr*pr + pi*pi;
255
-
256
- tr = hr;
257
- ti = hi;
258
- hr = tr*zr - ti*zi;
259
- hi = tr*zi + ti*zr;
260
-
261
- tr = hr;
262
- ti = hi;
263
- hr = tr*pr + ti*pi;
264
- hi = ti*pr - tr*pi;
265
- hr /= pm2;
266
- hi /= pm2;
267
- i += 1;
268
- );
269
- atan2(hi, hr);
270
- );
271
- */
272
-
273
224
cycle_phase = play_position*cycle_phase_lfo_hz + beat_position*cycle_phase_invbeat + cycle_phase_offset;
274
225
cycle_phase -= floor(cycle_phase);
275
226
cycle_phase_offset_prev = cycle_phase_offset;
276
227
277
- samples_to_next_block = 1000;
278
- calculate_filters();
228
+ samples_to_next_block = 0;
229
+ cycle_phase_step = 0;
230
+
231
+ function calculate_filters_stereo() (
232
+ cycle_phase_left = cycle_phase - cycle_phase_stereo_offset*0.5;
233
+ cycle_phase_left -= floor(cycle_phase_left);
234
+ calculate_filters(filter_mem_l, cycle_phase_left);
235
+ cycle_phase_right = cycle_phase + cycle_phase_stereo_offset*0.5;
236
+ cycle_phase_right -= floor(cycle_phase_right);
237
+ calculate_filters(filter_mem_r, cycle_phase_right);
238
+ );
239
+ calculate_filters_stereo();
279
240
280
241
@block
281
242
@@ -311,64 +272,69 @@ cycle_phase_blockdelta += cycle_phase_adjustment;
311
272
312
273
samples_to_next_block = samplesblock;
313
274
cycle_phase_step = cycle_phase_blockdelta/samplesblock;
275
+ calculate_filters_stereo(samplesblock);
314
276
315
- // Get ready for the next block
316
- beat_position_next_block = beat_position + beat_blockdelta;
317
- cycle_phase_offset_prev = cycle_phase_offset;
318
-
319
- calculate_filters();
320
-
277
+ // Phase logging
321
278
phase_logger_buffer[phase_logger_index] = cycle_phase;
322
279
phase_logger_index += 1;
323
280
phase_logger_index >= phase_logger_length ? (
324
281
phase_logger_index = 0;
325
282
);
326
283
284
+ // Get ready for the next block
285
+ beat_position_next_block = beat_position + beat_blockdelta;
286
+ cycle_phase_offset_prev = cycle_phase_offset;
287
+ cycle_phase += cycle_phase_blockdelta;
288
+
327
289
@sample
328
290
329
- x0_l = spl0;
330
- x0_r = spl1;
331
-
332
- i = 0;
333
- loop(actual_band_count,
334
- filter_mem_i = filter_mem + i*18/*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1_L, X1_L, Y2_L, X2_L, Y1_R, X1_R, Y2_R, X2_R*/;
335
-
336
- y0_l = x0_l*filter_mem_i[2/*FILTER:B0*/]
337
- + filter_mem_i[11/*FILTER:X1_L*/]*filter_mem_i[3/*FILTER:B1*/]
338
- + filter_mem_i[13/*FILTER:X2_L*/]*filter_mem_i[4/*FILTER:B2*/]
339
- - filter_mem_i[10/*FILTER:Y1_L*/]*filter_mem_i[0/*FILTER:A1*/]
340
- - filter_mem_i[12/*FILTER:Y2_L*/]*filter_mem_i[1/*FILTER:A2*/];
341
- filter_mem_i[13/*FILTER:X2_L*/] = filter_mem_i[11/*FILTER:X1_L*/];
342
- filter_mem_i[11/*FILTER:X1_L*/] = x0_l;
343
- filter_mem_i[12/*FILTER:Y2_L*/] = filter_mem_i[10/*FILTER:Y1_L*/];
344
- filter_mem_i[10/*FILTER:Y1_L*/] = y0_l;
345
- x0_l = y0_l;
346
-
347
- y0_r = x0_r*filter_mem_i[2/*FILTER:B0*/]
348
- + filter_mem_i[15/*FILTER:X1_R*/]*filter_mem_i[3/*FILTER:B1*/]
349
- + filter_mem_i[17/*FILTER:X2_R*/]*filter_mem_i[4/*FILTER:B2*/]
350
- - filter_mem_i[14/*FILTER:Y1_R*/]*filter_mem_i[0/*FILTER:A1*/]
351
- - filter_mem_i[16/*FILTER:Y2_R*/]*filter_mem_i[1/*FILTER:A2*/];
352
- filter_mem_i[17/*FILTER:X2_R*/] = filter_mem_i[15/*FILTER:X1_R*/];
353
- filter_mem_i[15/*FILTER:X1_R*/] = x0_r;
354
- filter_mem_i[16/*FILTER:Y2_R*/] = filter_mem_i[14/*FILTER:Y1_R*/];
355
- filter_mem_i[14/*FILTER:Y1_R*/] = y0_r;
356
- x0_r = y0_r;
357
-
358
- i += 1;
291
+ function filter(x0, filter_mem) local(i, y0, filter_mem_i) (
292
+ i = 0;
293
+ loop(actual_band_count,
294
+ filter_mem_i = filter_mem + i*14/*FILTER: A1, A2, B0, B1, B2, A1_STEP, A2_STEP, B0_STEP, B1_STEP, B2_STEP, Y1, X1, Y2, X2*/;
295
+
296
+ y0 = x0*filter_mem_i[2/*FILTER:B0*/]
297
+ + filter_mem_i[11/*FILTER:X1*/]*filter_mem_i[3/*FILTER:B1*/]
298
+ + filter_mem_i[13/*FILTER:X2*/]*filter_mem_i[4/*FILTER:B2*/]
299
+ - filter_mem_i[10/*FILTER:Y1*/]*filter_mem_i[0/*FILTER:A1*/]
300
+ - filter_mem_i[12/*FILTER:Y2*/]*filter_mem_i[1/*FILTER:A2*/];
301
+ filter_mem_i[13/*FILTER:X2*/] = filter_mem_i[11/*FILTER:X1*/];
302
+ filter_mem_i[11/*FILTER:X1*/] = x0;
303
+ filter_mem_i[12/*FILTER:Y2*/] = filter_mem_i[10/*FILTER:Y1*/];
304
+ filter_mem_i[10/*FILTER:Y1*/] = y0;
305
+ x0 = y0;
306
+ i += 1;
307
+ );
308
+ x0;
359
309
);
360
310
361
- spl0 = x0_l ;
362
- spl1 = x0_r ;
311
+ spl0 = filter(spl0, filter_mem_l) ;
312
+ spl1 = filter(spl1, filter_mem_r) ;
363
313
364
- step_filters();
314
+ step_filters(filter_mem_l);
315
+ step_filters(filter_mem_r);
365
316
366
- cycle_phase += cycle_phase_step;
367
- while (cycle_phase >= 1) (
368
- shift_filters_down();
317
+ cycle_phase_left += cycle_phase_step;
318
+ while (cycle_phase_left >= 1) (
319
+ cycle_phase_left -= 1;
320
+ shift_filters_down(filter_mem_l);
321
+ calculate_filters(filter_mem_l, cycle_phase_left);
322
+ );
323
+ while (cycle_phase_left < 0) (
324
+ cycle_phase_left += 1;
325
+ shift_filters_up(filter_mem_l);
326
+ calculate_filters(filter_mem_l, cycle_phase_left);
327
+ );
328
+ cycle_phase_right += cycle_phase_step;
329
+ while (cycle_phase_right >= 1) (
330
+ cycle_phase_right -= 1;
331
+ shift_filters_down(filter_mem_r);
332
+ calculate_filters(filter_mem_r, cycle_phase_right);
369
333
);
370
- while (cycle_phase < 0) (
371
- shift_filters_up();
334
+ while (cycle_phase_right < 0) (
335
+ cycle_phase_right += 1;
336
+ shift_filters_up(filter_mem_r);
337
+ calculate_filters(filter_mem_r, cycle_phase_right);
372
338
);
373
339
374
340
samples_to_next_block -= 1;
@@ -406,13 +372,24 @@ ui_screen() == "main" ? (
406
372
ui_pop();
407
373
408
374
control_background_technical();
375
+
409
376
g_i = 0;
410
377
loop(g_buffer_length,
411
378
g_freq = 20*exp(log(18000/20)*g_i/g_buffer_length);
412
- g_buffer[g_i] = log(correction_amp(g_freq))*20/log(10);
379
+ g_buffer[g_i] = log(correction_amp(filter_mem_l, g_freq))*20/log(10);
413
380
g_i += 1;
414
381
);
415
382
ui_graph(g_buffer, g_buffer_length, -20, 20);
383
+
384
+ ui_color(96, 192, 256, 0.6);
385
+ g_i = 0;
386
+ loop(g_buffer_length,
387
+ g_freq = 20*exp(log(18000/20)*g_i/g_buffer_length);
388
+ g_buffer[g_i] = log(correction_amp(filter_mem_r, g_freq))*20/log(10);
389
+ g_i += 1;
390
+ );
391
+ ui_graph(g_buffer, g_buffer_length, -20, 20);
392
+
416
393
control_finish_technical();
417
394
) : control_system();
418
395
0 commit comments