shithub: aubio

Download patch

ref: 845c4354cde7bc7ca3b5255a9281ff0b5117d013
parent: c0916f2911ba739e57f6f0a9b667db5ba27a7f5b
author: Paul Brossier <piem@piem.org>
date: Mon Sep 30 04:58:12 EDT 2013

tests/src/spectral/test-filterbank*: improve comments, print coeffs

--- a/tests/src/spectral/test-filterbank.c
+++ b/tests/src/spectral/test-filterbank.c
@@ -7,19 +7,25 @@
 
   cvec_t *in_spec = new_cvec (win_s); // input vector of samples
   fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
-  fmat_t *coeffs; // pointer to the coefficients
 
   // create filterbank object
   aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
 
+  // 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_do (o, in_spec, out_filters);
+  //fvec_print (out_filters);
 
-  // fmat_print (coeffs);
-  // cvec_print(in_spec);
-  // fvec_print(out_filters);
-
+  // clean up
   del_aubio_filterbank (o);
   del_cvec (in_spec);
   del_fvec (out_filters);
--- a/tests/src/spectral/test-filterbank_mel.c
+++ b/tests/src/spectral/test-filterbank_mel.c
@@ -8,7 +8,6 @@
 
   cvec_t *in_spec = new_cvec (win_s); // input vector of samples
   fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
-  fmat_t *coeffs; // pointer to the coefficients
 
   // create filterbank object
   aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
@@ -16,13 +15,19 @@
   // assign Mel-frequency coefficients
   aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
 
+  // apply filterbank ten times
+  uint_t n = 10;
+  while (n) {
+    aubio_filterbank_do (o, in_spec, out_filters);
+    n--;
+  }
+
+  // print out filter coefficients
+  fmat_t *coeffs; // pointer to the coefficients
   coeffs = aubio_filterbank_get_coeffs (o);
+  fmat_print (coeffs);
 
-  aubio_filterbank_do (o, in_spec, out_filters);
-
-  // fmat_print (coeffs);
-  // cvec_print(in_spec);
-  // fvec_print(out_filters);
+  //fvec_print (out_filters);
 
   del_aubio_filterbank (o);
   del_cvec (in_spec);