1 | #include <aubio.h> |
---|
2 | |
---|
3 | int 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 | aubio_tss_set_alpha(tss, 4.); |
---|
38 | aubio_tss_set_beta(tss, 3.); |
---|
39 | aubio_tss_set_threshold(tss, 3.); |
---|
40 | |
---|
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); |
---|
52 | |
---|
53 | aubio_cleanup(); |
---|
54 | |
---|
55 | return 0; |
---|
56 | } |
---|