aubio
0.4.9
Toggle main menu visibility
Loading...
Searching...
No Matches
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);
del_aubio_pvoc
(pv);
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
cvec_print
void cvec_print(const cvec_t *s)
print out cvec data
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
fvec_print
void fvec_print(const fvec_t *s)
print out fvec data
fvec_set_all
void fvec_set_all(fvec_t *s, smpl_t val)
set all elements to a given value
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
aubio_pvoc_set_window
uint_t aubio_pvoc_set_window(aubio_pvoc_t *pv, const char_t *window_type)
set window type
new_aubio_pvoc
aubio_pvoc_t * new_aubio_pvoc(uint_t win_s, uint_t hop_s)
create phase vocoder object
aubio_pvoc_get_win
uint_t aubio_pvoc_get_win(aubio_pvoc_t *pv)
get window size
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
aubio_pvoc_get_hop
uint_t aubio_pvoc_get_hop(aubio_pvoc_t *pv)
get hop size
cvec_t
Vector of real-valued phase and spectrum data.
Definition
cvec.h:63
fvec_t
Buffer for real data.
Definition
fvec.h:67
uint_t
unsigned int uint_t
unsigned integer
Definition
types.h:60
Generated by
1.17.0