Changeset 3e7c408
- 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
- Location:
- examples
- Files:
-
- 3 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; -
examples/utils.c
re2337ba r3e7c408 64 64 //parameters 65 65 uint_t n_filters=20; 66 uint_t nyquist= samplerate / 2.;67 66 smpl_t lowfreq=80.f; 68 67 smpl_t highfreq=18000.f; 69 68 // filterbank object 70 aubio_ mel_filter* mf;69 aubio_filterbank_t * mf; 71 70 72 71 // DCT mfft and result storage 73 aubio_mfft * fft_dct;72 aubio_mfft_t * fft_dct; 74 73 cvec_t * fftgrain_dct; 75 smpl_t mfcc_outbuf[11];74 smpl_t * mfcc_outbuf[11]; 76 75 77 76 -
examples/utils.h
re2337ba r3e7c408 98 98 extern aubio_pickpeak_t * parms; 99 99 100 /* mfcc objects */101 // params102 extern uint_t n_filters;103 extern uint_t nyquist;104 extern smpl_t lowfreq;105 extern smpl_t highfreq;106 // filterbank object107 extern aubio_mel_filter * mf;108 // DCT pvoc and result storage109 extern aubio_mfft_t * fft_dct;110 extern cvec_t * fftgrain_dct;111 extern smpl_t mfcc_outbuf[20];112 113 100 /* pitch objects */ 114 101 extern smpl_t pitch;
Note: See TracChangeset
for help on using the changeset viewer.