source: tests/src/spectral/test-tss.c @ 7e8b276

sampler
Last change on this file since 7e8b276 was 158e031, checked in by Paul Brossier <piem@piem.org>, 11 years ago

tests/: add void to prototypes to build with -Wstrict-prototypes

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#include <aubio.h>
2
3int main (void)
4{
5  uint_t n = 10; // compute n times
6  uint_t win_s = 1024; // window size
7  uint_t hop_s = 256;  // hop size
8
9  // create some vectors
10  fvec_t * in       = new_fvec (hop_s); // input buffer
11  cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
12  cvec_t * cstead   = new_cvec (win_s); // fft norm and phase
13  cvec_t * ctrans   = new_cvec (win_s); // fft norm and phase
14  fvec_t * stead    = new_fvec (hop_s); // output buffer
15  fvec_t * trans    = new_fvec (hop_s); // output buffer
16
17  // create phase vocoder for analysis of input signal
18  aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s);
19  // create transient/steady-state separation object
20  aubio_tss_t *  tss = new_aubio_tss(win_s,hop_s);
21  // create phase vocoder objects for synthesis of output signals
22  aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s);
23  aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s);
24
25  /* execute stft */
26  while ( n-- ) {
27    // fftgrain = pv(in)
28    aubio_pvoc_do (pv, in, fftgrain);
29    // ctrans, cstead = tss (fftgrain)
30    aubio_tss_do (tss, fftgrain, ctrans, cstead);
31    // stead = pvt_inverse (cstead)
32    // trans = pvt_inverse (ctrans)
33    aubio_pvoc_rdo (pvt, cstead, stead);
34    aubio_pvoc_rdo (pvs, ctrans, trans);
35  }
36
37  del_aubio_pvoc(pv);
38  del_aubio_pvoc(pvt);
39  del_aubio_pvoc(pvs);
40  del_aubio_tss(tss);
41
42  del_fvec(in);
43  del_cvec(fftgrain);
44  del_cvec(cstead);
45  del_cvec(ctrans);
46  del_fvec(stead);
47  del_fvec(trans);
48
49  aubio_cleanup();
50
51  return 0;
52}
Note: See TracBrowser for help on using the repository browser.