Index: tests/src/io/test-sink.c
===================================================================
--- tests/src/io/test-sink.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-sink.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,24 +1,39 @@
-#include <stdio.h>
 #include <aubio.h>
-#include "config.h"
+#include "utils_tests.h"
 
-char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
-char_t *outpath = "/var/tmp/test.wav";
+int main (int argc, char **argv)
+{
+  sint_t err = 0;
 
-int main(){
-  int err = 0;
+  if (argc < 3) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
+    return err;
+  }
+
   uint_t samplerate = 44100;
   uint_t hop_size = 512;
-  uint_t read = hop_size;
+  uint_t n_frames = 0, read = 0;
+
+  char_t *source_path = argv[1];
+  char_t *sink_path = argv[2];
+  if ( argc == 4 ) samplerate = atoi(argv[3]);
+
   fvec_t *vec = new_fvec(hop_size);
-  aubio_source_t * i = new_aubio_source(path, samplerate, hop_size);
-  aubio_sink_t *   o = new_aubio_sink(outpath, samplerate);
+  aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
+  aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
 
-  if (!i || !o) { err = -1; goto beach; }
+  if (!i || !o) { err = 1; goto beach; }
 
-  while ( read == hop_size ) {
+  do {
     aubio_source_do(i, vec, &read);
     aubio_sink_do(o, vec, read);
-  }
+    n_frames += read;
+  } while ( read == hop_size );
+
+  PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
+      n_frames, source_path, sink_path, samplerate);
 
 beach:
@@ -28,3 +43,2 @@
   return err;
 }
-
Index: tests/src/io/test-sink_apple_audio_file.c
===================================================================
--- tests/src/io/test-sink_apple_audio_file.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-sink_apple_audio_file.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,25 +1,40 @@
-#include <stdio.h>
 #include <aubio.h>
-#include "config.h"
+#include "utils_tests.h"
 
-char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
-char_t *outpath = "/var/tmp/test.wav";
+int main (int argc, char **argv)
+{
+  sint_t err = 0;
 
-int main(){
-  int err = 0;
+  if (argc < 3) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
+    return err;
+  }
+
 #ifdef __APPLE__
   uint_t samplerate = 44100;
   uint_t hop_size = 512;
-  uint_t read = hop_size;
+  uint_t n_frames = 0, read = 0;
+
+  char_t *source_path = argv[1];
+  char_t *sink_path = argv[2];
+  if ( argc == 4 ) samplerate = atoi(argv[3]);
+
   fvec_t *vec = new_fvec(hop_size);
-  aubio_source_apple_audio_t * i = new_aubio_source_apple_audio(path, samplerate, hop_size);
-  aubio_sink_apple_audio_t *   o = new_aubio_sink_apple_audio(outpath, samplerate);
+  aubio_source_apple_audio_t *i = new_aubio_source_apple_audio(source_path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(i);
+  aubio_sink_apple_audio_t *o = new_aubio_sink_apple_audio(sink_path, samplerate);
 
-  if (!i || !o) { err = -1; goto beach; }
+  if (!i || !o) { err = 1; goto beach; }
 
-  while ( read == hop_size ) {
+  do {
     aubio_source_apple_audio_do(i, vec, &read);
     aubio_sink_apple_audio_do(o, vec, read);
-  }
+    n_frames += read;
+  } while ( read == hop_size );
+
+  PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
+      n_frames, source_path, sink_path, samplerate);
 
 beach:
@@ -28,7 +43,7 @@
   del_fvec(vec);
 #else
-  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n");
+  PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
+  err = 3;
 #endif /* __APPLE__ */
   return err;
 }
-
Index: tests/src/io/test-sink_sndfile.c
===================================================================
--- tests/src/io/test-sink_sndfile.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-sink_sndfile.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,25 +1,40 @@
-#include <stdio.h>
 #include <aubio.h>
-#include "config.h"
+#include "utils_tests.h"
 
-char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
-char_t *outpath = "/var/tmp/test.wav";
+int main (int argc, char **argv)
+{
+  sint_t err = 0;
 
-int main(){
-  int err = 0;
+  if (argc < 3) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
+    return err;
+  }
+
 #ifdef HAVE_SNDFILE
   uint_t samplerate = 44100;
   uint_t hop_size = 512;
-  uint_t read = hop_size;
+  uint_t n_frames = 0, read = 0;
+
+  char_t *source_path = argv[1];
+  char_t *sink_path = argv[2];
+  if ( argc == 4 ) samplerate = atoi(argv[3]);
+
   fvec_t *vec = new_fvec(hop_size);
   aubio_source_sndfile_t * i = new_aubio_source_sndfile(path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(i);
   aubio_sink_sndfile_t *   o = new_aubio_sink_sndfile(outpath, samplerate);
 
-  if (!i || !o) { err = -1; goto beach; }
+  if (!i || !o) { err = 1; goto beach; }
 
-  while ( read == hop_size ) {
+  do {
     aubio_source_sndfile_do(i, vec, &read);
     aubio_sink_sndfile_do(o, vec, read);
-  }
+    n_frames += read;
+  } while ( read == hop_size );
+
+  PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
+      n_frames, source_path, sink_path, samplerate);
 
 beach:
@@ -28,7 +43,7 @@
   del_fvec(vec);
 #else
-  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
+  PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
+  err = 3;
 #endif /* HAVE_SNDFILE */
   return err;
 }
