Loading...
Searching...
No Matches
spectral/test-tss.c
#include <aubio.h>
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;
}
aubio.h
Global aubio include file.
new_cvec
cvec_t * new_cvec(uint_t length)
cvec_t buffer creation function
del_cvec
void del_cvec(cvec_t *s)
cvec_t buffer deletion function
new_fvec
fvec_t * new_fvec(uint_t length)
fvec_t buffer creation function
del_fvec
void del_fvec(fvec_t *s)
fvec_t buffer deletion function
aubio_cleanup
void aubio_cleanup(void)
clean up cached memory at the end of program
aubio_pvoc_t
struct _aubio_pvoc_t aubio_pvoc_t
phasevocoder object
Definition phasevoc.h:42
aubio_pvoc_do
void aubio_pvoc_do(aubio_pvoc_t *pv, const fvec_t *in, cvec_t *fftgrain)
compute spectral frame
new_aubio_pvoc
aubio_pvoc_t * new_aubio_pvoc(uint_t win_s, uint_t hop_s)
create phase vocoder object
aubio_pvoc_rdo
void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t *fftgrain, fvec_t *out)
compute signal from spectral frame
del_aubio_pvoc
void del_aubio_pvoc(aubio_pvoc_t *pv)
delete phase vocoder object
cvec_t
Vector of real-valued phase and spectrum data.
Definition cvec.h:63
fvec_t
Buffer for real data.
Definition fvec.h:67
aubio_tss_t
struct _aubio_tss_t aubio_tss_t
Transient / Steady-state Separation object.
Definition tss.h:47
aubio_tss_set_beta
uint_t aubio_tss_set_beta(aubio_tss_t *o, smpl_t beta)
set parameter b, defaults to 3
aubio_tss_do
void aubio_tss_do(aubio_tss_t *o, const cvec_t *input, cvec_t *trans, cvec_t *stead)
split input into transient and steady states components
new_aubio_tss
aubio_tss_t * new_aubio_tss(uint_t buf_size, uint_t hop_size)
create tss object
del_aubio_tss
void del_aubio_tss(aubio_tss_t *o)
delete tss object
aubio_tss_set_threshold
uint_t aubio_tss_set_threshold(aubio_tss_t *o, smpl_t thrs)
set transient / steady state separation threshold
aubio_tss_set_alpha
uint_t aubio_tss_set_alpha(aubio_tss_t *o, smpl_t alpha)
set parameter a, defaults to 3
uint_t
unsigned int uint_t
unsigned integer
Definition types.h:60