2 Copyright (C) 2003 Paul Brossier
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 Infinite Impulse Response filter
27 This file implements IIR filters of any order:
29 \f$ y[n] = b_1 x[n] + ... + b_{order} x[n-order] -
30 a_2 y[n-1] - ... - a_{order} y[n-order]\f$
32 The filtfilt version runs the filter twice, forward and backward, to
33 compensate the phase shifting of the forward operation.
41 /** IIR filter object */
42 typedef struct _aubio_filter_t aubio_filter_t;
44 /** filter input vector (in-place)
46 \param b biquad object as returned by new_aubio_biquad
47 \param in input vector to filter
50 void aubio_filter_do(aubio_filter_t * b, fvec_t * in);
51 /** filter input vector (out-of-place)
53 \param b biquad object as returned by new_aubio_biquad
54 \param in input vector to filter
55 \param out output vector to store filtered input
58 void aubio_filter_do_outplace(aubio_filter_t * b, fvec_t * in, fvec_t * out);
59 /** filter input vector forward and backward
61 \param b biquad object as returned by new_aubio_biquad
62 \param in input vector to filter
63 \param tmp memory space to use for computation
66 void aubio_filter_do_filtfilt(aubio_filter_t * b, fvec_t * in, fvec_t * tmp);
67 /** create new IIR filter
69 \param b vector of forward coefficients
70 \param a vector of feedback coefficients
71 \param order order of the filter (number of coefficients)
74 aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order);
75 /** create a new A-design filter
77 \param samplerate sampling-rate of the signal to filter
80 aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate);
81 /** create a new C-design filter
83 \param samplerate sampling-rate of the signal to filter
86 aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate);
87 /** delete a filter object
89 \param f filter object to delete
92 void del_aubio_filter(aubio_filter_t * f);