source: tests/src/onset/test-onset.c @ bd1fa89

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since bd1fa89 was 26775a3, checked in by Paul Brossier <piem@piem.org>, 12 years ago

tests/src/onset/: improve examples

  • Property mode set to 100644
File size: 814 bytes
Line 
1#include <aubio.h>
2
3int main ()
4{
5  // 1. allocate some memory
6  uint_t n = 0; // frame counter
7  uint_t win_s = 1024; // window size
8  uint_t hop_s = win_s / 4; // hop size
9  uint_t samplerate = 44100; // samplerate
10  // create some vectors
11  fvec_t * input = new_fvec (win_s/4); // input buffer
12  fvec_t * out = new_fvec (2); // input buffer
13  // create onset object
14  aubio_onset_t * onset = new_aubio_onset("complex", win_s, hop_s, samplerate);
15
16  // 2. do something with it
17  while (n < 10) {
18    // get `hop_s` new samples into `input`
19    // ...
20    // exectute onset detection
21    aubio_onset_do (onset, input, out);
22    // do something with output candidates
23    // ...
24    n++;
25  };
26
27  // 3. clean up memory
28  del_aubio_onset(onset);
29  del_fvec(input);
30  del_fvec(out);
31  aubio_cleanup();
32
33  return 0;
34}
Note: See TracBrowser for help on using the repository browser.