source: tests/src/test-beattracking.c @ 70dd55c

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 70dd55c was 7ac818f, checked in by Paul Brossier <piem@piem.org>, 15 years ago

tests/src: include stdio.h as needed, add HAVE_LIBSAMPLERATE

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include <stdio.h>
2#include <aubio.h>
3
4int main(){
5        /* allocate some memory */
6        uint_t win_s      = 1024;                       /* window size */
7        uint_t channels   = 1;                          /* number of channel */
8        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
9        fvec_t * out      = new_fvec (win_s/4, channels);     /* input buffer */
10 
11        /* allocate fft and other memory space */
12        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s, channels);
13
14        uint_t i = 0;
15
16        smpl_t curtempo, curtempoconf;
17
18        while (i < 10) {
19          aubio_beattracking_do(tempo,in,out);
20          curtempo = aubio_beattracking_get_bpm(tempo);
21          if (curtempo != 0.) {
22            fprintf(stdout,"%f\n",curtempo);
23            return 1;
24          }
25          curtempoconf = aubio_beattracking_get_confidence(tempo);
26          if (curtempoconf != 0.) {
27            fprintf(stdout,"%f\n",curtempo);
28            return 1;
29          }
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.