feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 074b41b was
9ec63a0,
checked in by Paul Brossier <piem@piem.org>, 11 years ago
|
tests/src/tempo/test-beattracking.c: also use use confidence
|
-
Property mode set to
100644
|
File size:
874 bytes
|
Rev | Line | |
---|
[21f0655] | 1 | #define AUBIO_UNSTABLE 1 |
---|
| 2 | |
---|
[4e9101e] | 3 | #include <aubio.h> |
---|
[988345f] | 4 | #include <stdio.h> |
---|
[4e9101e] | 5 | |
---|
[9547247] | 6 | int 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 |
---|
[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.