From afc584dbbf8362a23c7f6295c15aa5a19bb06f59 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 17 Sep 2009 14:37:26 +0200 Subject: [PATCH] tests/src/test-filterbank_mel.c: added filterbank_mel test --- tests/src/test-filterbank_mel.c | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/src/test-filterbank_mel.c diff --git a/tests/src/test-filterbank_mel.c b/tests/src/test-filterbank_mel.c new file mode 100644 index 00000000..d1aaae3b --- /dev/null +++ b/tests/src/test-filterbank_mel.c @@ -0,0 +1,38 @@ +#include + +int +main (void) +{ + /* allocate some memory */ + uint_t win_s = 512; /* fft size */ + uint_t channels = 2; /* number of channel */ + uint_t n_filters = 40; /* number of filters */ + cvec_t *in = new_cvec (win_s, channels); /* input buffer */ + fvec_t *out = new_fvec (win_s, channels); /* input buffer */ + fvec_t *coeffs = NULL; + smpl_t samplerate = 16000.; + + /* allocate fft and other memory space */ + aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); + + /* assign Mel-frequency coefficients */ + aubio_filterbank_set_mel_coeffs_slaney (o, samplerate); + + coeffs = aubio_filterbank_get_coeffs (o); + if (coeffs == NULL) { + return -1; + } + + //fvec_print (coeffs); + + fprintf(stderr, "%f\n", vec_sum(coeffs)); + + aubio_filterbank_do (o, in, out); + + del_aubio_filterbank (o); + del_cvec (in); + del_fvec (out); + aubio_cleanup (); + + return 0; +} -- 2.26.2