Changes in / [dcc649c:71b1b4b]
- Files:
-
- 2 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiomfcc.c
rdcc649c r71b1b4b 46 46 //compute mag spectrum 47 47 aubio_pvoc_do (pv,ibuf, fftgrain); 48 49 uint_t coef_cnt; 50 uint_t n_filters=20; 51 smpl_t outbuf[20]; 52 53 for (coef_cnt=0; coef_cnt<n_filters ; coef_cnt++) 54 outbuf[coef_cnt]=0.f; 55 56 //compute mfccs 57 aubio_mffc_do(fftgrain->norm, nframes, mf, outbuf); 48 58 49 //TODO: extract Magnitude buffer f_fvec from fftgrain cvec 50 51 //compute mfccs 52 aubio_mffc_do (magbuf, nframes, filterbank, outbuf); 59 for (coef_cnt=0; coef_cnt<n_filters ; coef_cnt++) 60 outmsg("%f ",outbuf[coef_cnt]); 61 outmsg("\n"); 53 62 54 63 … … 79 88 int main(int argc, char **argv) { 80 89 examples_common_init(argc,argv); 90 91 //allocate and initialize mel filter bank 92 uint_t n_filters=20; 93 uint_t nyquist= samplerate / 2.; 94 smpl_t lowfreq=80.f; 95 smpl_t highfreq=18000.f; 96 97 uint_t banksize = (uint) ( sizeof(aubio_mel_filter)); 98 aubio_mel_filter * mf = (aubio_mel_filter *)getbytes(banksize); 99 100 mf->n_filters = 20; 101 mf->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *)); 102 for(n = 0; n < mf->n_filters; n++) 103 mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t)); 104 105 //populating the filter 106 aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters); 107 108 //process 81 109 examples_common_process(aubio_process,process_print); 82 110 examples_common_del(); 83 111 debug("End of program.\n"); 84 112 fflush(stderr); 113 114 //destroying filterbank 115 free(mf); 116 85 117 return 0; 86 118 } -
src/Makefile.am
rdcc649c r71b1b4b 22 22 onset.h \ 23 23 tempo.h \ 24 filter.h 24 filter.h 25 25 26 nodist_pkginclude_HEADERS = config.h 26 27 … … 69 70 tempo.h \ 70 71 filter.c \ 71 filter.h 72 filter.h \ 72 73 73 74 AM_CFLAGS = @AUBIO_CFLAGS@ @FFTWLIB_CFLAGS@ @SAMPLERATE_CFLAGS@ -
src/aubio.h
rdcc649c r71b1b4b 80 80 #include "onset.h" 81 81 #include "tempo.h" 82 #include "mfcc.h" 82 83 83 84 #ifdef __cplusplus -
src/mfcc.c
rdcc649c r71b1b4b 23 23 24 24 #include "mffc.h" 25 #include "aubiofilterbank.h"26 25 27 26 // Computation … … 42 41 } 43 42 43 //TODO: check that zero padding 44 44 for(n = filter + 1; n < N; n++) result[n] = 0; 45 45 … … 51 51 int aubio_dct_do(const float *data, const int N, const void *argv, float *result){ 52 52 53 54 //call aubio p_voc in dct setting 55 56 //TODO: fvec as input? Remove data length, N? 57 58 //compute mag spectrum 59 aubio_pvoc_do (pv,data, fftgrain); 60 61 int i; 62 //extract real part of fft grain 63 for(i=0; i<N ;i++){ 64 result[i]= fftgrain->norm[i]*cos(fftgrain->phase[i]); 65 } 66 67 /* 53 68 fftwf_plan plan; 54 69 … … 57 72 58 73 fftwf_execute(plan); 59 fftwf_destroy_plan(plan); 74 fftwf_destroy_plan(plan);*/ 60 75 61 76 return XTRACT_SUCCESS; -
src/mfcc.h
rdcc649c r71b1b4b 24 24 #define MFCC_H 25 25 26 #include "filterbank.h" 26 27 27 28 //libXtract enums
Note: See TracChangeset
for help on using the changeset viewer.