shithub: aubio

Download patch

ref: 97886fac26f2f105871453d8dd8ae2c489c710dc
parent: 71d3bf0fb3571cbb616a0b1138e73a39fc41ffd1
author: Amaury Hazan <mahmoudax@gmail.com>
date: Thu Sep 6 11:45:23 EDT 2007

minor changes 

--- a/examples/aubiomfcc.c
+++ b/examples/aubiomfcc.c
@@ -49,7 +49,7 @@
         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_cnt<n_filters ; coef_cnt++)
         outmsg("%f ",outbuf[coef_cnt]);
@@ -92,8 +92,8 @@
   uint_t banksize = (uint) ( sizeof(aubio_mel_filter));
   aubio_mel_filter * mf = (aubio_mel_filter *)getbytes(banksize);
 
-  mfilterbank->n_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));
   
--- a/src/mfcc.c
+++ b/src/mfcc.c
@@ -40,6 +40,7 @@
         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,6 +50,21 @@
 
 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; i<N ;i++){
+      result[i]= fftgrain->norm[i]*cos(fftgrain->phase[i]);
+    }
+    
+    /*
     fftwf_plan plan;
     
     plan = 
@@ -55,7 +71,7 @@
         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;
 }