GNOME Bugzilla – Bug 632664
[0.11] audioiirfilter: nonstandard definition of 'a' and 'b' coefficients for IIR filters
Last modified: 2012-01-11 14:24:41 UTC
Created attachment 172821 [details] [review] Proposed patch audiofxbaseiirfilter and the derived elements audioiirfilter, audiochebband, and audiocheblimit, use the following convention for the definition of an IIR filter: y[n] = a_n x[n] + a_1 x[n-1] + ... + a_M x[n-M] + b_1 y[n-1] + b_2 y[n-2] + ... + b[n-N]. The most common convention in signal processing literature, and also the convention used by MATLAB, is: a_0 y[n] + a_1 y[n-1] + ... + a_M y[n-M] = b_0 x[n] + b_1 x[n-1] + ... + b_N x[n-N]. or, setting a_0 to 1 and moving all the terms but y[n] to the right hand side: y[n] = b_0 x[n] + b_1 x[n-1] + ... + b_N x[n-N] - a_1 y[n-1] - a_2 y[n-2] - ... - a_M y[n-M]. So, in the more common convention, the b's are the coefficients in the nominator of the transfer function, and the a's are the coefficients in the denominator of the transfer function (with no minus sign). This patch modifies audiofxbaseiirfilter to use the latter, more common convention, and modifies all of its derived classes accordingly. This should make the properties of the audioiirfilter recognizable to more people, especially those who learned digital signal processing with MATLAB.
Yes, unfortunately you're right but it's too late to change this now for 0.10
Probably makes sense to rename the properties. Otherwise people won't notice the change when porting to 0.11/1.0 and applications will break.
(In reply to comment #2) > Probably makes sense to rename the properties. Otherwise people won't notice > the change when porting to 0.11/1.0 and applications will break. How about "den" and "num" or "denominator" and "numerator"?
commit 56353e24d2f404269c7662eb4549b4c58b449d49 Author: Leo Singer <leo.singer@ligo.org> Date: Wed Oct 20 02:17:43 2010 -0700 audiofx: Use most common convention for definitions of IIR filter coefficients. Most signal processing texts, including MATLAB, use the following convention for IIR filter coefficients: a_0 y[n] + a_1 y[n-1] + ... + a_M y[n-M] = b_0 x[n] + b_1 x[n-1] + ... + b[N] x[n-N] Usually, a_0 is set to 1 because the coefficients can always be rescaled, giving y[n] = b_0 x[n] + b_1 x[n-1] + ... + b[N] x[n-N] - a_1 y[n-1] - ... - a_M y[n-M] The convention that was previously used by audiofxbaseiirfilter and derived class had the a and b coefficients swapp This change makes the audiofx plugin use the more common convention described above.