source: tests/src/spectral/test-tss.c @ 63fc1df

feature/cnnfeature/crepefeature/crepe_orgfix/ffmpeg5
Last change on this file since 63fc1df was 804c8eb, checked in by Paul Brossier <piem@piem.org>, 5 years ago

[tests] increase tss coverage

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[45c0f16]1#include <aubio.h>
[787b5e4]2
[158e031]3int main (void)
[6938a20]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
[9d6001cb]18  aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s);
[6938a20]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
[9d6001cb]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 */
[6938a20]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);
[9d6001cb]35  }
36
[804c8eb]37  aubio_tss_set_alpha(tss, 4.);
38  aubio_tss_set_beta(tss, 3.);
39  aubio_tss_set_threshold(tss, 3.);
40
[9d6001cb]41  del_aubio_pvoc(pv);
42  del_aubio_pvoc(pvt);
43  del_aubio_pvoc(pvs);
44  del_aubio_tss(tss);
45
46  del_fvec(in);
47  del_cvec(fftgrain);
48  del_cvec(cstead);
49  del_cvec(ctrans);
50  del_fvec(stead);
51  del_fvec(trans);
[6938a20]52
[9d6001cb]53  aubio_cleanup();
[6938a20]54
[9d6001cb]55  return 0;
[787b5e4]56}
Note: See TracBrowser for help on using the repository browser.