-
Index: tests/src/io/test-source.c
===================================================================
--- tests/src/io/test-source.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-source.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,25 +1,38 @@
-#include <stdio.h>
 #include <aubio.h>
+#include "utils_tests.h"
 
-char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
-//char_t *path = "/Users/piem/Downloads/Keziah Jones - Where's Life.mp3";
-
-int main(){
-  uint_t samplerate = 32000;
-  uint_t hop_size = 1024;
-  uint_t read = hop_size;
-  fvec_t *vec = new_fvec(hop_size);
-  aubio_source_t* s = new_aubio_source(path, samplerate, hop_size);
-
-  if (!s) return -1;
-
-  while ( read == hop_size ) {
-    aubio_source_do(s, vec, &read);
-    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
+int main (int argc, char **argv)
+{
+  uint_t err = 0;
+  if (argc < 2) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
+    return err;
   }
 
-  del_aubio_source(s);
+  uint_t samplerate = 32000;
+  uint_t hop_size = 256;
+  uint_t n_frames = 0, read = 0;
+  if ( argc == 3 ) samplerate = atoi(argv[2]);
 
-  return 0;
+  char_t *source_path = argv[1];
+
+  fvec_t *vec = new_fvec(hop_size);
+  aubio_source_t* s = new_aubio_source(source_path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(s);
+
+  if (!s) { err = 1; goto beach; }
+
+  do {
+    aubio_source_do(s, vec, &read);
+    // fvec_print (vec);
+    n_frames += read;
+  } while ( read == hop_size );
+
+beach:
+  del_aubio_source (s);
+  del_fvec (vec);
+
+  return err;
 }
-
Index: tests/src/io/test-source_apple_audio_file.c
===================================================================
--- tests/src/io/test-source_apple_audio_file.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-source_apple_audio_file.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,28 +1,42 @@
-#include <stdio.h>
 #include <aubio.h>
+#include "utils_tests.h"
 
-char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
-//char_t *path = "/Volumes/moving/moving/photos/gopro2/100GOPRO/GOPR4515.MP4";
-
-int main(){
-#ifdef __APPLE__
-  uint_t samplerate = 32000;
-  uint_t hop_size = 1024;
-  uint_t read = hop_size;
-  fvec_t *vec = new_fvec(hop_size);
-  aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(path, samplerate, hop_size);
-
-  if (!s) return -1;
-
-  while ( read == hop_size ) {
-    aubio_source_apple_audio_do(s, vec, &read);
-    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
+int main (int argc, char **argv)
+{
+  uint_t err = 0;
+  if (argc < 2) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
+    return err;
   }
 
-  del_aubio_source_apple_audio(s);
+#if __APPLE__
+  uint_t samplerate = 32000;
+  uint_t hop_size = 256;
+  uint_t n_frames = 0, read = 0;
+  if ( argc == 3 ) samplerate = atoi(argv[2]);
+
+  char_t *source_path = argv[1];
+
+  fvec_t *vec = new_fvec(hop_size);
+  aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(source_path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(s);
+
+  if (!s) { err = 1; goto beach; }
+
+  do {
+    aubio_source_apple_audio_do(s, vec, &read);
+    // fvec_print (vec);
+    n_frames += read;
+  } while ( read == hop_size );
+
+beach:
+  del_aubio_source_apple_audio (s);
+  del_fvec (vec);
 #else
-  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n");
+  err = 3;
+  PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n");
 #endif /* __APPLE__ */
   return 0;
 }
-
Index: tests/src/io/test-source_sndfile.c
===================================================================
--- tests/src/io/test-source_sndfile.c	(revision 2ea7a108d91de6bd75f86af5b8db8098c81422b2)
+++ tests/src/io/test-source_sndfile.c	(revision 2fcb973a2801265dc319ce25a663133fbc175aae)
@@ -1,33 +1,42 @@
-#include <stdio.h>
 #include <aubio.h>
-#include "config.h"
+#include "utils_tests.h"
 
-char_t *path = "/home/piem/archives/samples/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
+int main (int argc, char **argv)
+{
+  uint_t err = 0;
+  if (argc < 2) {
+    err = 2;
+    PRINT_ERR("not enough arguments\n");
+    PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
+    return err;
+  }
 
-int main(){
-  int err = 0;
 #ifdef HAVE_SNDFILE
-  uint_t samplerate = 8000;
-  uint_t hop_size = 512;
-  uint_t read = hop_size;
+  uint_t samplerate = 32000;
+  uint_t hop_size = 256;
+  uint_t n_frames = 0, read = 0;
+  if ( argc == 3 ) samplerate = atoi(argv[2]);
+
+  char_t *source_path = argv[1];
+
   fvec_t *vec = new_fvec(hop_size);
-  aubio_source_sndfile_t * s = new_aubio_source_sndfile(path, samplerate, hop_size);
+  aubio_source_sndfile_t * s = new_aubio_source_sndfile(source_path, samplerate, hop_size);
+  if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(s);
 
   if (!s) { err = 1; goto beach; }
 
-  while ( read == hop_size ) {
+  do {
     aubio_source_sndfile_do(s, vec, &read);
-    if (read == 0) break;
-    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
-  }
+    // fvec_print (vec);
+    n_frames += read;
+  } while ( read == hop_size );
 
 beach:
-  del_aubio_source_sndfile(s);
-  del_fvec(vec);
+  del_aubio_source_sndfile (s);
+  del_fvec (vec);
 #else
-  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
+  PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
   err = 2;
 #endif /* HAVE_SNDFILE */
   return err;
 }
-
