#include "utils.h"
+/* mfcc objects */
+fvec_t * mfcc_outbuf;
+aubio_mfcc_t * mfcc;
+
unsigned int pos = 0; /*frames%dspblocksize*/
uint_t usepitch = 0;
//compute mag spectrum
aubio_pvoc_do (pv,ibuf, fftgrain);
- uint_t n_coefs= n_filters/2 +1;
- uint_t coef_cnt;
-
-
- for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++)
- mfcc_outbuf[coef_cnt]=0.f;
-
//compute mfccs
- aubio_mffc_do(fftgrain->norm, nframes, mf, mfcc_outbuf, fft_dct, fftgrain_dct);
-
- for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++)
- outmsg("%f ",mfcc_outbuf[coef_cnt]);
- outmsg("\n");
-
-
+ aubio_mfcc_do(mfcc, fftgrain, mfcc_outbuf);
/* end of block loop */
pos = -1; /* so it will be zero next j loop */
}
int main(int argc, char **argv) {
+ // params
+ uint_t n_filters = 11;
+ smpl_t lowfreq = 500.;
+ smpl_t highfreq = 2000.;
examples_common_init(argc,argv);
-
- //allocate and initialize mel filter bank
-
-
- //allocating global mf (in utils.c)
- uint_t banksize = (uint) ( sizeof(aubio_mel_filter));
- mf = (aubio_mel_filter *)getbytes(banksize);
-
- mf->n_filters = 20;
- mf->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *));
- for(n = 0; n < mf->n_filters; n++)
- mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t));
+ mfcc_outbuf = new_fvec(n_filters,channels);
//populating the filter
- aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters);
+ mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq,
+ channels);
//process
examples_common_process(aubio_process,process_print);
debug("End of program.\n");
fflush(stderr);
- //destroying filterbank
- free(mf);
+ //destroying mfcc
+ del_aubio_mfcc(mfcc);
+ del_fvec(mfcc_outbuf);
return 0;
}
extern int isonset;
extern aubio_pickpeak_t * parms;
-/* mfcc objects */
-// params
-extern uint_t n_filters;
-extern uint_t nyquist;
-extern smpl_t lowfreq;
-extern smpl_t highfreq;
-// filterbank object
-extern aubio_mel_filter * mf;
-// DCT pvoc and result storage
-extern aubio_mfft_t * fft_dct;
-extern cvec_t * fftgrain_dct;
-extern smpl_t mfcc_outbuf[20];
-
/* pitch objects */
extern smpl_t pitch;
extern aubio_pitchdetection_t * pitchdet;