From: Paul Brossier Date: Thu, 17 Sep 2009 18:07:24 +0000 (+0200) Subject: test-mfcc.c: add simple mfcc test X-Git-Tag: bzr2git~337 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0028ea752412e315d750936b4c0c7bc102ef93af;p=aubio.git test-mfcc.c: add simple mfcc test --- diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am index f97d33b5..e40f739c 100644 --- a/tests/src/Makefile.am +++ b/tests/src/Makefile.am @@ -18,6 +18,7 @@ bin_PROGRAMS = \ test-phasevoc \ test-filterbank \ test-filterbank_mel \ + test-mfcc \ test-phasevoc-jack \ test-onsetdetection \ test-pitchyin \ diff --git a/tests/src/test-mfcc.c b/tests/src/test-mfcc.c new file mode 100644 index 00000000..474db96b --- /dev/null +++ b/tests/src/test-mfcc.c @@ -0,0 +1,33 @@ +#include + +int +main (void) +{ + /* allocate some memory */ + uint_t win_s = 512; /* fft size */ + uint_t channels = 1; /* number of channel */ + uint_t n_filters = 40; /* number of filters */ + uint_t n_coefs = 13; /* number of coefficients */ + cvec_t *in = new_cvec (win_s, channels); /* input buffer */ + fvec_t *out = new_fvec (n_coefs, channels); /* input buffer */ + smpl_t samplerate = 16000.; + uint_t i = 0; + + /* allocate fft and other memory space */ + aubio_mfcc_t *o = new_aubio_mfcc (win_s, samplerate, n_filters, n_coefs); + + for (i = 0; i < in->length; i ++) { + in->norm[0][i] = 1.; + } + + aubio_mfcc_do (o, in, out); + + fvec_print (out); + + del_aubio_mfcc (o); + del_cvec (in); + del_fvec (out); + aubio_cleanup (); + + return 0; +}