source: tests/src/pitch/test-pitch.c @ f3617e7

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

tests/src/pitch/: improve examples

  • Property mode set to 100644
File size: 798 bytes
RevLine 
[4e9101e]1#include <aubio.h>
2
[c71aa44]3int main ()
[fe163ad]4{
[c71aa44]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 (hop_s); // input buffer
12  fvec_t *out = new_fvec (1); // output candidates
13  // create pitch object
14  aubio_pitch_t *o = new_aubio_pitch ("default", win_s, hop_s, samplerate);
[4e9101e]15
[c71aa44]16  // 2. do something with it
17  while (n < 100) {
18    // get `hop_s` new samples into `input`
19    // ...
20    // exectute pitch
21    aubio_pitch_do (o, input, out);
22    // do something with output candidates
23    // ...
24    n++;
[fe163ad]25  };
[4e9101e]26
[c71aa44]27  // 3. clean up memory
[ca1abdd]28  del_aubio_pitch (o);
[9d6001cb]29  del_fvec (out);
[c71aa44]30  del_fvec (input);
[fe163ad]31  aubio_cleanup ();
[4e9101e]32
[fe163ad]33  return 0;
[4e9101e]34}
Note: See TracBrowser for help on using the repository browser.