source: tests/src/tempo/test-tempo.c @ 9547247

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

tests/src/tempo/: improve examples

  • Property mode set to 100644
File size: 712 bytes
Line 
1#include <aubio.h>
2
3int main ()
4{
5  uint_t i = 0;
6  uint_t win_s = 1024; // window size
7  fvec_t * in = new_fvec (win_s); // input vector
8  fvec_t * out = new_fvec (2); // output beat position
9
10  // create tempo object
11  aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
12
13  smpl_t bpm, confidence;
14
15  while (i < 1000) {
16    // put some fresh data in input vector
17    // ...
18
19    // execute tempo
20    aubio_tempo_do(o,in,out);
21    // do something with the beats
22    // ...
23
24    // get bpm and confidence
25    bpm = aubio_tempo_get_bpm(o);
26    confidence = aubio_tempo_get_confidence(o);
27
28    i++;
29  };
30
31  del_aubio_tempo(o);
32  del_fvec(in);
33  del_fvec(out);
34  aubio_cleanup();
35
36  return 0;
37}
Note: See TracBrowser for help on using the repository browser.