2 Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
3 and Amaury Hazan <ahazan@iua.upf.edu>
5 This file is part of aubio.
7 aubio is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 aubio is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with aubio. If not, see <http://www.gnu.org/licenses/>.
26 General-purpose spectral filterbank object.
28 \example spectral/test-filterbank.c
32 #ifndef AUBIO_FILTERBANK_H
33 #define AUBIO_FILTERBANK_H
42 This object stores a matrix of spectral filter coefficients.
45 typedef struct _aubio_filterbank_t aubio_filterbank_t;
47 /** create filterbank object
49 \param n_filters number of filters to create
50 \param win_s size of analysis buffer (and length the FFT transform)
53 aubio_filterbank_t *new_aubio_filterbank (uint_t n_filters, uint_t win_s);
55 /** destroy filterbank object
57 \param f filterbank object, as returned by new_aubio_filterbank()
60 void del_aubio_filterbank (aubio_filterbank_t * f);
62 /** compute filterbank
64 \param f filterbank object, as returned by new_aubio_filterbank()
65 \param in input spectrum containing an input spectrum of length `win_s`
66 \param out output vector containing the energy found in each band, `nfilt` output values
69 void aubio_filterbank_do (aubio_filterbank_t * f, const cvec_t * in, fvec_t * out);
71 /** return a pointer to the matrix object containing all filter coefficients
73 \param f filterbank object, as returned by new_aubio_filterbank()
76 fmat_t *aubio_filterbank_get_coeffs (const aubio_filterbank_t * f);
78 /** copy filter coefficients to the filterbank
80 \param f filterbank object, as returned by new_aubio_filterbank()
81 \param filters filter bank coefficients to copy from
84 uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, const fmat_t * filters);
86 uint_t aubio_filterbank_set_norm (aubio_filterbank_t *f, smpl_t norm);
88 smpl_t aubio_filterbank_get_norm (aubio_filterbank_t *f);
90 uint_t aubio_filterbank_set_power (aubio_filterbank_t *f, smpl_t power);
92 smpl_t aubio_filterbank_get_power (aubio_filterbank_t *f);
98 #endif /* AUBIO_FILTERBANK_H */