- Timestamp:
- Sep 6, 2007, 7:32:13 PM (17 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 7a46bf6, fdf39ba
- Parents:
- 71b1b4b
- Location:
- examples
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiomfcc.c
r71b1b4b r7c6c806d 27 27 unsigned int j; /*frames*/ 28 28 29 // declare the mel filter bank30 // TODO: should be done only once31 aubio_mfcc_init(int N, NYQUIST, int style, float freq_min, float freq_max, int freq_bands, float **fft_tables);32 33 29 for (j=0;j<(unsigned)nframes;j++) { 34 30 if(usejack) { … … 47 43 aubio_pvoc_do (pv,ibuf, fftgrain); 48 44 45 uint_t n_coefs= n_filters/2 +1; 49 46 uint_t coef_cnt; 50 uint_t n_filters=20; 51 smpl_t outbuf[20]; 47 52 48 53 for (coef_cnt=0; coef_cnt<n_ filters ; coef_cnt++)54 outbuf[coef_cnt]=0.f;49 for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++) 50 mfcc_outbuf[coef_cnt]=0.f; 55 51 56 52 //compute mfccs 57 aubio_mffc_do(fftgrain->norm, nframes, mf, outbuf);53 aubio_mffc_do(fftgrain->norm, nframes, mf, mfcc_outbuf, fft_dct, fftgrain_dct); 58 54 59 for (coef_cnt=0; coef_cnt<n_ filters ; coef_cnt++)60 outmsg("%f ", outbuf[coef_cnt]);55 for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++) 56 outmsg("%f ",mfcc_outbuf[coef_cnt]); 61 57 outmsg("\n"); 62 58 … … 90 86 91 87 //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; 88 96 89 90 //allocating global mf (in utils.c) 97 91 uint_t banksize = (uint) ( sizeof(aubio_mel_filter)); 98 aubio_mel_filter *mf = (aubio_mel_filter *)getbytes(banksize);92 mf = (aubio_mel_filter *)getbytes(banksize); 99 93 100 94 mf->n_filters = 20; -
examples/utils.c
r71b1b4b r7c6c806d 60 60 int isonset = 0; 61 61 aubio_pickpeak_t * parms; 62 63 /* mfcc objects */ 64 //parameters 65 uint_t n_filters=20; 66 uint_t nyquist= samplerate / 2.; 67 smpl_t lowfreq=80.f; 68 smpl_t highfreq=18000.f; 69 // filterbank object 70 aubio_mel_filter * mf; 71 72 // DCT mfft and result storage 73 aubio_mfft * fft_dct; 74 cvec_t * fftgrain_dct; 75 smpl_t mfcc_outbuf[11]; 62 76 63 77 … … 301 315 fftgrain = new_cvec(buffer_size, channels); 302 316 317 //init for mfcc process 318 fftgrain_dct= new_cvec(n_filters, channels); 319 303 320 if (usepitch) { 304 321 pitchdet = new_aubio_pitchdetection(buffer_size*4, … … 313 330 /* phase vocoder */ 314 331 pv = new_aubio_pvoc(buffer_size, overlap_size, channels); 332 333 // dct phase vocoder 334 //TODO: check size 335 fft_dct = new_aubio_mfft(n_filters, channels); 336 315 337 /* onsets */ 316 338 parms = new_aubio_peakpicker(threshold); … … 346 368 del_fvec(onset); 347 369 del_fvec(woodblock); 370 371 //mffc related 372 del_aubio_mfft(fft_dct); 373 del_cvec(fftgrain_dct); 374 348 375 aubio_cleanup(); 349 376 } -
examples/utils.h
r71b1b4b r7c6c806d 98 98 extern aubio_pickpeak_t * parms; 99 99 100 /* mfcc objects */ 101 // params 102 extern uint_t n_filters; 103 extern uint_t nyquist; 104 extern smpl_t lowfreq; 105 extern smpl_t highfreq; 106 // filterbank object 107 extern aubio_mel_filter * mf; 108 // DCT pvoc and result storage 109 extern aubio_mfft_t * fft_dct; 110 extern cvec_t * fftgrain_dct; 111 extern smpl_t mfcc_outbuf[20]; 100 112 101 113 /* pitch objects */
Note: See TracChangeset
for help on using the changeset viewer.