Changeset fc5bc72
- Timestamp:
- Jul 22, 2006, 11:43:30 AM (18 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:
- 4cab19e
- Parents:
- 7524d0b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiotrack.c
r7524d0b rfc5bc72 17 17 */ 18 18 19 #include <aubio.h> 19 20 #include "utils.h" 20 #include "beattracking.h"21 21 22 22 unsigned int pos = 0; /* frames%dspblocksize */ 23 unsigned int pos2 = 0; /* frames%dspblocksize */24 23 uint_t usepitch = 0; 25 fvec_t * dfframe = NULL;26 24 fvec_t * out = NULL; 27 aubio_beattracking_t * bt = NULL; 28 uint_t winlen = 512; 29 uint_t step = 0; 25 aubio_tempo_t * bt = NULL; 30 26 uint_t istactus = 0; 31 27 … … 34 30 unsigned int i; /*channels*/ 35 31 unsigned int j; /*frames*/ 36 smpl_t * btoutput = out->data[0];37 32 for (j=0;j<(unsigned)nframes;j++) { 38 33 if(usejack) { … … 47 42 if (pos == overlap_size-1) { 48 43 /* block loop */ 49 aubio_pvoc_do (pv,ibuf, fftgrain); 50 aubio_onsetdetection(o,fftgrain, onset); 51 if (usedoubled) { 52 aubio_onsetdetection(o2,fftgrain, onset2); 53 onset->data[0][0] *= onset2->data[0][0]; 54 } 55 /* execute every overlap_size*step */ 56 if (pos2 == step -1 ) { 57 58 /* check dfframe */ 59 /* 60 outmsg("\n"); 61 for (i = 0; i < winlen; i++ ) 62 outmsg("%f,", dfframe->data[0][i]); 63 outmsg("\n"); 64 */ 65 66 aubio_beattracking_do(bt,dfframe,out); 67 68 /* rotate dfframe */ 69 for (i = 0 ; i < winlen - step; i++ ) 70 dfframe->data[0][i] = dfframe->data[0][i+step]; 71 for (i = winlen - step ; i < winlen; i++ ) 72 dfframe->data[0][i] = 0.; 73 74 pos2 = -1; 75 } 76 pos2++; 77 isonset = aubio_peakpick_pimrt_wt(onset,parms,&(dfframe->data[0][winlen - step + pos2])); 78 /* end of second level loop */ 79 istactus = 0; 80 i=0; 81 for (i = 1; i < btoutput[0]; i++ ) { 82 if (pos2 == btoutput[i]) { 83 //printf("pos2: %d\n", pos2); 84 //printf("tempo:\t%3.5f bpm \n", 85 //60.*44100./overlap_size/abs(btoutput[2]-btoutput[1])); 86 /* test for silence */ 87 if (aubio_silence_detection(ibuf, silence)==1) { 88 isonset = 0; 89 istactus = 0; 90 } else { 91 istactus = 1; 92 } 93 } 94 } 95 96 if (istactus ==1) { 44 aubio_tempo(bt,ibuf,out); 45 if (out->data[0][0]==1) 46 istactus = 1; 47 else 48 istactus = 0; 49 if (istactus) { 97 50 for (pos = 0; pos < overlap_size; pos++) 98 51 obuf->data[0][pos] = woodblock->data[0][pos]; … … 125 78 /* override default settings */ 126 79 examples_common_init(argc,argv); 127 /* configure peak picker */128 //aubio_peakpicker_set_thresholdfn(parms,vec_mean);129 //aubio_peakpicker_set_threshold(parms,0.);130 winlen = SQR(512)/overlap_size;131 80 132 dfframe = new_fvec(winlen,channels); 133 step = winlen/4; 134 out = new_fvec(step,channels); 135 136 /* test input : impulses starting from 15, at intervals of 50 samples */ 137 //for(i=0;i<16;i++){ 138 // dfframe->data[0][50*i+14] = 1.; 139 //} 140 141 bt = new_aubio_beattracking(winlen,channels); 81 out = new_fvec(2,channels); 82 bt = new_aubio_tempo(type_onset,buffer_size,overlap_size,channels); 142 83 143 84 examples_common_process(aubio_process,process_print); 85 86 del_aubio_tempo(bt); 87 del_fvec(out); 144 88 145 89 examples_common_del();
Note: See TracChangeset
for help on using the changeset viewer.