source: tests/src/tempo/test-beattracking.c @ 988345f

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since 988345f was 988345f, checked in by Paul Brossier <piem@piem.org>, 6 years ago

tests/src/tempo/test-beattracking.c: print bpm

  • Property mode set to 100644
File size: 831 bytes
Line 
1#define AUBIO_UNSTABLE 1
2
3#include <aubio.h>
4#include <stdio.h>
5
6int main ()
7{
8  uint_t i = 0;
9  uint_t win_s = 1024; // window size
10  fvec_t * in = new_fvec (win_s); // input buffer
11  fvec_t * out = new_fvec (win_s / 4); // output beat position
12
13  // create beattracking object
14  aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s);
15
16  smpl_t bpm, confidence;
17
18  while (i < 10) {
19    // put some fresh data in feature vector
20    // ...
21
22    aubio_beattracking_do(tempo,in,out);
23    // do something  with the beats
24    // ...
25
26    // get bpm and confidence
27    bpm = aubio_beattracking_get_bpm(tempo);
28    fprintf(stderr, "found bpm %f\n", bpm);
29    confidence = aubio_beattracking_get_confidence(tempo);
30    i++;
31  };
32
33  del_aubio_beattracking(tempo);
34  del_fvec(in);
35  del_fvec(out);
36  aubio_cleanup();
37
38  return 0;
39}
40
Note: See TracBrowser for help on using the repository browser.