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 samplerate signal sampling rate |
---|
70 | \param order order of the filter (number of coefficients) |
---|
71 | \param channels number of channels to allocate |
---|
72 | |
---|
73 | */ |
---|
74 | aubio_filter_t * new_aubio_filter(uint_t samplerate, uint_t order, uint_t channels); |
---|
75 | /** delete a filter object |
---|
76 | |
---|
77 | \param f filter object to delete |
---|
78 | |
---|
79 | */ |
---|
80 | void del_aubio_filter(aubio_filter_t * f); |
---|
81 | |
---|
82 | #ifdef __cplusplus |
---|
83 | } |
---|
84 | #endif |
---|
85 | |
---|
86 | #endif /*FILTER_H*/ |
---|