static LV2_Handle instantiateTss(const LV2_Descriptor *descriptor, double s_rate, const char *path, const LV2_Feature * const * features) { tss_t *plugin_data = (tss_t *)malloc(sizeof(tss_t)); plugin_data->inbuff=new_fvec (HOP_SIZE,1); plugin_data->steadybuff=new_fvec (HOP_SIZE,1); plugin_data->transbuff=new_fvec(HOP_SIZE,1); memset(plugin_data->steadybuff->data[0],0,HOP_SIZE*sizeof(float)); memset(plugin_data->transbuff->data[0],0,HOP_SIZE*sizeof(float)); plugin_data->tss=new_aubio_tss (0.01, 3, 4, BUFFSIZE, HOP_SIZE, 1); plugin_data->pv = new_aubio_pvoc (BUFFSIZE,HOP_SIZE,1); plugin_data->pvt = new_aubio_pvoc(BUFFSIZE,HOP_SIZE,1); plugin_data->pvs = new_aubio_pvoc(BUFFSIZE,HOP_SIZE,1); plugin_data->ci=new_cvec (BUFFSIZE, 1); plugin_data->cs=new_cvec (BUFFSIZE, 1); plugin_data->ct=new_cvec (BUFFSIZE, 1); plugin_data->index=0; return (LV2_Handle)plugin_data; }
int main (void) { uint_t n = 10; // compute n times uint_t win_s = 1024; // window size uint_t hop_s = 256; // hop size // create some vectors fvec_t * in = new_fvec (hop_s); // input buffer cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase cvec_t * cstead = new_cvec (win_s); // fft norm and phase cvec_t * ctrans = new_cvec (win_s); // fft norm and phase fvec_t * stead = new_fvec (hop_s); // output buffer fvec_t * trans = new_fvec (hop_s); // output buffer // create phase vocoder for analysis of input signal aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s); // create transient/steady-state separation object aubio_tss_t * tss = new_aubio_tss(win_s,hop_s); // create phase vocoder objects for synthesis of output signals aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s); aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s); /* execute stft */ while ( n-- ) { // fftgrain = pv(in) aubio_pvoc_do (pv, in, fftgrain); // ctrans, cstead = tss (fftgrain) aubio_tss_do (tss, fftgrain, ctrans, cstead); // stead = pvt_inverse (cstead) // trans = pvt_inverse (ctrans) aubio_pvoc_rdo (pvt, cstead, stead); aubio_pvoc_rdo (pvs, ctrans, trans); } aubio_tss_set_alpha(tss, 4.); aubio_tss_set_beta(tss, 3.); aubio_tss_set_threshold(tss, 3.); del_aubio_pvoc(pv); del_aubio_pvoc(pvt); del_aubio_pvoc(pvs); del_aubio_tss(tss); del_fvec(in); del_cvec(fftgrain); del_cvec(cstead); del_cvec(ctrans); del_fvec(stead); del_fvec(trans); aubio_cleanup(); return 0; }
int main(){ int i; uint_t win_s = 1024; /* window size */ uint_t hop_s = 256; /* hop size */ uint_t channels = 4; /* number of channels */ /* allocate some memory */ fvec_t * in = new_fvec (hop_s, channels); /* input buffer */ cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */ cvec_t * cstead = new_cvec (win_s, channels); /* fft norm and phase */ cvec_t * ctrans = new_cvec (win_s, channels); /* fft norm and phase */ fvec_t * stead = new_fvec (hop_s, channels); /* output buffer */ fvec_t * trans = new_fvec (hop_s, channels); /* output buffer */ /* allocate fft and other memory space */ aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s,channels); aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s,channels); aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s,channels); aubio_tss_t * tss = new_aubio_tss(0.01,3.,4.,win_s,hop_s,channels); /* fill input with some data */ printf("initialised\n"); /* execute stft */ for (i = 0; i < 10; i++) { aubio_pvoc_do (pv,in,fftgrain); aubio_tss_do (tss,fftgrain,ctrans,cstead); aubio_pvoc_rdo(pvt,cstead,stead); aubio_pvoc_rdo(pvs,ctrans,trans); } del_aubio_pvoc(pv); del_fvec(in); del_cvec(fftgrain); del_cvec(cstead); del_cvec(ctrans); del_fvec(stead); del_fvec(trans); aubio_cleanup(); printf("memory freed\n"); return 0; }