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