From bc4ba753e5c7e50f6149add3c46e47f54ba23f05 Mon Sep 17 00:00:00 2001 From: Amaury Hazan Date: Wed, 12 Sep 2007 19:36:11 +0200 Subject: [PATCH] added mfcc binding --- examples/utils.c | 2 ++ src/filterbank.c | 16 ++++------------ swig/aubio.i | 8 ++++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/examples/utils.c b/examples/utils.c index fff16abd..9fd6eafb 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -43,6 +43,8 @@ smpl_t silence = -90.; // uint_t overlap_size = 256; uint_t buffer_size = 1024; uint_t overlap_size = 512; +// uint_t buffer_size = 2048; +// uint_t overlap_size = 1024; uint_t channels = 1; uint_t samplerate = 44100; diff --git a/src/filterbank.c b/src/filterbank.c index fdc549ed..d79bb154 100644 --- a/src/filterbank.c +++ b/src/filterbank.c @@ -224,32 +224,24 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, AUBIO_DBG("filter tables frequencies\n"); for(filter_cnt=0; filter_cntdata[0][filter_cnt], center_freqs->data[0][filter_cnt], upper_freqs->data[0][filter_cnt], triangle_heights->data[0][filter_cnt]); - - + //filling the fft_freqs lookup table, which assigns the frequency in hz to each bin - for(bin_cnt=0; bin_cntdata[0][bin_cnt]= (smpl_t)samplerate* (smpl_t)bin_cnt/ (smpl_t)win_s; - } - - + //building each filter table for(filter_cnt=0; filter_cntdata[0][filter_cnt]/(center_freqs->data[0][filter_cnt]-lower_freqs->data[0][filter_cnt]); - //zeroing begining of filter - AUBIO_DBG("\nfilter %d",filter_cnt); + AUBIO_DBG("\nfilter %d",filter_cnt); + //zeroing begining of filter AUBIO_DBG("\nzero begin\n"); - for(bin_cnt=0; bin_cntfilters[filter_cnt]->data[0][bin_cnt]=0.f; diff --git a/swig/aubio.i b/swig/aubio.i index 7810f619..df1b1b25 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -148,6 +148,14 @@ void aubio_autocorr(fvec_t * in, fvec_t * acf); smpl_t aubio_zero_crossing_rate(fvec_t * input); smpl_t aubio_spectral_centroid(cvec_t * spectrum, smpl_t samplerate); +/* filterbank */ + +/* mfcc */ +aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels); +void del_aubio_mfcc(aubio_mfcc_t *mf); +void aubio_mfcc_do(aubio_mfcc_t *mf, cvec_t *in, fvec_t *out); + + /* scale */ extern aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, smpl_t ilow, smpl_t ihig ); extern void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); -- 2.26.2