- Timestamp:
- Sep 10, 2007, 7:29:32 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:
- 787f1f3, ef1c3b7
- Parents:
- 7c6c806d (diff), 45134c5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- examples
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Makefile.am
r7c6c806d r7a46bf6 11 11 aubioonset \ 12 12 aubiotrack \ 13 aubionotes 13 aubionotes \ 14 aubiomfcc 14 15 15 16 noinst_PROGRAMS = \ … … 23 24 aubiotrack_SOURCES = aubiotrack.c utils.c 24 25 aubioquiet_SOURCES = aubioquiet.c utils.c 26 aubiomfcc_SOURCES = aubiomfcc.c utils.c 25 27 26 28 aubioonset_LDADD = @JACK_LIBS@ … … 28 30 aubiotrack_LDADD = @JACK_LIBS@ 29 31 aubioquiet_LDADD = @JACK_LIBS@ 32 aubiomfcc_LDADD = @JACK_LIBS@ -
examples/aubiomfcc.c
r7c6c806d r7a46bf6 1 1 /* 2 Copyright (C) 2007 Amaury Hazan 2 Copyright (C) 2007 Amaury Hazan <ahazan@iua.upf.edu> 3 and Paul Brossier <piem@piem.org> 3 4 4 5 This program is free software; you can redistribute it and/or modify … … 18 19 19 20 #include "utils.h" 21 22 /* mfcc objects */ 23 fvec_t * mfcc_out; 24 aubio_mfcc_t * mfcc; 25 26 uint_t n_filters = 20; 27 uint_t n_coefs = 11; 20 28 21 29 unsigned int pos = 0; /*frames%dspblocksize*/ … … 43 51 aubio_pvoc_do (pv,ibuf, fftgrain); 44 52 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 53 //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 54 aubio_mfcc_do(mfcc, fftgrain, mfcc_out); 60 55 61 56 /* end of block loop */ … … 73 68 */ 74 69 70 uint_t coef_cnt; 75 71 if (output_filename == NULL) { 76 if(frames >= 4) { 77 outmsg("%f\n",(frames-4)*overlap_size/(float)samplerate); 78 } else if (frames < 4) { 79 outmsg("%f\n",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]); 80 82 } 83 outmsg("\n");/*/ 81 84 } 82 85 } 83 86 84 87 int main(int argc, char **argv) { 88 // params 89 //uint_t n_filters = 40; 90 //uint_t n_coefs = 15; 91 85 92 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)); 93 smpl_t lowfreq = 133.333f; 94 smpl_t highfreq = 44100.f; 95 mfcc_out = new_fvec(n_coefs,channels); 98 96 99 97 //populating the filter 100 aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters);98 mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, n_coefs , lowfreq, highfreq, channels); 101 99 102 100 //process 103 101 examples_common_process(aubio_process,process_print); 102 103 //destroying mfcc 104 del_aubio_mfcc(mfcc); 105 del_fvec(mfcc_out); 106 104 107 examples_common_del(); 105 108 debug("End of program.\n"); 106 109 fflush(stderr); 107 110 108 //destroying filterbank109 free(mf);110 111 111 return 0; 112 112 } -
examples/tests/test-beattracking.c
r7c6c806d r7a46bf6 13 13 uint_t i = 0; 14 14 15 smpl_t curtempo; 16 15 17 while (i < 10) { 16 18 aubio_beattracking_do(tempo,in,out); 19 curtempo = aubio_beattracking_get_bpm(tempo); 20 if (curtempo != 0.) { 21 fprintf(stdout,"%f\n",curtempo); 22 return 1; 23 } 17 24 i++; 18 25 }; -
examples/tests/test-tempo.c
r7c6c806d r7a46bf6 10 10 uint_t i = 0; 11 11 12 smpl_t curtempo; 13 12 14 while (i < 1000) { 13 15 aubio_tempo(o,in,out); 16 curtempo = aubio_tempo_get_bpm(o); 17 if (curtempo != 0.) { 18 fprintf(stdout,"%f\n",curtempo); 19 } 14 20 i++; 15 21 }; -
examples/utils.c
r7c6c806d r7a46bf6 60 60 int isonset = 0; 61 61 aubio_pickpeak_t * parms; 62 63 /* mfcc objects */64 //parameters65 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 object70 aubio_mel_filter * mf;71 72 // DCT mfft and result storage73 aubio_mfft * fft_dct;74 cvec_t * fftgrain_dct;75 smpl_t mfcc_outbuf[11];76 77 62 78 63 /* pitch objects */ … … 315 300 fftgrain = new_cvec(buffer_size, channels); 316 301 317 //init for mfcc process 318 fftgrain_dct= new_cvec(n_filters, channels); 319 302 320 303 if (usepitch) { 321 304 pitchdet = new_aubio_pitchdetection(buffer_size*4, … … 331 314 pv = new_aubio_pvoc(buffer_size, overlap_size, channels); 332 315 333 // dct phase vocoder334 //TODO: check size335 fft_dct = new_aubio_mfft(n_filters, channels);336 337 316 /* onsets */ 338 317 parms = new_aubio_peakpicker(threshold); … … 368 347 del_fvec(onset); 369 348 del_fvec(woodblock); 370 371 //mffc related372 del_aubio_mfft(fft_dct);373 del_cvec(fftgrain_dct);374 349 375 350 aubio_cleanup(); -
examples/utils.h
r7c6c806d r7a46bf6 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.