andrew@0
|
1 /*
|
andrew@0
|
2 Copyright (C) 2003 Paul Brossier
|
andrew@0
|
3
|
andrew@0
|
4 This program is free software; you can redistribute it and/or modify
|
andrew@0
|
5 it under the terms of the GNU General Public License as published by
|
andrew@0
|
6 the Free Software Foundation; either version 2 of the License, or
|
andrew@0
|
7 (at your option) any later version.
|
andrew@0
|
8
|
andrew@0
|
9 This program is distributed in the hope that it will be useful,
|
andrew@0
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
andrew@0
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
andrew@0
|
12 GNU General Public License for more details.
|
andrew@0
|
13
|
andrew@0
|
14 You should have received a copy of the GNU General Public License
|
andrew@0
|
15 along with this program; if not, write to the Free Software
|
andrew@0
|
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
andrew@0
|
17
|
andrew@0
|
18 */
|
andrew@0
|
19
|
andrew@0
|
20 #ifndef BIQUAD_H
|
andrew@0
|
21 #define BIQUAD_H
|
andrew@0
|
22
|
andrew@0
|
23 /** \file
|
andrew@0
|
24
|
andrew@0
|
25 Second order Infinite Impulse Response filter
|
andrew@0
|
26
|
andrew@0
|
27 This file implements a normalised biquad filter (second order IIR):
|
andrew@0
|
28
|
andrew@0
|
29 \f$ y[n] = b_1 x[n] + b_2 x[n-1] + b_3 x[n-2] - a_2 y[n-1] - a_3 y[n-2] \f$
|
andrew@0
|
30
|
andrew@0
|
31 The filtfilt version runs the filter twice, forward and backward, to
|
andrew@0
|
32 compensate the phase shifting of the forward operation.
|
andrew@0
|
33
|
andrew@0
|
34 */
|
andrew@0
|
35
|
andrew@0
|
36 #ifdef __cplusplus
|
andrew@0
|
37 extern "C" {
|
andrew@0
|
38 #endif
|
andrew@0
|
39
|
andrew@0
|
40 /** biquad filter object */
|
andrew@0
|
41 typedef struct _aubio_biquad_t aubio_biquad_t;
|
andrew@0
|
42
|
andrew@0
|
43 /** filter input vector
|
andrew@0
|
44
|
andrew@0
|
45 \param b biquad object as returned by new_aubio_biquad
|
andrew@0
|
46 \param in input vector to filter
|
andrew@0
|
47
|
andrew@0
|
48 */
|
andrew@0
|
49 void aubio_biquad_do(aubio_biquad_t * b, fvec_t * in);
|
andrew@0
|
50 /** filter input vector forward and backward
|
andrew@0
|
51
|
andrew@0
|
52 \param b biquad object as returned by new_aubio_biquad
|
andrew@0
|
53 \param in input vector to filter
|
andrew@0
|
54 \param tmp memory space to use for computation
|
andrew@0
|
55
|
andrew@0
|
56 */
|
andrew@0
|
57 void aubio_biquad_do_filtfilt(aubio_biquad_t * b, fvec_t * in, fvec_t * tmp);
|
andrew@0
|
58 /** create new biquad filter
|
andrew@0
|
59
|
andrew@0
|
60 \param b1 forward filter coefficient
|
andrew@0
|
61 \param b2 forward filter coefficient
|
andrew@0
|
62 \param b3 forward filter coefficient
|
andrew@0
|
63 \param a2 feedback filter coefficient
|
andrew@0
|
64 \param a3 feedback filter coefficient
|
andrew@0
|
65
|
andrew@0
|
66 */
|
andrew@0
|
67 aubio_biquad_t * new_aubio_biquad(lsmp_t b1, lsmp_t b2, lsmp_t b3, lsmp_t a2, lsmp_t a3);
|
andrew@0
|
68
|
andrew@0
|
69 /** delete biquad filter
|
andrew@0
|
70
|
andrew@0
|
71 \param b biquad object to delete
|
andrew@0
|
72
|
andrew@0
|
73 */
|
andrew@0
|
74 void del_aubio_biquad(aubio_biquad_t * b);
|
andrew@0
|
75
|
andrew@0
|
76 #ifdef __cplusplus
|
andrew@0
|
77 }
|
andrew@0
|
78 #endif
|
andrew@0
|
79
|
andrew@0
|
80 #endif /*BIQUAD_H*/
|