Changeset 3e7c408 for examples/aubiomfcc.c
- Timestamp:
- Sep 8, 2007, 3:35:50 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:
- 3504fd7f
- Parents:
- e2337ba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiomfcc.c
re2337ba r3e7c408 18 18 19 19 #include "utils.h" 20 21 /* mfcc objects */ 22 fvec_t * mfcc_outbuf; 23 aubio_mfcc_t * mfcc; 20 24 21 25 unsigned int pos = 0; /*frames%dspblocksize*/ … … 43 47 aubio_pvoc_do (pv,ibuf, fftgrain); 44 48 45 uint_t n_coefs= n_filters/2 +1;46 uint_t coef_cnt;47 48 49 for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++)50 mfcc_outbuf[coef_cnt]=0.f;51 52 49 //compute mfccs 53 aubio_mffc_do(fftgrain->norm, nframes, mf, mfcc_outbuf, fft_dct, fftgrain_dct); 54 55 for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++) 56 outmsg("%f ",mfcc_outbuf[coef_cnt]); 57 outmsg("\n"); 58 59 50 aubio_mfcc_do(mfcc, fftgrain, mfcc_outbuf); 60 51 61 52 /* end of block loop */ … … 83 74 84 75 int main(int argc, char **argv) { 76 // params 77 uint_t n_filters = 11; 78 smpl_t lowfreq = 500.; 79 smpl_t highfreq = 2000.; 85 80 examples_common_init(argc,argv); 86 87 //allocate and initialize mel filter bank 88 89 90 //allocating global mf (in utils.c) 91 uint_t banksize = (uint) ( sizeof(aubio_mel_filter)); 92 mf = (aubio_mel_filter *)getbytes(banksize); 93 94 mf->n_filters = 20; 95 mf->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *)); 96 for(n = 0; n < mf->n_filters; n++) 97 mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t)); 81 mfcc_outbuf = new_fvec(n_filters,channels); 98 82 99 83 //populating the filter 100 aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters); 84 mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq, 85 channels); 101 86 102 87 //process … … 106 91 fflush(stderr); 107 92 108 //destroying filterbank 109 free(mf); 93 //destroying mfcc 94 del_aubio_mfcc(mfcc); 95 del_fvec(mfcc_outbuf); 110 96 111 97 return 0;
Note: See TracChangeset
for help on using the changeset viewer.