Changeset 9547247 for tests/src/tempo/test-beattracking.c
- Timestamp:
- Mar 3, 2013, 7:38:32 PM (12 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:
- 3684ab4
- Parents:
- 6938a20
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/src/tempo/test-beattracking.c ΒΆ
r6938a20 r9547247 1 1 #define AUBIO_UNSTABLE 1 2 2 3 #include <stdio.h>4 3 #include <aubio.h> 5 4 6 int main(){ 7 /* allocate some memory */ 8 uint_t win_s = 1024; /* window size */ 9 fvec_t * in = new_fvec (win_s); /* input buffer */ 10 fvec_t * out = new_fvec (win_s/4); /* input buffer */ 11 12 /* allocate fft and other memory space */ 13 aubio_beattracking_t * tempo = new_aubio_beattracking(win_s); 5 int main () 6 { 7 uint_t i = 0; 8 uint_t win_s = 1024; // window size 9 fvec_t * in = new_fvec (win_s); // input buffer 10 fvec_t * out = new_fvec (2); // output beat position 14 11 15 uint_t i = 0; 12 // create beattracking object 13 aubio_beattracking_t * tempo = new_aubio_beattracking(win_s); 16 14 17 smpl_t curtempo, curtempoconf;15 smpl_t bpm, confidence; 18 16 19 while (i < 10) { 20 aubio_beattracking_do(tempo,in,out); 21 curtempo = aubio_beattracking_get_bpm(tempo); 22 if (curtempo != 0.) { 23 fprintf(stdout,"%f\n",curtempo); 24 return 1; 25 } 26 curtempoconf = aubio_beattracking_get_confidence(tempo); 27 if (curtempoconf != 0.) { 28 fprintf(stdout,"%f\n",curtempo); 29 return 1; 30 } 31 i++; 32 }; 17 while (i < 10) { 18 // put some fresh data in feature vector 19 // ... 33 20 34 del_aubio_beattracking(tempo); 35 del_fvec(in); 36 del_fvec(out); 37 aubio_cleanup(); 21 aubio_beattracking_do(tempo,in,out); 22 // do something with the beats 23 // ... 38 24 39 return 0; 25 // get bpm and confidence 26 bpm = aubio_beattracking_get_bpm(tempo); 27 confidence = aubio_beattracking_get_confidence(tempo); 28 i++; 29 }; 30 31 del_aubio_beattracking(tempo); 32 del_fvec(in); 33 del_fvec(out); 34 aubio_cleanup(); 35 36 return 0; 40 37 } 41 38
Note: See TracChangeset
for help on using the changeset viewer.