From: Amaury Hazan Date: Tue, 11 Sep 2007 19:36:36 +0000 (+0200) Subject: cleaned a bit and added TODO doc for filterbank::new_aubio_filterbank_mfcc2 X-Git-Tag: bzr2git~442^2~14^2~2^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=83d5abff88c1b5cb25a2ae20b110676377e8622b;p=aubio.git cleaned a bit and added TODO doc for filterbank::new_aubio_filterbank_mfcc2 --- diff --git a/src/filterbank.c b/src/filterbank.c index 14c0e45b..22a4558c 100644 --- a/src/filterbank.c +++ b/src/filterbank.c @@ -18,9 +18,6 @@ */ -/* part of this mfcc implementation were inspired from LibXtract - http://libxtract.sourceforge.net/ -*/ #include "aubio_priv.h" #include "sample.h" @@ -158,6 +155,15 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc(uint_t n_filters, uint_t win_s, u } +/* +FB initialization based on Slaney's auditory toolbox +TODO: + *solve memory leak problems while + *solve quantization issues when constructing signal: + *bug for win_s=512 + *corrections for win_s=1024 -> why even filters with smaller amplitude + +*/ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, uint_t samplerate, smpl_t freq_min, smpl_t freq_max){ @@ -208,8 +214,9 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, } //debug + debug("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]); + debug("filter n. %d %f %f %f %f\n",filter_cnt, lower_freqs->data[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 @@ -232,25 +239,25 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, smpl_t riseInc= triangle_heights->data[0][filter_cnt]/(center_freqs->data[0][filter_cnt]-lower_freqs->data[0][filter_cnt]); //zeroing begining of filter - //printf("\nfilter %d",filter_cnt); + debug("\nfilter %d",filter_cnt); - //printf("\nzero begin\n"); + debug("\nzero begin\n"); for(bin_cnt=0; bin_cntfilters[filter_cnt]->data[0][bin_cnt]=0.f; - //printf("."); - //printf("%f %f %f\n", fft_freqs->data[0][bin_cnt], fft_freqs->data[0][bin_cnt+1], lower_freqs->data[0][filter_cnt]); + debug("."); + //debug("%f %f %f\n", fft_freqs->data[0][bin_cnt], fft_freqs->data[0][bin_cnt+1], lower_freqs->data[0][filter_cnt]); if(fft_freqs->data[0][bin_cnt]<= lower_freqs->data[0][filter_cnt] && fft_freqs->data[0][bin_cnt+1]> lower_freqs->data[0][filter_cnt]){ break; } } bin_cnt++; - //printf("\npos slope\n"); + debug("\npos slope\n"); //positive slope for(; bin_cntfilters[filter_cnt]->data[0][bin_cnt]=(fft_freqs->data[0][bin_cnt]-lower_freqs->data[0][filter_cnt])*riseInc; //if(fft_freqs->data[0][bin_cnt]<= center_freqs->data[0][filter_cnt] && fft_freqs->data[0][bin_cnt+1]> center_freqs->data[0][filter_cnt]) if(fft_freqs->data[0][bin_cnt+1]> center_freqs->data[0][filter_cnt]) @@ -258,10 +265,11 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, } //bin_cnt++; - //printf("\nneg slope\n"); + //debug("\nneg slope\n"); + //negative slope for(; bin_cntdata[0][filter_cnt]-(fft_freqs->data[0][bin_cnt]-center_freqs->data[0][filter_cnt])*riseInc; @@ -276,10 +284,10 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc2(uint_t n_filters, uint_t win_s, } //bin_cnt++; - //printf("\nzero end\n"); + //debug("\nzero end\n"); //zeroing tail for(; bin_cntfilters[filter_cnt]->data[0][bin_cnt]=0.f; }