aubio 0.4.9
spectral/test-phasevoc.c
#include <aubio.h>
int main (void)
{
uint_t n = 6; // compute n times
uint_t win_s = 32; // window size
uint_t hop_s = win_s / 4; // hop size
fvec_t * in = new_fvec (hop_s); // input buffer
cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase
fvec_t * out = new_fvec (hop_s); // output buffer
// allocate fft and other memory space
aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
if (new_aubio_pvoc(win_s, 0)) return 1;
if (aubio_pvoc_get_win(pv) != win_s) return 1;
if (aubio_pvoc_get_hop(pv) != hop_s) return 1;
if (aubio_pvoc_set_window(pv, "hanningz") != 0) return 1;
// fill input with some data
fvec_set_all (in, 1.);
fvec_print (in);
while ( n-- ) {
// get some fresh input data
// ..
// execute phase vocoder
aubio_pvoc_do (pv,in,fftgrain);
// do something with fftgrain
// ...
cvec_print (fftgrain);
// optionally rebuild the signal
aubio_pvoc_rdo(pv,fftgrain,out);
// and do something with the result
// ...
fvec_print (out);
}
// clean up
del_fvec(in);
del_cvec(fftgrain);
del_fvec(out);
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
void cvec_print(const cvec_t *s)
print out cvec data
fvec_t * new_fvec(uint_t length)
fvec_t buffer creation function
void del_fvec(fvec_t *s)
fvec_t buffer deletion function
void fvec_print(const fvec_t *s)
print out fvec data
void fvec_set_all(fvec_t *s, smpl_t val)
set all elements to a given value
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
uint_t aubio_pvoc_set_window(aubio_pvoc_t *pv, const char_t *window_type)
set window type
aubio_pvoc_t * new_aubio_pvoc(uint_t win_s, uint_t hop_s)
create phase vocoder object
uint_t aubio_pvoc_get_win(aubio_pvoc_t *pv)
get window size
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
uint_t aubio_pvoc_get_hop(aubio_pvoc_t *pv)
get hop size
Vector of real-valued phase and spectrum data.
Definition: cvec.h:63
Buffer for real data.
Definition: fvec.h:67
unsigned int uint_t
unsigned integer
Definition: types.h:60