aubio  0.4.1
spectral/filterbank.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
00003                       and Amaury Hazan <ahazan@iua.upf.edu>
00004 
00005   This file is part of aubio.
00006 
00007   aubio is free software: you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation, either version 3 of the License, or
00010   (at your option) any later version.
00011 
00012   aubio is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 /** \file
00023 
00024   Filterbank object
00025 
00026   General-purpose spectral filterbank object.
00027 
00028   \example spectral/test-filterbank.c
00029 
00030 */
00031 
00032 #ifndef _AUBIO_FILTERBANK_H
00033 #define _AUBIO_FILTERBANK_H
00034 
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039 
00040 /** filterbank object
00041 
00042   This object stores a matrix of spectral filter coefficients.
00043 
00044  */
00045 typedef struct _aubio_filterbank_t aubio_filterbank_t;
00046 
00047 /** create filterbank object
00048 
00049   \param n_filters number of filters to create
00050   \param win_s size of analysis buffer (and length the FFT transform)
00051 
00052 */
00053 aubio_filterbank_t *new_aubio_filterbank (uint_t n_filters, uint_t win_s);
00054 
00055 /** destroy filterbank object
00056 
00057   \param f filterbank object, as returned by new_aubio_filterbank()
00058 
00059 */
00060 void del_aubio_filterbank (aubio_filterbank_t * f);
00061 
00062 /** compute filterbank
00063 
00064   \param f filterbank object, as returned by new_aubio_filterbank()
00065   \param in input spectrum containing an input spectrum of length `win_s`
00066   \param out output vector containing the energy found in each band, `nfilt` output values
00067 
00068 */
00069 void aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out);
00070 
00071 /** return a pointer to the matrix object containing all filter coefficients
00072 
00073   \param f filterbank object, as returned by new_aubio_filterbank()
00074 
00075  */
00076 fmat_t *aubio_filterbank_get_coeffs (aubio_filterbank_t * f);
00077 
00078 /** copy filter coefficients to the filterbank
00079 
00080   \param f filterbank object, as returned by new_aubio_filterbank()
00081   \param filters filter bank coefficients to copy from
00082 
00083  */
00084 uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fmat_t * filters);
00085 
00086 #ifdef __cplusplus
00087 }
00088 #endif
00089 
00090 #endif /* _AUBIO_FILTERBANK_H */
 All Data Structures Files Functions Variables Typedefs Defines