aboutsummaryrefslogtreecommitdiff
path: root/dfx-library/FIRfilter.h
diff options
context:
space:
mode:
Diffstat (limited to 'dfx-library/FIRfilter.h')
-rwxr-xr-xdfx-library/FIRfilter.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/dfx-library/FIRfilter.h b/dfx-library/FIRfilter.h
new file mode 100755
index 0000000..d0f763b
--- /dev/null
+++ b/dfx-library/FIRfilter.h
@@ -0,0 +1,37 @@
+#ifndef __FIRfilter
+#define __FIRfilter
+
+#include <math.h>
+
+
+#define PI 3.1415926535897932384626433832795f
+#define SHELF_START_FIR 0.333f
+
+
+//-----------------------------------------------------------------------------
+void calculateFIRidealLowpassCoefficients(float cutoff, float samplerate,
+ int numTaps, float *coefficients);
+void applyKaiserWindow(int numTaps, float *coefficients, float attenuation);
+float besselIzero(float in);
+float besselIzero2(float in);
+
+//-----------------------------------------------------------------------------
+inline float processFIRfilter(float *in, int numTaps, float *coefficients,
+ long inPos, long arraySize)
+{
+ float out = 0.0f;
+ if ( (inPos+numTaps) > arraySize )
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[(inPos+i)%arraySize] * coefficients[i];
+ }
+ else
+ {
+ for (long i=0; i < numTaps; i++)
+ out += in[inPos+i] * coefficients[i];
+ }
+ return out;
+}
+
+
+#endif \ No newline at end of file