[88199ce] | 1 | /* |
---|
[f918cb9] | 2 | Copyright (C) 2007 Amaury Hazan <ahazan@iua.upf.edu> |
---|
| 3 | and Paul Brossier <piem@piem.org> |
---|
[88199ce] | 4 | |
---|
| 5 | This program is free software; you can redistribute it and/or modify |
---|
| 6 | it under the terms of the GNU General Public License as published by |
---|
| 7 | the Free Software Foundation; either version 2 of the License, or |
---|
| 8 | (at your option) any later version. |
---|
| 9 | |
---|
| 10 | This program is distributed in the hope that it will be useful, |
---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | GNU General Public License for more details. |
---|
| 14 | |
---|
| 15 | You should have received a copy of the GNU General Public License |
---|
| 16 | along with this program; if not, write to the Free Software |
---|
| 17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 18 | |
---|
| 19 | */ |
---|
| 20 | |
---|
[f918cb9] | 21 | /* part of this mfcc implementation were inspired from LibXtract |
---|
| 22 | http://libxtract.sourceforge.net/ |
---|
| 23 | */ |
---|
| 24 | |
---|
[7c6c806d] | 25 | #include "aubio_priv.h" |
---|
[71d3bf0] | 26 | #include "filterbank.h" |
---|
[88199ce] | 27 | |
---|
[8708556] | 28 | /** \brief A structure to store a set of n_filters filters of lenghts win_s */ |
---|
| 29 | struct aubio_filterbank_t_ { |
---|
| 30 | uint_t win_s; |
---|
| 31 | uint_t n_filters; |
---|
| 32 | fvec_t *filters; |
---|
[7c6c806d] | 33 | }; |
---|
| 34 | |
---|
[8708556] | 35 | aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s){ |
---|
| 36 | /** allocating space for filterbank object */ |
---|
| 37 | aubio_filterbank_t * fb = AUBIO_NEW(aubio_filterbank_t); |
---|
[f918cb9] | 38 | uint_t filter_cnt; |
---|
[8708556] | 39 | fb->win_s=win_s; |
---|
| 40 | fb->n_filters=n_filters; |
---|
| 41 | |
---|
| 42 | /** allocating filter tables */ |
---|
[f918cb9] | 43 | fb->filters=AUBIO_ARRAY(n_filters,fvec_t); |
---|
[8708556] | 44 | for (filter_cnt=0; filter_cnt<n_filters; filter_cnt++) |
---|
| 45 | /* considering one-channel filters */ |
---|
| 46 | filters[filter_cnt]=new_fvec(win_s, 1); |
---|
| 47 | |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | void del_aubio_filterbank(aubio_filterbank_t * fb){ |
---|
| 51 | |
---|
| 52 | int filter_cnt; |
---|
| 53 | /** deleting filter tables first */ |
---|
| 54 | for (filter_cnt=0; filter_cnt<fb->n_filters; filter_cnt++) |
---|
| 55 | del_fvec(fb->filters[filter_cnt]); |
---|
| 56 | AUBIO_FREE(fb->filters); |
---|
| 57 | AUBIO_FREE(fb); |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | |
---|