From: Paul Brossier Date: Sat, 8 Sep 2007 13:35:50 +0000 (+0200) Subject: utils.c, utils.h: remove mfcc, move to aubiomfcc.c X-Git-Tag: bzr2git~442^2~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3e7c4083432c742554ab899f0891c5acc0eaf66b;p=aubio.git utils.c, utils.h: remove mfcc, move to aubiomfcc.c --- diff --git a/examples/aubiomfcc.c b/examples/aubiomfcc.c index df4dd2a4..0db1c34c 100644 --- a/examples/aubiomfcc.c +++ b/examples/aubiomfcc.c @@ -18,6 +18,10 @@ #include "utils.h" +/* mfcc objects */ +fvec_t * mfcc_outbuf; +aubio_mfcc_t * mfcc; + unsigned int pos = 0; /*frames%dspblocksize*/ uint_t usepitch = 0; @@ -42,21 +46,8 @@ int aubio_process(float **input, float **output, int nframes) { //compute mag spectrum aubio_pvoc_do (pv,ibuf, fftgrain); - uint_t n_coefs= n_filters/2 +1; - uint_t coef_cnt; - - - for (coef_cnt=0; coef_cntnorm, nframes, mf, mfcc_outbuf, fft_dct, fftgrain_dct); - - for (coef_cnt=0; coef_cntn_filters = 20; - mf->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *)); - for(n = 0; n < mf->n_filters; n++) - mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t)); + mfcc_outbuf = new_fvec(n_filters,channels); //populating the filter - aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters); + mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq, + channels); //process examples_common_process(aubio_process,process_print); @@ -105,8 +90,9 @@ int main(int argc, char **argv) { debug("End of program.\n"); fflush(stderr); - //destroying filterbank - free(mf); + //destroying mfcc + del_aubio_mfcc(mfcc); + del_fvec(mfcc_outbuf); return 0; } diff --git a/examples/utils.c b/examples/utils.c index b0b02e75..0445917c 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -63,16 +63,15 @@ aubio_pickpeak_t * parms; /* mfcc objects */ //parameters uint_t n_filters=20; -uint_t nyquist= samplerate / 2.; smpl_t lowfreq=80.f; smpl_t highfreq=18000.f; // filterbank object -aubio_mel_filter * mf; +aubio_filterbank_t * mf; // DCT mfft and result storage -aubio_mfft * fft_dct; +aubio_mfft_t * fft_dct; cvec_t * fftgrain_dct; -smpl_t mfcc_outbuf[11]; +smpl_t * mfcc_outbuf[11]; /* pitch objects */ diff --git a/examples/utils.h b/examples/utils.h index affedfd9..615dae96 100644 --- a/examples/utils.h +++ b/examples/utils.h @@ -97,19 +97,6 @@ extern fvec_t *onset2; extern int isonset; extern aubio_pickpeak_t * parms; -/* mfcc objects */ -// params -extern uint_t n_filters; -extern uint_t nyquist; -extern smpl_t lowfreq; -extern smpl_t highfreq; -// filterbank object -extern aubio_mel_filter * mf; -// DCT pvoc and result storage -extern aubio_mfft_t * fft_dct; -extern cvec_t * fftgrain_dct; -extern smpl_t mfcc_outbuf[20]; - /* pitch objects */ extern smpl_t pitch; extern aubio_pitchdetection_t * pitchdet;