aubio: spectral/test-filterbank.c

aubio 0.4.9

Loading...
Searching...
No Matches
spectral/test-filterbank.c
#include <aubio.h>
int main (void)
{
uint_t win_s = 1024; // window size
uint_t n_filters = 13; // number of filters
cvec_t *in_spec = new_cvec (win_s); // input vector of samples
fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
if (new_aubio_filterbank(0, win_s)) return 1;
if (new_aubio_filterbank(n_filters, 0)) return 1;
// create filterbank object
aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
smpl_t power = aubio_filterbank_get_power(o);
smpl_t norm = aubio_filterbank_get_norm(o);
if (aubio_filterbank_set_power(o, power)) {
return 1;
}
if (aubio_filterbank_set_norm(o, norm)) {
return 1;
}
// apply filterbank ten times
uint_t n = 10;
while (n) {
aubio_filterbank_do (o, in_spec, out_filters);
n--;
}
// print out filterbank coeffs
fmat_t *coeffs; // pointer to the coefficients
coeffs = aubio_filterbank_get_coeffs (o);
fmat_print (coeffs);
aubio_filterbank_set_coeffs (o, coeffs);
coeffs = aubio_filterbank_get_coeffs (o);
fmat_print (coeffs);
//fvec_print (out_filters);
// clean up
del_aubio_filterbank (o);
del_cvec (in_spec);
del_fvec (out_filters);
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
aubio_filterbank_set_power
uint_t aubio_filterbank_set_power(aubio_filterbank_t *f, smpl_t power)
set power parameter
aubio_filterbank_get_norm
smpl_t aubio_filterbank_get_norm(aubio_filterbank_t *f)
get norm parameter
del_aubio_filterbank
void del_aubio_filterbank(aubio_filterbank_t *f)
destroy filterbank object
aubio_filterbank_set_norm
uint_t aubio_filterbank_set_norm(aubio_filterbank_t *f, smpl_t norm)
set norm parameter
new_aubio_filterbank
aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s)
create filterbank object
aubio_filterbank_get_coeffs
fmat_t * aubio_filterbank_get_coeffs(const aubio_filterbank_t *f)
return a pointer to the matrix object containing all filter coefficients
aubio_filterbank_t
struct _aubio_filterbank_t aubio_filterbank_t
filterbank object
Definition filterbank.h:45
aubio_filterbank_set_coeffs
uint_t aubio_filterbank_set_coeffs(aubio_filterbank_t *f, const fmat_t *filters)
copy filter coefficients to the filterbank
aubio_filterbank_do
void aubio_filterbank_do(aubio_filterbank_t *f, const cvec_t *in, fvec_t *out)
compute filterbank
aubio_filterbank_get_power
smpl_t aubio_filterbank_get_power(aubio_filterbank_t *f)
get power parameter
fmat_print
void fmat_print(const fmat_t *s)
print out fmat 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
aubio_cleanup
void aubio_cleanup(void)
clean up cached memory at the end of program
cvec_t
Vector of real-valued phase and spectrum data.
Definition cvec.h:63
fmat_t
Buffer for real data.
Definition fmat.h:40
fvec_t
Buffer for real data.
Definition fvec.h:67
uint_t
unsigned int uint_t
unsigned integer
Definition types.h:60
smpl_t
float smpl_t
short sample format (32 or 64 bits)
Definition types.h:41