summaryrefslogtreecommitdiff
path: root/tests/src/spectral/test-mfcc.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/spectral/test-mfcc.c')
-rw-r--r--tests/src/spectral/test-mfcc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/src/spectral/test-mfcc.c b/tests/src/spectral/test-mfcc.c
new file mode 100644
index 0000000..23f8c64
--- /dev/null
+++ b/tests/src/spectral/test-mfcc.c
@@ -0,0 +1,30 @@
+#include <aubio.h>
+
+int main (void)
+{
+ uint_t win_s = 512; // fft size
+ uint_t n_filters = 40; // number of filters
+ uint_t n_coefs = 13; // number of coefficients
+ smpl_t samplerate = 16000.; // samplerate
+ cvec_t *in = new_cvec (win_s); // input buffer
+ fvec_t *out = new_fvec (n_coefs); // output coefficients
+
+ // create mfcc object
+ aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
+
+ cvec_norm_set_all (in, 1.);
+ aubio_mfcc_do (o, in, out);
+ fvec_print (out);
+
+ cvec_norm_set_all (in, .5);
+ aubio_mfcc_do (o, in, out);
+ fvec_print (out);
+
+ // clean up
+ del_aubio_mfcc (o);
+ del_cvec (in);
+ del_fvec (out);
+ aubio_cleanup ();
+
+ return 0;
+}