Changes in / [45134c5:7a46bf6]
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiomfcc.c
r45134c5 r7a46bf6 23 23 fvec_t * mfcc_out; 24 24 aubio_mfcc_t * mfcc; 25 26 uint_t n_filters = 20; 27 uint_t n_coefs = 11; 25 28 26 29 unsigned int pos = 0; /*frames%dspblocksize*/ … … 65 68 */ 66 69 67 uint_t filter_cnt;70 uint_t coef_cnt; 68 71 if (output_filename == NULL) { 69 if(frames >= 4) { 70 outmsg("%f\t",(frames-4)*overlap_size/(float)samplerate); 71 } else if (frames < 4) { 72 outmsg("%f\t",0.); 72 // if(frames >= 4) { 73 // outmsg("%f\t",(frames-4)*overlap_size/(float)samplerate); 74 // } 75 // else if (frames < 4) { 76 // outmsg("%f\t",0.); 77 // } 78 //outmsg("%f ",mfcc_out->data[0][0]); 79 80 /*for (coef_cnt = 0; coef_cnt < n_coefs; coef_cnt++) { 81 outmsg("%f ",mfcc_out->data[0][coef_cnt]); 73 82 } 74 outmsg("%f",mfcc_out->data[0][0]); 75 for (filter_cnt = 1; filter_cnt < mfcc_out->length; filter_cnt++) { 76 outmsg(",%f",mfcc_out->data[0][filter_cnt]); 77 } 78 outmsg("\n"); 83 outmsg("\n");/*/ 79 84 } 80 85 } … … 82 87 int main(int argc, char **argv) { 83 88 // params 84 uint_t n_filters = 11; 89 //uint_t n_filters = 40; 90 //uint_t n_coefs = 15; 91 85 92 examples_common_init(argc,argv); 86 smpl_t lowfreq = 0.;87 smpl_t highfreq = samplerate;88 mfcc_out = new_fvec(n_ filters,channels);93 smpl_t lowfreq = 133.333f; 94 smpl_t highfreq = 44100.f; 95 mfcc_out = new_fvec(n_coefs,channels); 89 96 90 97 //populating the filter 91 mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq, 92 channels); 98 mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, n_coefs , lowfreq, highfreq, channels); 93 99 94 100 //process -
examples/utils.c
r45134c5 r7a46bf6 60 60 int isonset = 0; 61 61 aubio_pickpeak_t * parms; 62 63 /* mfcc objects */64 //parameters65 uint_t n_filters=20;66 smpl_t lowfreq=80.f;67 smpl_t highfreq=18000.f;68 // filterbank object69 aubio_filterbank_t * mf;70 71 // DCT mfft and result storage72 aubio_mfft_t * fft_dct;73 cvec_t * fftgrain_dct;74 smpl_t * mfcc_outbuf[11];75 76 62 77 63 /* pitch objects */ … … 314 300 fftgrain = new_cvec(buffer_size, channels); 315 301 316 //init for mfcc process 317 fftgrain_dct= new_cvec(n_filters, channels); 318 302 319 303 if (usepitch) { 320 304 pitchdet = new_aubio_pitchdetection(buffer_size*4, … … 330 314 pv = new_aubio_pvoc(buffer_size, overlap_size, channels); 331 315 332 // dct phase vocoder333 //TODO: check size334 fft_dct = new_aubio_mfft(n_filters, channels);335 336 316 /* onsets */ 337 317 parms = new_aubio_peakpicker(threshold); … … 367 347 del_fvec(onset); 368 348 del_fvec(woodblock); 369 370 //mffc related371 del_aubio_mfft(fft_dct);372 del_cvec(fftgrain_dct);373 349 374 350 aubio_cleanup(); -
src/filterbank.c
r45134c5 r7a46bf6 26 26 #include "sample.h" 27 27 #include "filterbank.h" 28 29 #include "stdio.h" 28 30 29 31 #define USE_EQUAL_GAIN 1 … … 54 56 55 57 aubio_filterbank_t * new_aubio_filterbank_mfcc(uint_t n_filters, uint_t win_s, smpl_t samplerate, smpl_t freq_min, smpl_t freq_max){ 58 59 uint_t writelog=1; 60 61 FILE * mlog; 62 if(writelog==1) mlog=fopen("filterbank.txt","w"); 63 64 56 65 smpl_t nyquist = samplerate/2.; 57 66 uint_t style = 1; … … 142 151 for(k = next_peak + 1; k < fb->win_s; k++) 143 152 fb->filters[n]->data[0][k]=0.f; 153 154 if(writelog){ 155 //dumping filter values 156 smpl_t area_tmp=0.f; 157 for(k = 0; k < fb->win_s; k++){ 158 fprintf(mlog,"%f ",fb->filters[n]->data[0][k]); 159 } 160 fprintf(mlog,"\n"); 161 } 162 144 163 } 145 164 … … 148 167 free(height_norm); 149 168 free(fft_peak); 169 170 if(mlog) fclose(mlog); 150 171 151 172 return fb; -
src/mfcc.c
r45134c5 r7a46bf6 34 34 uint_t samplerate; /** sample rate (needed?) */ 35 35 uint_t channels; /** number of channels */ 36 uint_t n_coefs; /** number of coefficients (= fb->n_filters/2 +1) */ 36 uint_t n_filters; /** number of *filters */ 37 uint_t n_coefs; /** number of coefficients (<= n_filters/2 +1) */ 37 38 smpl_t lowfreq; /** lowest frequency for filters */ 38 39 smpl_t highfreq; /** highest frequency for filters */ … … 44 45 45 46 46 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate ,uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels){47 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels){ 47 48 /** allocating space for mfcc object */ 48 49 aubio_mfcc_t * mfcc = AUBIO_NEW(aubio_mfcc_t); 49 50 50 51 //we need (n_coefs-1)*2 filters to obtain n_coefs coefficients after dct 51 uint_t n_filters = (n_coefs-1)*2;52 //uint_t n_filters = (n_coefs-1)*2; 52 53 53 54 mfcc->win_s=win_s; 54 55 mfcc->samplerate=samplerate; 55 56 mfcc->channels=channels; 57 mfcc->n_filters=n_filters; 56 58 mfcc->n_coefs=n_coefs; 57 59 mfcc->lowfreq=lowfreq; … … 102 104 aubio_mfft_do (mf->fft_dct, in, mf->fftgrain_dct); 103 105 //extract real part of fft grain 104 //for(i=0; i<mf->n_coefs ;i++){105 for(i=0; i<out->length;i++){106 for(i=0; i<mf->n_coefs ;i++){ 107 //for(i=0; i<out->length;i++){ 106 108 out->data[0][i]= mf->fftgrain_dct->norm[0][i] 107 109 *COS(mf->fftgrain_dct->phas[0][i]); -
src/mfcc.h
r45134c5 r7a46bf6 45 45 46 46 */ 47 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate ,uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels);47 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels); 48 48 /** delete mfcc object 49 49
Note: See TracChangeset
for help on using the changeset viewer.