aubio
0.4.1
|
00001 /* 00002 Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> 00003 00004 This file is part of aubio. 00005 00006 aubio is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 aubio is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with aubio. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #ifndef _AUBIO_FILTER_BIQUAD_H 00022 #define _AUBIO_FILTER_BIQUAD_H 00023 00024 /** \file 00025 00026 Second order Infinite Impulse Response filter 00027 00028 This file implements a normalised biquad filter (second order IIR): 00029 00030 \f$ y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2] \f$ 00031 00032 The filtfilt version runs the filter twice, forward and backward, to 00033 compensate the phase shifting of the forward operation. 00034 00035 See also <a href="http://en.wikipedia.org/wiki/Digital_biquad_filter">Digital 00036 biquad filter</a> on wikipedia. 00037 00038 \example temporal/test-biquad.c 00039 00040 */ 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /** set coefficients of a biquad filter 00047 00048 \param f filter object as returned by new_aubio_filter() 00049 \param b0 forward filter coefficient 00050 \param b1 forward filter coefficient 00051 \param b2 forward filter coefficient 00052 \param a1 feedback filter coefficient 00053 \param a2 feedback filter coefficient 00054 00055 */ 00056 uint_t aubio_filter_set_biquad (aubio_filter_t * f, lsmp_t b0, lsmp_t b1, 00057 lsmp_t b2, lsmp_t a1, lsmp_t a2); 00058 00059 /** create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2` coeffs 00060 00061 \param b0 forward filter coefficient 00062 \param b1 forward filter coefficient 00063 \param b2 forward filter coefficient 00064 \param a1 feedback filter coefficient 00065 \param a2 feedback filter coefficient 00066 00067 */ 00068 aubio_filter_t *new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, 00069 lsmp_t a1, lsmp_t a2); 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif /* _AUBIO_FILTER_BIQUAD_H */