/usr/include/aubio/temporal/filter.h is in libaubio-dev 0.4.1-2build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /*
Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
This file is part of aubio.
aubio is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
aubio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with aubio. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _AUBIO_FILTER_H
#define _AUBIO_FILTER_H
/** \file
Digital filter
This object stores a digital filter of order \f$n\f$.
It contains the following data:
- \f$ n*1 b_i \f$ feedforward coefficients
- \f$ n*1 a_i \f$ feedback coefficients
- \f$ n*c x_i \f$ input signal
- \f$ n*c y_i \f$ output signal
For convenience, the samplerate of the input signal is also stored in the
object.
Feedforward and feedback parameters can be modified using
aubio_filter_get_feedback() and aubio_filter_get_feedforward().
The function aubio_filter_do_outplace() computes the following output signal
\f$ y[n] \f$ from the input signal \f$ x[n] \f$:
\f{eqnarray*}{
y[n] = b_0 x[n] & + & b_1 x[n-1] + b_2 x[n-2] + ... + b_P x[n-P] \\
& - & a_1 y[n-1] - a_2 y[n-2] - ... - a_P y[n-P] \\
\f}
The function aubio_filter_do() executes the same computation but modifies
directly the input signal (in-place).
The function aubio_filter_do_filtfilt() version runs the filter twice, first
forward then backward, to compensate with the phase shifting of the forward
operation.
Some convenience functions are provided:
- new_aubio_filter_a_weighting() and aubio_filter_set_a_weighting(),
- new_aubio_filter_c_weighting() and aubio_filter_set_c_weighting().
- new_aubio_filter_biquad() and aubio_filter_set_biquad().
\example temporal/test-filter.c
*/
#ifdef __cplusplus
extern "C" {
#endif
/** Digital filter
*/
typedef struct _aubio_filter_t aubio_filter_t;
/** filter input vector (in-place)
\param f filter object as returned by new_aubio_filter()
\param in input vector to filter
*/
void aubio_filter_do (aubio_filter_t * f, fvec_t * in);
/** filter input vector (out-of-place)
\param f filter object as returned by new_aubio_filter()
\param in input vector to filter
\param out output vector to store filtered input
*/
void aubio_filter_do_outplace (aubio_filter_t * f, fvec_t * in, fvec_t * out);
/** filter input vector forward and backward
\param f ::aubio_filter_t object as returned by new_aubio_filter()
\param in ::fvec_t input vector to filter
\param tmp memory space to use for computation
*/
void aubio_filter_do_filtfilt (aubio_filter_t * f, fvec_t * in, fvec_t * tmp);
/** returns a pointer to feedback coefficients \f$ a_i \f$
\param f filter object to get parameters from
\return a pointer to the \f$ a_0 ... a_i ... a_P \f$ coefficients
*/
lvec_t *aubio_filter_get_feedback (aubio_filter_t * f);
/** returns a pointer to feedforward coefficients \f$ b_i \f$
\param f filter object to get coefficients from
\return a pointer to the \f$ b_0 ... b_i ... b_P \f$ coefficients
*/
lvec_t *aubio_filter_get_feedforward (aubio_filter_t * f);
/** get order of the filter
\param f filter to get order from
\return the order of the filter
*/
uint_t aubio_filter_get_order (aubio_filter_t * f);
/** get sampling rate of the filter
\param f filter to get sampling rate from
\return the sampling rate of the filter, in Hz
*/
uint_t aubio_filter_get_samplerate (aubio_filter_t * f);
/** get sampling rate of the filter
\param f filter to get sampling rate from
\param samplerate sample rate to set the filter to
\return the sampling rate of the filter, in Hz
*/
uint_t aubio_filter_set_samplerate (aubio_filter_t * f, uint_t samplerate);
/** reset filter memory
\param f filter object as returned by new_aubio_filter()
*/
void aubio_filter_do_reset (aubio_filter_t * f);
/** create new filter object
This function creates a new ::aubio_filter_t object, given the order of the
filter.
\param order order of the filter (number of coefficients)
\return the newly created filter object
*/
aubio_filter_t *new_aubio_filter (uint_t order);
/** delete a filter object
\param f filter object to delete
*/
void del_aubio_filter (aubio_filter_t * f);
#ifdef __cplusplus
}
#endif
#endif /* _AUBIO_FILTER_H */
|