source: tests/src/spectral/test-phasevoc.c @ dc467b5d

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

tests/src/spectral/: improve examples

  • Property mode set to 100644
File size: 954 bytes
Line 
1#include <aubio.h>
2
3int main ()
4{
5  uint_t n = 6; // compute n times
6  uint_t win_s = 32; // window size
7  uint_t hop_s = win_s / 4; // hop size
8
9  fvec_t * in = new_fvec (hop_s); // input buffer
10  cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
11  fvec_t * out = new_fvec (hop_s); // output buffer
12
13  // allocate fft and other memory space
14  aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
15
16  // fill input with some data
17  fvec_set (in, 1.);
18  fvec_print (in);
19
20  while ( n-- ) {
21    // get some fresh input data
22    // ..
23
24    // execute phase vocoder
25    aubio_pvoc_do (pv,in,fftgrain);
26
27    // do something with fftgrain
28    // ...
29    cvec_print (fftgrain);
30
31    // optionnaly rebuild the signa
32    aubio_pvoc_rdo(pv,fftgrain,out);
33
34    // and do something with the result
35    // ...
36    fvec_print (out);
37  }
38
39  // clean up
40  del_fvec(in);
41  del_cvec(fftgrain);
42  del_fvec(out);
43  del_aubio_pvoc(pv);
44  aubio_cleanup();
45
46  return 0;
47}
Note: See TracBrowser for help on using the repository browser.