Changes in src/mfcc.c [97886fa:7c6c806d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mfcc.c
r97886fa r7c6c806d 21 21 */ 22 22 23 #include "aubio_priv.h" 24 #include "sample.h" 25 #include "fft.h" 26 #include "mfcc.h" 27 #include "math.h" 23 28 24 #include "mffc.h" 29 /* 30 new_aubio_mfcc 31 aubio_mfcc_do 32 del_aubio_mfcc 33 */ 25 34 26 35 // Computation 36 // Added last two arguments to be able to pass from example 27 37 28 int aubio_mfcc_do(const float *data, const int N, const void *argv, float *result){ 38 39 40 int aubio_mfcc_do(const float *data, const int N, const void *argv, float *result, aubio_mfft_t * fft_dct, cvec_t * fftgrain_dct){ 29 41 30 42 aubio_mel_filter *f; … … 38 50 result[filter] += data[n] * f->filters[filter][n]; 39 51 } 40 result[filter] = log(result[filter] < XTRACT_LOG_LIMIT ? XTRACT_LOG_LIMIT : result[filter]);52 result[filter] = LOG(result[filter] < XTRACT_LOG_LIMIT ? XTRACT_LOG_LIMIT : result[filter]); 41 53 } 42 54 43 //TODO: check that zero padding 55 //TODO: check that zero padding 44 56 for(n = filter + 1; n < N; n++) result[n] = 0; 45 57 46 aubio_dct_do(result, f->n_filters, NULL, result );58 aubio_dct_do(result, f->n_filters, NULL, result, fft_dct, fftgrain_dct); 47 59 48 60 return XTRACT_SUCCESS; 49 61 } 50 62 51 int aubio_dct_do(const float *data, const int N, const void *argv, float *result){ 63 // Added last two arguments to be able to pass from example 64 65 int aubio_dct_do(const float *data, const int N, const void *argv, float *result, aubio_mfft_t * fft_dct, cvec_t * fftgrain_dct){ 52 66 53 67 … … 56 70 //TODO: fvec as input? Remove data length, N? 57 71 72 fvec_t * momo = new_fvec(20, 1); 73 momo->data = data; 74 58 75 //compute mag spectrum 59 aubio_ pvoc_do (pv,data, fftgrain);76 aubio_mfft_do (fft_dct, data, fftgrain_dct); 60 77 61 78 int i; 62 79 //extract real part of fft grain 63 80 for(i=0; i<N ;i++){ 64 result[i]= fftgrain ->norm[i]*cos(fftgrain->phase[i]);81 result[i]= fftgrain_dct->norm[0][i]*COS(fftgrain_dct->phas[0][i]); 65 82 } 66 67 /* 68 fftwf_plan plan; 69 70 plan = 71 fftwf_plan_r2r_1d(N, (float *) data, result, FFTW_REDFT00, FFTW_ESTIMATE); 72 73 fftwf_execute(plan); 74 fftwf_destroy_plan(plan);*/ 83 75 84 76 85 return XTRACT_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.