From 97886fac26f2f105871453d8dd8ae2c489c710dc Mon Sep 17 00:00:00 2001 From: Amaury Hazan Date: Thu, 6 Sep 2007 15:45:23 +0200 Subject: [PATCH] minor changes --- examples/aubiomfcc.c | 6 +++--- src/mfcc.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/aubiomfcc.c b/examples/aubiomfcc.c index 7366b3cc..44381ad3 100644 --- a/examples/aubiomfcc.c +++ b/examples/aubiomfcc.c @@ -49,7 +49,7 @@ int aubio_process(float **input, float **output, int nframes) { outbuf[coef_cnt]=0.f; //compute mfccs - aubio_mffc_do(fftgrain->norm, nframes, filterbank, outbuf); + aubio_mffc_do(fftgrain->norm, nframes, mf, outbuf); for (coef_cnt=0; coef_cntn_filters = 20; - mfilterbank->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *)); + mf->n_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)); diff --git a/src/mfcc.c b/src/mfcc.c index 305125b0..1d94a0d0 100644 --- a/src/mfcc.c +++ b/src/mfcc.c @@ -40,6 +40,7 @@ int aubio_mfcc_do(const float *data, const int N, const void *argv, float *resul result[filter] = log(result[filter] < XTRACT_LOG_LIMIT ? XTRACT_LOG_LIMIT : result[filter]); } + //TODO: check that zero padding for(n = filter + 1; n < N; n++) result[n] = 0; aubio_dct_do(result, f->n_filters, NULL, result); @@ -49,13 +50,28 @@ int aubio_mfcc_do(const float *data, const int N, const void *argv, float *resul int aubio_dct_do(const float *data, const int N, const void *argv, float *result){ + + //call aubio p_voc in dct setting + + //TODO: fvec as input? Remove data length, N? + + //compute mag spectrum + aubio_pvoc_do (pv,data, fftgrain); + + int i; + //extract real part of fft grain + for(i=0; inorm[i]*cos(fftgrain->phase[i]); + } + + /* fftwf_plan plan; plan = fftwf_plan_r2r_1d(N, (float *) data, result, FFTW_REDFT00, FFTW_ESTIMATE); fftwf_execute(plan); - fftwf_destroy_plan(plan); + fftwf_destroy_plan(plan);*/ return XTRACT_SUCCESS; } -- 2.26.2