tests/src/spectral/test-filterbank*: improve comments, print coeffs
authorPaul Brossier <piem@piem.org>
Mon, 30 Sep 2013 13:58:12 +0000 (08:58 -0500)
committerPaul Brossier <piem@piem.org>
Mon, 30 Sep 2013 15:18:50 +0000 (18:18 +0300)
tests/src/spectral/test-filterbank.c
tests/src/spectral/test-filterbank_mel.c

index 679e6cd..3817f13 100644 (file)
@@ -7,19 +7,25 @@ int main ()
 
   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);
 
-  coeffs = aubio_filterbank_get_coeffs (o);
+  // apply filterbank ten times
+  uint_t n = 10;
+  while (n) {
+    aubio_filterbank_do (o, in_spec, out_filters);
+    n--;
+  }
 
-  aubio_filterbank_do (o, in_spec, out_filters);
+  // print out filterbank coeffs
+  fmat_t *coeffs; // pointer to the coefficients
+  coeffs = aubio_filterbank_get_coeffs (o);
+  fmat_print (coeffs);
 
-  // fmat_print (coeffs);
-  // cvec_print(in_spec);
-  // fvec_print(out_filters);
+  //fvec_print (out_filters);
 
+  // clean up
   del_aubio_filterbank (o);
   del_cvec (in_spec);
   del_fvec (out_filters);
index 89f6e77..23e402e 100644 (file)
@@ -8,7 +8,6 @@ int main ()
 
   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 @@ int main ()
   // assign Mel-frequency coefficients
   aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
 
-  coeffs = aubio_filterbank_get_coeffs (o);
+  // apply filterbank ten times
+  uint_t n = 10;
+  while (n) {
+    aubio_filterbank_do (o, in_spec, out_filters);
+    n--;
+  }
 
-  aubio_filterbank_do (o, in_spec, out_filters);
+  // print out filter coefficients
+  fmat_t *coeffs; // pointer to the coefficients
+  coeffs = aubio_filterbank_get_coeffs (o);
+  fmat_print (coeffs);
 
-  // fmat_print (coeffs);
-  // cvec_print(in_spec);
-  // fvec_print(out_filters);
+  //fvec_print (out_filters);
 
   del_aubio_filterbank (o);
   del_cvec (in_spec);