shithub: aubio

Download patch

ref: 3684ab46aec73be1c65fd8d989dec0f02492009a
parent: 954724740c9d378ea1974c59a6b2f0870a66931e
author: Paul Brossier <piem@piem.org>
date: Sun Mar 3 08:40:05 EST 2013

tests/src/temporal/: improve examples

--- a/tests/src/temporal/test-a_weighting.c
+++ b/tests/src/temporal/test-a_weighting.c
@@ -1,6 +1,7 @@
 #include <aubio.h>
 
-int main(){
+int main ()
+{
   
   aubio_filter_t * f;
 
--- a/tests/src/temporal/test-biquad.c
+++ b/tests/src/temporal/test-biquad.c
@@ -1,6 +1,7 @@
 #include <aubio.h>
 
-int main () {
+int main ()
+{
   uint_t win_s = 64; // window size
 
   // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2`
--- a/tests/src/temporal/test-c_weighting.c
+++ b/tests/src/temporal/test-c_weighting.c
@@ -1,7 +1,7 @@
 #include <aubio.h>
 
-int main(){
-  
+int main ()
+{
   aubio_filter_t * f;
 
   uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
--- a/tests/src/temporal/test-filter.c
+++ b/tests/src/temporal/test-filter.c
@@ -1,14 +1,11 @@
 #include <aubio.h>
 
-int
-main (void)
+int main ()
 {
-  /* allocate some memory */
-  uint_t win_s = 32;            /* window size */
-  fvec_t *in = new_fvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (win_s);     /* input buffer */
+  uint_t win_s = 32; // window size
+  fvec_t *in = new_fvec (win_s); // input buffer
+  fvec_t *out = new_fvec (win_s); // input buffer
 
-
   aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
   in->data[12] = 0.5;
   fvec_print (in);
@@ -16,22 +13,21 @@
   fvec_print (in);
   del_aubio_filter (o);
 
-  o = new_aubio_filter_c_weighting (44100);
+  o = new_aubio_filter_a_weighting (32000);
   in->data[12] = 0.5;
   fvec_print (in);
   aubio_filter_do_outplace (o, in, out);
   fvec_print (out);
-  del_aubio_filter (o);
 
-  o = new_aubio_filter_c_weighting (44100);
+  aubio_filter_set_a_weighting (o, 32000);
   in->data[12] = 0.5;
   fvec_print (in);
   aubio_filter_do_filtfilt (o, in, out);
   fvec_print (out);
-  del_aubio_filter (o);
 
   del_fvec (in);
   del_fvec (out);
+  del_aubio_filter (o);
   aubio_cleanup ();
 
   return 0;
--- a/tests/src/temporal/test-resampler.c
+++ b/tests/src/temporal/test-resampler.c
@@ -1,14 +1,11 @@
-#include <stdio.h>
 #include <aubio.h>
 
-int
-main ()
+int main ()
 {
-  /* allocate some memory */
-  uint_t win_s = 1024;          /* window size */
+  uint_t win_s = 1024; // window size
   smpl_t ratio = 0.5;
-  fvec_t *in = new_fvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec ((uint_t) (win_s * ratio));  /* input buffer */
+  fvec_t *in = new_fvec (win_s); // input buffer
+  fvec_t *out = new_fvec ((uint_t) (win_s * ratio)); // output buffer
   aubio_resampler_t *o = new_aubio_resampler (0.5, 0);
   uint_t i = 0;