Intel IPP support for aubio
[aubio.git] / tests / src / pitch / test-pitch.c
1 #include <aubio.h>
2
3 int main (void)
4 {
5   aubio_init();
6   
7   // 1. allocate some memory
8   uint_t n = 0; // frame counter
9   uint_t win_s = 1024; // window size
10   uint_t hop_s = win_s / 4; // hop size
11   uint_t samplerate = 44100; // samplerate
12   // create some vectors
13   fvec_t *input = new_fvec (hop_s); // input buffer
14   fvec_t *out = new_fvec (1); // output candidates
15   // create pitch object
16   aubio_pitch_t *o = new_aubio_pitch ("default", win_s, hop_s, samplerate);
17
18   // 2. do something with it
19   while (n < 100) {
20     // get `hop_s` new samples into `input`
21     // ...
22     // exectute pitch
23     aubio_pitch_do (o, input, out);
24     // do something with output candidates
25     // ...
26     n++;
27   };
28
29   // 3. clean up memory
30   del_aubio_pitch (o);
31   del_fvec (out);
32   del_fvec (input);
33   aubio_cleanup ();
34
35   return 0;
36 }