source: examples/tests/test-tss.c @ ba11e53

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

added tss test
added tss test

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/* test sample for phase vocoder
2 *
3 * this program should start correctly using JACK_START_SERVER=true and
4 * reconstruct each audio input frame perfectly on the corresponding input with
5 * a delay equal to the window size, hop_s.
6 */
7
8#include "aubio.h"
9
10int main(){
11        int i;
12        uint_t win_s    = 1024; /* window size                       */
13        uint_t hop_s    = 256;  /* hop size                          */
14        uint_t channels = 4;  /* number of channels                */
15        /* allocate some memory */
16        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer       */
17        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
18        cvec_t * cstead   = new_cvec (win_s, channels); /* fft norm and phase */
19        cvec_t * ctrans   = new_cvec (win_s, channels); /* fft norm and phase */
20        fvec_t * stead    = new_fvec (hop_s, channels); /* output buffer      */
21        fvec_t * trans    = new_fvec (hop_s, channels); /* output buffer      */
22        /* allocate fft and other memory space */
23        aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s,channels);
24        aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s,channels);
25        aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s,channels);
26
27        aubio_tss_t *  tss = new_aubio_tss(0.01,3.,4.,win_s,hop_s,channels);
28        /* fill input with some data */
29        printf("initialised\n");
30        /* execute stft */
31        for (i = 0; i < 1000; i++) {
32                aubio_pvoc_do (pv,in,fftgrain);
33                aubio_tss_do  (tss,fftgrain,ctrans,cstead);
34                aubio_pvoc_rdo(pvt,cstead,stead);
35                aubio_pvoc_rdo(pvs,ctrans,trans);
36        }
37        del_aubio_pvoc(pv);
38        del_fvec(in);
39        del_cvec(fftgrain);
40        del_cvec(cstead);
41        del_cvec(ctrans);
42        del_fvec(stead);
43        del_fvec(trans);
44        printf("memory freed\n");
45        return 0;
46}
Note: See TracBrowser for help on using the repository browser.