source: tests/src/tempo/test-beattracking.c

Last change on this file was 158e031, checked in by Paul Brossier <piem@piem.org>, 10 years ago

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

  • Property mode set to 100644
File size: 878 bytes
RevLine 
[21f0655]1#define AUBIO_UNSTABLE 1
2
[4e9101e]3#include <aubio.h>
[988345f]4#include <stdio.h>
[4e9101e]5
[158e031]6int main (void)
[9547247]7{
8  uint_t i = 0;
9  uint_t win_s = 1024; // window size
10  fvec_t * in = new_fvec (win_s); // input buffer
[e9436a6]11  fvec_t * out = new_fvec (win_s / 4); // output beat position
[9547247]12
13  // create beattracking object
[77db425]14  aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s, 256, 44100);
[9547247]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);
[9ec63a0]29    fprintf(stderr, "found bpm %f with confidence %f\n", bpm, confidence);
[9547247]30    i++;
31  };
32
33  del_aubio_beattracking(tempo);
34  del_fvec(in);
35  del_fvec(out);
36  aubio_cleanup();
37
38  return 0;
[4e9101e]39}
40
Note: See TracBrowser for help on using the repository browser.