source: tests/src/tempo/test-beattracking.c @ 158e031

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

tests/: add void to prototypes to build with -Wstrict-prototypes

  • Property mode set to 100644
File size: 878 bytes
Line 
1#define AUBIO_UNSTABLE 1
2
3#include <aubio.h>
4#include <stdio.h>
5
6int main (void)
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, 256, 44100);
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    confidence = aubio_beattracking_get_confidence(tempo);
29    fprintf(stderr, "found bpm %f with confidence %f\n", bpm, confidence);
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.