Loading...
Searching...
No Matches
temporal/test-filter.c
#include <aubio.h>
int main (void)
{
uint_t win_s = 16; // window size
uint_t impulse_at = win_s / 2;
fvec_t *in = new_fvec (win_s); // input buffer
fvec_t *out = new_fvec (win_s); // input buffer
aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
if (new_aubio_filter(0)) return 1;
if (aubio_filter_get_samplerate(o) != 44100) return 1;
if (aubio_filter_set_c_weighting (o, -1) == 0) return 1;
if (aubio_filter_set_c_weighting (0, 32000) == 0) return 1;
in->data[impulse_at] = 0.5;
fvec_print (in);
aubio_filter_do (o, in);
fvec_print (in);
del_aubio_filter (o);
o = new_aubio_filter_a_weighting (32000);
if (aubio_filter_set_a_weighting (o, -1) == 0) return 1;
if (aubio_filter_set_a_weighting (0, 32000) == 0) return 1;
in->data[impulse_at] = 0.5;
fvec_print (in);
aubio_filter_do_outplace (o, in, out);
fvec_print (out);
aubio_filter_set_a_weighting (o, 32000);
in->data[impulse_at] = 0.5;
fvec_print (in);
aubio_filter_do_filtfilt (o, in, out);
fvec_print (out);
del_fvec (in);
del_fvec (out);
del_aubio_filter (o);
aubio_cleanup ();
return 0;
}
new_aubio_filter_a_weighting
aubio_filter_t * new_aubio_filter_a_weighting(uint_t samplerate)
create new A-design filter
aubio_filter_set_a_weighting
uint_t aubio_filter_set_a_weighting(aubio_filter_t *f, uint_t samplerate)
set feedback and feedforward coefficients of a A-weighting filter
aubio.h
Global aubio include file.
aubio_filter_set_c_weighting
uint_t aubio_filter_set_c_weighting(aubio_filter_t *f, uint_t samplerate)
set feedback and feedforward coefficients of a C-weighting filter
new_aubio_filter_c_weighting
aubio_filter_t * new_aubio_filter_c_weighting(uint_t samplerate)
create new C-design filter
new_aubio_filter
aubio_filter_t * new_aubio_filter(uint_t order)
create new filter object
aubio_filter_t
struct _aubio_filter_t aubio_filter_t
Digital filter.
Definition filter.h:72
del_aubio_filter
void del_aubio_filter(aubio_filter_t *f)
delete a filter object
aubio_filter_get_samplerate
uint_t aubio_filter_get_samplerate(const aubio_filter_t *f)
get sampling rate of the filter
aubio_filter_do
void aubio_filter_do(aubio_filter_t *f, fvec_t *in)
filter input vector (in-place)
aubio_filter_do_filtfilt
void aubio_filter_do_filtfilt(aubio_filter_t *f, fvec_t *in, fvec_t *tmp)
filter input vector forward and backward
aubio_filter_do_outplace
void aubio_filter_do_outplace(aubio_filter_t *f, const fvec_t *in, fvec_t *out)
filter input vector (out-of-place)
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
aubio_cleanup
void aubio_cleanup(void)
clean up cached memory at the end of program
fvec_t
Buffer for real data.
Definition fvec.h:67
fvec_t::data
smpl_t * data
data vector of length fvec_t.length
Definition fvec.h:69
uint_t
unsigned int uint_t
unsigned integer
Definition types.h:60