diff --git a/src/libiir/400_parser.c b/src/libiir/400_parser.c index 107f51e..604aed6 100644 --- a/src/libiir/400_parser.c +++ b/src/libiir/400_parser.c @@ -103,8 +103,13 @@ iir_parser_raw(struct iir_filter_t** fi, const char* desc) * The maximum order in any single Butterworth-type filter. If the given order * exceeds this, we split the resulting filter up into multiple sets of * coefficients of this order or less. + * + * This is required since IIR filters, even with double-precision floating + * point numbers, are particularly susceptible to quantization errors. In + * practice, anything with a steeper roll-off than 2nd order can go unstable + * when presented with real input data. */ -#define IIR_PARSER_BW_MAX_ORDER (4) +#define IIR_PARSER_BW_MAX_ORDER (2) @@ -176,7 +181,7 @@ iir_parser_bw_aux2(struct iir_filter_t** fi, } iir_coeff_free(coeff); if(!order) return 0; - /* add a <4th order segment */ + /* add a <2nd order segment */ } coeff = bw(order, gain, corner); @@ -214,7 +219,7 @@ iir_parser_bw_aux3(struct iir_filter_t** fi, } iir_coeff_free(coeff); if(!order) return 0; - /* add a <4th order segment */ + /* add a <2nd order segment */ } coeff = bw(order, gain, c1, c2);