feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 7efeffd was
9547247,
checked in by Paul Brossier <piem@piem.org>, 12 years ago
|
tests/src/tempo/: improve examples
|
-
Property mode set to
100644
|
File size:
712 bytes
|
Rev | Line | |
---|
[4e9101e] | 1 | #include <aubio.h> |
---|
| 2 | |
---|
[9547247] | 3 | int 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; |
---|
[4e9101e] | 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.