Commit 2aeac2a6c3ec0f8b382840967ae96d76e3646ab5

Thomas de Grivel 2020-02-20T09:46:11

wip Butterworth second order 10 band equalizer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
diff --git a/Makefile.am b/Makefile.am
index 49621d9..56d6552 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,6 +91,7 @@ librtbuf_signal_la_SOURCES = \
 	rtbuf_signal.c \
 	rtbuf_signal_bandpass2.c \
 	rtbuf_signal_delay.c \
+	rtbuf_signal_equalizer10.c \
 	rtbuf_signal_flanger.c \
 	rtbuf_signal_hipass.c \
 	rtbuf_signal_hipass2.c \
diff --git a/rtbuf_signal.c b/rtbuf_signal.c
index c679dab..f8b318c 100644
--- a/rtbuf_signal.c
+++ b/rtbuf_signal.c
@@ -57,6 +57,78 @@ s_rtbuf_lib_proc_out g_rtbuf_signal_delay_out[] = {
   { "pos", "unsigned int" },
   { 0, 0 } };
 
+s_rtbuf_lib_proc_in g_rtbuf_signal_equalizer10_in[] = {
+  { "signal", RTBUF_SIGNAL_TYPE, 0.0, -1.0, 1.0 },
+  { "amp32",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp64",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp128", RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp256", RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp512", RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp1k",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp2k",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp4k",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp8k",  RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { "amp16k", RTBUF_SIGNAL_TYPE, 1.0, 0.0, 10.0 },
+  { 0, 0, 0.0, 0.0, 0.0 } };
+
+s_rtbuf_lib_proc_out g_rtbuf_signal_equalizer10_out[] = {
+  { "signal",    RTBUF_SIGNAL_TYPE },
+  { "signal32",  RTBUF_SIGNAL_TYPE },
+  { "signal64",  RTBUF_SIGNAL_TYPE },
+  { "signal128", RTBUF_SIGNAL_TYPE },
+  { "signal256", RTBUF_SIGNAL_TYPE },
+  { "signal512", RTBUF_SIGNAL_TYPE },
+  { "signal1k",  RTBUF_SIGNAL_TYPE },
+  { "signal2k",  RTBUF_SIGNAL_TYPE },
+  { "signal4k",  RTBUF_SIGNAL_TYPE },
+  { "signal8k",  RTBUF_SIGNAL_TYPE },
+  { "signal16k", RTBUF_SIGNAL_TYPE },
+  { "x1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "x2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "x3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "x4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y0_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y0_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y0_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y0_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y1_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y1_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y1_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y1_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y2_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y2_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y2_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y2_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y3_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y3_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y3_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y3_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y4_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y4_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y4_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y4_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y5_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y5_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y5_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y5_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y6_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y6_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y6_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y6_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y7_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y7_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y7_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y7_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y8_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y8_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y8_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y8_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y9_1", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y9_2", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y9_3", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { "y9_4", RTBUF_SIGNAL_SAMPLE_TYPE },
+  { 0, 0 } };
+
 s_rtbuf_lib_proc_in g_rtbuf_signal_flanger_in[] = {
   { "signal",    RTBUF_SIGNAL_TYPE, 0.0, -1.0, 1.0 },
   { "frequency", RTBUF_SIGNAL_TYPE, 0.5, 0.0, RTBUF_SIGNAL_SAMPLERATE / 2.0 },
@@ -251,6 +323,8 @@ s_rtbuf_lib_proc rtbuf_lib_proc[] = {
     g_rtbuf_signal_bandpass2_in, g_rtbuf_signal_bandpass2_out },
   { "delay", rtbuf_signal_delay, rtbuf_signal_delay_start, 0,
     g_rtbuf_signal_delay_in, g_rtbuf_signal_delay_out },
+  { "equalizer10", rtbuf_signal_equalizer10, rtbuf_signal_equalizer10_start, 0,
+    g_rtbuf_signal_equalizer10_in, g_rtbuf_signal_equalizer10_out },
   { "flanger", rtbuf_signal_flanger, rtbuf_signal_flanger_start, 0,
     g_rtbuf_signal_flanger_in, g_rtbuf_signal_flanger_out },
   { "hipass", rtbuf_signal_hipass, rtbuf_signal_hipass_start, 0,
@@ -360,3 +434,5 @@ void rtbuf_signal_fun (s_rtbuf *rtb,
       rsf->sample_fun = rtbuf_signal_sample_from_signal;
   }
 }
+
+const double sqrt2_2 = M_SQRT2 * M_SQRT2;
diff --git a/rtbuf_signal.h b/rtbuf_signal.h
index e74c0a4..da5150c 100644
--- a/rtbuf_signal.h
+++ b/rtbuf_signal.h
@@ -100,15 +100,95 @@ typedef struct rtbuf_signal_delay_data {
 #pragma pack(pop)
 
 enum {
-  RTBUF_SIGNAL_DELAY_IN_SIGNAL = 0,
-  RTBUF_SIGNAL_DELAY_IN_DELAY,
-  RTBUF_SIGNAL_DELAY_IN_FEEDBACK,
-  RTBUF_SIGNAL_DELAY_INS
+        RTBUF_SIGNAL_DELAY_IN_SIGNAL = 0,
+        RTBUF_SIGNAL_DELAY_IN_DELAY,
+        RTBUF_SIGNAL_DELAY_IN_FEEDBACK,
+        RTBUF_SIGNAL_DELAY_INS
 };
 
 int rtbuf_signal_delay (s_rtbuf *rtb);
 int rtbuf_signal_delay_start (s_rtbuf *rtb);
 
+/* butterworth second order 10 band equalizer */
+
+#pragma pack(push,1)
+typedef struct rtbuf_signal_equalizer10_data {
+        t_rtbuf_signal signal;
+        t_rtbuf_signal signal32;
+        t_rtbuf_signal signal64;
+        t_rtbuf_signal signal128;
+        t_rtbuf_signal signal256;
+        t_rtbuf_signal signal512;
+        t_rtbuf_signal signal1k;
+        t_rtbuf_signal signal2k;
+        t_rtbuf_signal signal4k;
+        t_rtbuf_signal signal8k;
+        t_rtbuf_signal signal16k;
+        t_rtbuf_signal_sample x1;
+        t_rtbuf_signal_sample x2;
+        t_rtbuf_signal_sample x3;
+        t_rtbuf_signal_sample x4;
+        t_rtbuf_signal_sample y0_1;
+        t_rtbuf_signal_sample y0_2;
+        t_rtbuf_signal_sample y0_3;
+        t_rtbuf_signal_sample y0_4;
+        t_rtbuf_signal_sample y1_1;
+        t_rtbuf_signal_sample y1_2;
+        t_rtbuf_signal_sample y1_3;
+        t_rtbuf_signal_sample y1_4;
+        t_rtbuf_signal_sample y2_1;
+        t_rtbuf_signal_sample y2_2;
+        t_rtbuf_signal_sample y2_3;
+        t_rtbuf_signal_sample y2_4;
+        t_rtbuf_signal_sample y3_1;
+        t_rtbuf_signal_sample y3_2;
+        t_rtbuf_signal_sample y3_3;
+        t_rtbuf_signal_sample y3_4;
+        t_rtbuf_signal_sample y4_1;
+        t_rtbuf_signal_sample y4_2;
+        t_rtbuf_signal_sample y4_3;
+        t_rtbuf_signal_sample y4_4;
+        t_rtbuf_signal_sample y5_1;
+        t_rtbuf_signal_sample y5_2;
+        t_rtbuf_signal_sample y5_3;
+        t_rtbuf_signal_sample y5_4;
+        t_rtbuf_signal_sample y6_1;
+        t_rtbuf_signal_sample y6_2;
+        t_rtbuf_signal_sample y6_3;
+        t_rtbuf_signal_sample y6_4;
+        t_rtbuf_signal_sample y7_1;
+        t_rtbuf_signal_sample y7_2;
+        t_rtbuf_signal_sample y7_3;
+        t_rtbuf_signal_sample y7_4;
+        t_rtbuf_signal_sample y8_1;
+        t_rtbuf_signal_sample y8_2;
+        t_rtbuf_signal_sample y8_3;
+        t_rtbuf_signal_sample y8_4;
+        t_rtbuf_signal_sample y9_1;
+        t_rtbuf_signal_sample y9_2;
+        t_rtbuf_signal_sample y9_3;
+        t_rtbuf_signal_sample y9_4;
+} s_rtbuf_signal_equalizer10_data;
+#pragma pack(pop)
+
+enum {
+  RTBUF_SIGNAL_EQUALIZER10_IN_SIGNAL = 0,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP32,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP64,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP128,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP256,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP512,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP1K,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP2K,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP4K,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP8K,
+  RTBUF_SIGNAL_EQUALIZER10_IN_AMP16K,
+  RTBUF_SIGNAL_EQUALIZER10_INS
+};
+
+int rtbuf_signal_equalizer10 (s_rtbuf *rtb);
+int rtbuf_signal_equalizer10_start (s_rtbuf *rtb);
+
 /* flanger */
 
 #define RTBUF_SIGNAL_FLANGER_MAX 1
@@ -356,4 +436,6 @@ typedef struct rtbuf_signal_square_data {
 int rtbuf_signal_square (s_rtbuf *rtb);
 int rtbuf_signal_square_start (s_rtbuf *rtb);
 
+const double sqrt2_2;
+
 #endif /* RTBUF_SIGNAL_H */
diff --git a/rtbuf_signal_bandpass2.c b/rtbuf_signal_bandpass2.c
index cde5741..911d32c 100644
--- a/rtbuf_signal_bandpass2.c
+++ b/rtbuf_signal_bandpass2.c
@@ -49,8 +49,6 @@ y: (4 f2 w2 (x4 - 2 x2 + x) - (b y1 + c y2 + d y3 + e y4)) / a;
 #include "rtbuf.h"
 #include "rtbuf_signal.h"
 
-const double sqrt2_2 = M_SQRT2 * M_SQRT2;
-
 int rtbuf_signal_bandpass2_start (s_rtbuf *rtb)
 {
   s_rtbuf_signal_bandpass2_data *data;
diff --git a/rtbuf_signal_equalizer10.c b/rtbuf_signal_equalizer10.c
new file mode 100644
index 0000000..a1e1f84
--- /dev/null
+++ b/rtbuf_signal_equalizer10.c
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2020 Thomas de Grivel <thoxdg@gmail.com> +33614550127
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Butterworth bandpass second order filter
+s: 2*f*(1-z)/(1+z) $
+B2: (q*(s/w+w/s))^2+sqrt(2)*(q*(s/w+w/s))+1 $
+H: 1/B2 $
+ratsimp(H);
+           2  2  4      2  2  2      2  2
+(%o25) (4 f  w  z  - 8 f  w  z  + 4 f  w )
+    2  4    3/2      3       2  2      2   2    7/2  3           4  2   4
+/((q  w  - 2    f q w  + (8 f  q  + 4 f ) w  - 2    f  q w + 16 f  q ) z
+       2  4    5/2      3    9/2  3           4  2   3
+ + (4 q  w  - 2    f q w  + 2    f  q w - 64 f  q ) z
+       2  4           2  2       2   2       4  2   2
+ + (6 q  w  + ((- 16 f  q ) - 8 f ) w  + 96 f  q ) z
+       2  4    5/2      3    9/2  3           4  2       2  4    3/2      3
+ + (4 q  w  + 2    f q w  - 2    f  q w - 64 f  q ) z + q  w  + 2    f q w
+       2  2      2   2    7/2  3           4  2
+ + (8 f  q  + 4 f ) w  + 2    f  q w + 16 f  q )
+
+a:   q2 w4 + sqrt(2)^3 f q w3 +   (8 f2 q2 + 4 f2) w2 + sqrt(2)^7 f3 q w + 16 f4 q2;
+b: 4 q2 w4 + sqrt(2)^5 f q w3                         - sqrt(2)^9 f3 q w - 64 f4 q2;
+c: 6 q2 w4                    - 2 (8 f2 q2 + 4 f2) w2                    + 96 f4 q2;
+d: 4 q2 w4 - sqrt(2)^5 f q w3                         + sqrt(2)^9 f3 q w - 64 f4 q2;
+e:   q2 w4 - sqrt(2)^3 f q w3 +   (8 f2 q2 + 4 f2) w2 - sqrt(2)^7 f3 q w + 16 f4 q2;
+-----------------------------------------------------------------------------------
+a:   q2 w4 + sqrt(2)^3 f q w3 +   (2 q2 + 1) 4 f2 w2 + sqrt(2)^7 f3 q w + 16 f4 q2;
+b: 4 q2 w4 + sqrt(2)^5 f q w3                        - sqrt(2)^9 f3 q w - 64 f4 q2;
+c: 6 q2 w4                    - 2 (2 q2 + 1) 4 f2 w2                    + 96 f4 q2;
+d: 4 q2 w4 - sqrt(2)^5 f q w3                        + sqrt(2)^9 f3 q w - 64 f4 q2;
+e:   q2 w4 - sqrt(2)^3 f q w3 +   (2 q2 + 1) 4 f2 w2 - sqrt(2)^7 f3 q w + 16 f4 q2;
+-----------------------------------------------------------------------------------
+y: (4 f2 w2 (x4 - 2 x2 + x) - (b y1 + c y2 + d y3 + e y4)) / a;
+
+12db/octave
+fc: -3db
+3/12 = 1/4 octave = 3/4 et 5/4
+q: 2
+*/
+#include <math.h>
+#include "rtbuf.h"
+#include "rtbuf_signal.h"
+
+double sqrt2_3 = 0.0;
+double sqrt2_5;
+double sqrt2_7;
+double sqrt2_9;
+double f;
+double f2;
+double f3;
+double f4;
+
+int rtbuf_signal_equalizer10_start (s_rtbuf *rtb)
+{
+  s_rtbuf_signal_equalizer10_data *data;
+  assert(rtb->proc->out_bytes == sizeof(*data));
+  data = (s_rtbuf_signal_equalizer10_data*) rtb->data;
+  data->x1 = 0.0;
+  data->x2 = 0.0;
+  data->x3 = 0.0;
+  data->x4 = 0.0;
+  data->y0_1 = 0.0;
+  data->y0_2 = 0.0;
+  data->y0_3 = 0.0;
+  data->y0_4 = 0.0;
+  data->y1_1 = 0.0;
+  data->y1_2 = 0.0;
+  data->y1_3 = 0.0;
+  data->y1_4 = 0.0;
+  data->y2_1 = 0.0;
+  data->y2_2 = 0.0;
+  data->y2_3 = 0.0;
+  data->y2_4 = 0.0;
+  data->y3_1 = 0.0;
+  data->y3_2 = 0.0;
+  data->y3_3 = 0.0;
+  data->y3_4 = 0.0;
+  data->y4_1 = 0.0;
+  data->y4_2 = 0.0;
+  data->y4_3 = 0.0;
+  data->y4_4 = 0.0;
+  data->y5_1 = 0.0;
+  data->y5_2 = 0.0;
+  data->y5_3 = 0.0;
+  data->y5_4 = 0.0;
+  data->y6_1 = 0.0;
+  data->y6_2 = 0.0;
+  data->y6_3 = 0.0;
+  data->y6_4 = 0.0;
+  data->y7_1 = 0.0;
+  data->y7_2 = 0.0;
+  data->y7_3 = 0.0;
+  data->y7_4 = 0.0;
+  data->y8_1 = 0.0;
+  data->y8_2 = 0.0;
+  data->y8_3 = 0.0;
+  data->y8_4 = 0.0;
+  data->y9_1 = 0.0;
+  data->y9_2 = 0.0;
+  data->y9_3 = 0.0;
+  data->y9_4 = 0.0;
+  sqrt2_3 = sqrt2_2 * M_SQRT2;
+  sqrt2_5 = sqrt2_3 * sqrt2_2;
+  sqrt2_7 = sqrt2_5 * sqrt2_2;
+  sqrt2_9 = sqrt2_7 * sqrt2_2;
+  f = RTBUF_SIGNAL_SAMPLERATE;
+  f2 = f * f;
+  f3 = f2 * f;
+  f4 = f2 * f2;
+  return 0;
+}
+
+double butterworth_bandpass2 (const double x, const double fc,
+                              const double q, const double x2,
+                              const double x4, const double y1,
+                              const double y2, const double y3,
+                              const double y4)
+{
+  const double q2 = q * q;
+  const double f4q2 = f4 * q2;
+  const double _16f4q2 = 16.0 * f4q2;
+  const double _64f4q2 = 64.0 * f4q2;
+  const double w = 2.0 * M_PI * fc;
+  const double f3qw = f3 * q * w;
+  const double sqrt2_7f3qw = sqrt2_7 * f3qw;
+  const double sqrt2_9f3qw = sqrt2_9 * f3qw;
+  const double w2 = w * w;
+  const double _4f2w2 = 4.0 * f2 * w2;
+  const double _2q2_1_4f2w2 = (2.0 * q2 + 1.0) * _4f2w2;
+  const double w3 = w2 * w;
+  const double fqw3 = f * q * w3;
+  const double sqrt2_3fqw3 = sqrt2_3 * fqw3;
+  const double sqrt2_5fqw3 = sqrt2_5 * fqw3;
+  const double w4 = w2 * w2;
+  const double q2w4 = q2 * w4;
+  const double _4q2w4 = 4.0 * q2w4;
+  const double a =       q2w4 + sqrt2_3fqw3 + _2q2_1_4f2w2 + sqrt2_7f3qw + _16f4q2;
+  const double b =     _4q2w4 + sqrt2_5fqw3                - sqrt2_9f3qw - _64f4q2;
+  const double c = 6.0 * q2w4         - 2.0 * _2q2_1_4f2w2           + 96.0 * f4q2;
+  const double d =     _4q2w4 - sqrt2_5fqw3                + sqrt2_9f3qw - _64f4q2;
+  const double e =       q2w4 - sqrt2_3fqw3 + _2q2_1_4f2w2 - sqrt2_7f3qw + _16f4q2;
+  const double y = (_4f2w2 * (x
+                              - 2.0 * x2
+                              + x4)
+                    - (b * y1
+                       + c * y2
+                       + d * y3
+                       + e * y4)) / a;
+  return y;
+}
+
+int rtbuf_signal_equalizer10 (s_rtbuf *rtb)
+{
+  s_rtbuf_signal_fun in;
+  s_rtbuf_signal_fun amp32;
+  s_rtbuf_signal_fun amp64;
+  s_rtbuf_signal_fun amp128;
+  s_rtbuf_signal_fun amp256;
+  s_rtbuf_signal_fun amp512;
+  s_rtbuf_signal_fun amp1k;
+  s_rtbuf_signal_fun amp2k;
+  s_rtbuf_signal_fun amp4k;
+  s_rtbuf_signal_fun amp8k;
+  s_rtbuf_signal_fun amp16k;
+  s_rtbuf_signal_equalizer10_data *data;
+  unsigned int i = 0;
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_SIGNAL, &in);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP32, &amp32);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP64, &amp64);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP128, &amp128);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP256, &amp256);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP512, &amp512);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP1K, &amp1k);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP2K, &amp2k);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP4K, &amp4k);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP8K, &amp8k);
+  rtbuf_signal_fun(rtb, RTBUF_SIGNAL_EQUALIZER10_IN_AMP16K, &amp16k);
+  data = (s_rtbuf_signal_equalizer10_data*) rtb->data;
+  while (i < RTBUF_SIGNAL_SAMPLES) {
+    const double x = in.sample_fun(in.signal, i);
+    const double a0 = amp32.sample_fun(amp32.signal, i);
+    const double a1 = amp32.sample_fun(amp64.signal, i);
+    const double a2 = amp32.sample_fun(amp128.signal, i);
+    const double a3 = amp32.sample_fun(amp256.signal, i);
+    const double a4 = amp32.sample_fun(amp512.signal, i);
+    const double a5 = amp32.sample_fun(amp1k.signal, i);
+    const double a6 = amp32.sample_fun(amp2k.signal, i);
+    const double a7 = amp32.sample_fun(amp4k.signal, i);
+    const double a8 = amp32.sample_fun(amp8k.signal, i);
+    const double a9 = amp32.sample_fun(amp16k.signal, i);
+    const double y0 = butterworth_bandpass2(x, 32.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y0_1, data->y0_2,
+                                            data->y0_3, data->y0_4);
+    const double y1 = butterworth_bandpass2(x, 64.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y1_1, data->y1_2,
+                                            data->y1_3, data->y1_4);
+    const double y2 = butterworth_bandpass2(x, 128.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y2_1, data->y2_2,
+                                            data->y2_3, data->y2_4);
+    const double y3 = butterworth_bandpass2(x, 256.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y3_1, data->y3_2,
+                                            data->y3_3, data->y3_4);
+    const double y4 = butterworth_bandpass2(x, 512.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y4_1, data->y4_2,
+                                            data->y4_3, data->y4_4);
+    const double y5 = butterworth_bandpass2(x, 1024.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y5_1, data->y5_2,
+                                            data->y5_3, data->y5_4);
+    const double y6 = butterworth_bandpass2(x, 2048.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y6_1, data->y6_2,
+                                            data->y6_3, data->y6_4);
+    const double y7 = butterworth_bandpass2(x, 4096.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y7_1, data->y7_2,
+                                            data->y7_3, data->y7_4);
+    const double y8 = butterworth_bandpass2(x, 8192.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y8_1, data->y8_2,
+                                            data->y8_3, data->y8_4);
+    const double y9 = butterworth_bandpass2(x, 16384.0, 2.0,
+                                            data->x2, data->x4,
+                                            data->y9_1, data->y9_2,
+                                            data->y9_3, data->y9_4);
+    data->signal[i] = (a0 * y0 + a1 * y1 + a2 * y2 + a3 * y3 + a4 * y4 +
+                       a5 * y5 + a6 * y6 + a7 * y7 + a8 * y8 + a9 * y9);
+    data->signal32[i]  = y0;
+    data->signal64[i]  = y1;
+    data->signal128[i] = y2;
+    data->signal256[i] = y3;
+    data->signal512[i] = y4;
+    data->signal1k[i]  = y5;
+    data->signal2k[i]  = y6;
+    data->signal4k[i]  = y7;
+    data->signal8k[i]  = y8;
+    data->signal16k[i] = y9;
+    data->x4 = data->x3;
+    data->x3 = data->x2;
+    data->x2 = data->x1;
+    data->x1 = x;
+    data->y0_4 = data->y0_3;
+    data->y0_3 = data->y0_2;
+    data->y0_2 = data->y0_1;
+    data->y0_1 = y0;
+    data->y1_4 = data->y1_3;
+    data->y1_3 = data->y1_2;
+    data->y1_2 = data->y1_1;
+    data->y1_1 = y1;
+    data->y2_4 = data->y2_3;
+    data->y2_3 = data->y2_2;
+    data->y2_2 = data->y2_1;
+    data->y2_1 = y2;
+    data->y3_4 = data->y3_3;
+    data->y3_3 = data->y3_2;
+    data->y3_2 = data->y3_1;
+    data->y3_1 = y3;
+    data->y4_4 = data->y4_3;
+    data->y4_3 = data->y4_2;
+    data->y4_2 = data->y4_1;
+    data->y4_1 = y4;
+    data->y5_4 = data->y5_3;
+    data->y5_3 = data->y5_2;
+    data->y5_2 = data->y5_1;
+    data->y5_1 = y5;
+    data->y6_4 = data->y6_3;
+    data->y6_3 = data->y6_2;
+    data->y6_2 = data->y6_1;
+    data->y6_1 = y6;
+    data->y7_4 = data->y7_3;
+    data->y7_3 = data->y7_2;
+    data->y7_2 = data->y7_1;
+    data->y7_1 = y7;
+    data->y8_4 = data->y8_3;
+    data->y8_3 = data->y8_2;
+    data->y8_2 = data->y8_1;
+    data->y8_1 = y8;
+    data->y9_4 = data->y9_3;
+    data->y9_3 = data->y9_2;
+    data->y9_2 = data->y9_1;
+    data->y9_1 = y9;
+    i++;
+  }
+  return 0;
+}