1 | /* |
---|
2 | Copyright (C) 2003 Paul Brossier |
---|
3 | |
---|
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. |
---|
8 | |
---|
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. |
---|
13 | |
---|
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. |
---|
17 | |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef FILTER_H |
---|
21 | #define FILTER_H |
---|
22 | |
---|
23 | /** \file |
---|
24 | |
---|
25 | Infinite Impulse Response filter |
---|
26 | |
---|
27 | This file implements IIR filters of any order: |
---|
28 | |
---|
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$ |
---|
31 | |
---|
32 | The filtfilt version runs the filter twice, forward and backward, to |
---|
33 | compensate the phase shifting of the forward operation. |
---|
34 | |
---|
35 | */ |
---|
36 | |
---|
37 | #ifdef __cplusplus |
---|
38 | extern "C" { |
---|
39 | #endif |
---|
40 | |
---|
41 | /** IIR filter object */ |
---|
42 | typedef struct _aubio_filter_t aubio_filter_t; |
---|
43 | |
---|
44 | /** filter input vector (in-place) |
---|
45 | |
---|
46 | \param b biquad object as returned by new_aubio_biquad |
---|
47 | \param in input vector to filter |
---|
48 | |
---|
49 | */ |
---|
50 | void aubio_filter_do(aubio_filter_t * b, fvec_t * in); |
---|
51 | /** filter input vector (out-of-place) |
---|
52 | |
---|
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 |
---|
56 | |
---|
57 | */ |
---|
58 | void aubio_filter_do_outplace(aubio_filter_t * b, fvec_t * in, fvec_t * out); |
---|
59 | /** filter input vector forward and backward |
---|
60 | |
---|
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 |
---|
64 | |
---|
65 | */ |
---|
66 | void aubio_filter_do_filtfilt(aubio_filter_t * b, fvec_t * in, fvec_t * tmp); |
---|
67 | /** create new IIR filter |
---|
68 | |
---|
69 | \param b vector of forward coefficients |
---|
70 | \param a vector of feedback coefficients |
---|
71 | \param order order of the filter (number of coefficients) |
---|
72 | |
---|
73 | */ |
---|
74 | aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order); |
---|
75 | /** create a new A-design filter |
---|
76 | |
---|
77 | \param samplerate sampling-rate of the signal to filter |
---|
78 | |
---|
79 | */ |
---|
80 | aubio_filter_t * new_aubio_adsgn_filter(uint_t samplerate); |
---|
81 | /** create a new C-design filter |
---|
82 | |
---|
83 | \param samplerate sampling-rate of the signal to filter |
---|
84 | |
---|
85 | */ |
---|
86 | aubio_filter_t * new_aubio_cdsgn_filter(uint_t samplerate); |
---|
87 | /** delete a filter object |
---|
88 | |
---|
89 | \param f filter object to delete |
---|
90 | |
---|
91 | */ |
---|
92 | void del_aubio_filter(aubio_filter_t * f); |
---|
93 | |
---|
94 | #ifdef __cplusplus |
---|
95 | } |
---|
96 | #endif |
---|
97 | |
---|
98 | #endif /*FILTER_H*/ |
---|