Index: examples/aubiomfcc.c
===================================================================
--- examples/aubiomfcc.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubiomfcc.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -22,72 +22,45 @@
 #include "parse_args.h"
 
-/* mfcc objects */
-fvec_t * mfcc_out;
-aubio_mfcc_t * mfcc;
-aubio_pvoc_t *pv;
-cvec_t *fftgrain;
+aubio_pvoc_t *pv;    // a phase vocoder
+cvec_t *fftgrain;    // outputs a spectrum
+aubio_mfcc_t * mfcc; // which the mfcc will process
+fvec_t * mfcc_out;   // to get the output coefficients
 
 uint_t n_filters = 40;
 uint_t n_coefs = 13;
 
-unsigned int pos = 0; /*frames%dspblocksize*/
-
-static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
-    }
-    /*time for fft*/
-    if (pos == overlap_size-1) {         
-      /* block loop */
-      
-      //compute mag spectrum
-      aubio_pvoc_do (pv, ibuf, fftgrain);
-     
-      //compute mfccs
-      aubio_mfcc_do(mfcc, fftgrain, mfcc_out);
-      
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
-  }
-  return 1;
+static void
+process_block(fvec_t *ibuf, fvec_t *obuf) {
+  fvec_zeros(obuf);
+  //compute mag spectrum
+  aubio_pvoc_do (pv, ibuf, fftgrain);
+  //compute mfccs
+  aubio_mfcc_do(mfcc, fftgrain, mfcc_out);
 }
 
 static void process_print (void) {
   /* output times in seconds and extracted mfccs */
-  if (sink_uri == NULL) {
-    outmsg("%f\t",frames*overlap_size/(float)samplerate);
-    fvec_print(mfcc_out);
-  }
+  outmsg("%f\t",blocks*hop_size/(float)samplerate);
+  fvec_print(mfcc_out);
 }
 
 int main(int argc, char **argv) {
-  // params
+  // change some default params
   buffer_size  = 512;
-  overlap_size = 256;
-  
+  hop_size = 256;
+
   examples_common_init(argc,argv);
 
-  /* phase vocoder */
-  pv = new_aubio_pvoc (buffer_size, overlap_size);
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d\n", hop_size);
 
+  pv = new_aubio_pvoc (buffer_size, hop_size);
   fftgrain = new_cvec (buffer_size);
+  mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate);
+  mfcc_out = new_fvec(n_coefs);
 
-  //populating the filter
-  mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate);
-  
-  mfcc_out = new_fvec(n_coefs);
-  
-  //process
-  examples_common_process(aubio_process,process_print);
-  
-  //destroying mfcc 
+  examples_common_process((aubio_process_func_t)process_block, process_print);
+
   del_aubio_pvoc (pv);
   del_cvec (fftgrain);
@@ -96,7 +69,4 @@
 
   examples_common_del();
-  debug("End of program.\n");
-  fflush(stderr);
-  
   return 0;
 }
Index: examples/aubionotes.c
===================================================================
--- examples/aubionotes.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubionotes.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -25,21 +25,14 @@
 #include "parse_args.h"
 
-/* pitch objects */
-smpl_t pitch = 0.;
+uint_t median = 6;
 
-uint_t median = 6;
-smpl_t curlevel = 0.;
-
-aubio_pitch_t *pitchdet;
-
-fvec_t *note_buffer = NULL;
-fvec_t *note_buffer2 = NULL;
+fvec_t *note_buffer;
+fvec_t *note_buffer2;
 
 smpl_t curnote = 0.;
 smpl_t newnote = 0.;
 uint_t isready = 0;
-unsigned int pos = 0; /*frames%dspblocksize*/
 
-aubio_pitch_t *pitchdet;
+aubio_pitch_t *pitch;
 aubio_onset_t *o;
 fvec_t *onset;
@@ -51,76 +44,56 @@
 uint_t get_note (fvec_t * note_buffer, fvec_t * note_buffer2);
 
-static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
+static void
+process_block(fvec_t *ibuf, fvec_t *obuf) {
+  fvec_zeros(obuf);
+  aubio_onset_do(o, ibuf, onset);
+
+  aubio_pitch_do (pitch, ibuf, pitch_obuf);
+  smpl_t new_pitch = fvec_read_sample(pitch_obuf, 0);
+  if(median){
+    note_append(note_buffer, new_pitch);
+  }
+
+  /* curlevel is negatif or 1 if silence */
+  smpl_t curlevel = aubio_level_detection(ibuf, silence);
+  if (fvec_read_sample(onset, 0)) {
+    /* test for silence */
+    if (curlevel == 1.) {
+      if (median) isready = 0;
+      /* send note off */
+      send_noteon(curnote,0);
+    } else {
+      if (median) {
+        isready = 1;
+      } else {
+        /* kill old note */
+        send_noteon(curnote,0);
+        /* get and send new one */
+        send_noteon(new_pitch,127+(int)floor(curlevel));
+        curnote = new_pitch;
+      }
     }
-    /*time for fft*/
-    if (pos == overlap_size-1) {         
-      /* block loop */
-      aubio_onset_do(o, ibuf, onset);
-      
-      aubio_pitch_do (pitchdet, ibuf, pitch_obuf);
-      pitch = fvec_read_sample(pitch_obuf, 0);
-      if(median){
-              note_append(note_buffer, pitch);
+  } else {
+    if (median) {
+      if (isready > 0)
+        isready++;
+      if (isready == median)
+      {
+        /* kill old note */
+        send_noteon(curnote,0);
+        newnote = get_note(note_buffer, note_buffer2);
+        curnote = newnote;
+        /* get and send new one */
+        if (curnote>45){
+          send_noteon(curnote,127+(int)floor(curlevel));
+        }
       }
-
-      /* curlevel is negatif or 1 if silence */
-      curlevel = aubio_level_detection(ibuf, silence);
-      if (fvec_read_sample(onset, 0)) {
-              /* test for silence */
-              if (curlevel == 1.) {
-                      if (median) isready = 0;
-                      /* send note off */
-                      send_noteon(curnote,0);
-              } else {
-                      if (median) {
-                              isready = 1;
-                      } else {
-                              /* kill old note */
-                              send_noteon(curnote,0);
-                              /* get and send new one */
-                              send_noteon(pitch,127+(int)floor(curlevel));
-                              curnote = pitch;
-                      }
-
-                      for (pos = 0; pos < overlap_size; pos++){
-                              //obuf->data[pos] = woodblock->data[pos];
-                      }
-              }
-      } else {
-              if (median) {
-                      if (isready > 0)
-                              isready++;
-                      if (isready == median)
-                      {
-                              /* kill old note */
-                              send_noteon(curnote,0);
-                              newnote = get_note(note_buffer, note_buffer2);
-                              curnote = newnote;
-                              /* get and send new one */
-                              if (curnote>45){
-                                      send_noteon(curnote,127+(int)floor(curlevel));
-                              }
-                      }
-              } // if median
-        for (pos = 0; pos < overlap_size; pos++)
-          obuf->data[pos] = 0.;
-      }
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
+    } // if median
   }
-  return 1;
 }
 
-static void process_print (void) {
-      if (verbose) outmsg("%f\n",pitch);
+static void
+process_print (void) {
+  //if (verbose) outmsg("%f\n",pitch_obuf->data[0]);
 }
 
@@ -149,12 +122,24 @@
   examples_common_init(argc,argv);
 
-  o = new_aubio_onset (onset_method, buffer_size, overlap_size, samplerate);
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+
+  verbmsg ("onset method: %s, ", onset_method);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d, ", hop_size);
+  verbmsg ("threshold: %f\n", onset_threshold);
+
+  verbmsg ("pitch method: %s, ", pitch_method);
+  verbmsg ("buffer_size: %d, ", buffer_size * 4);
+  verbmsg ("hop_size: %d, ", hop_size);
+  verbmsg ("tolerance: %f\n", pitch_tolerance);
+
+  o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
   if (onset_threshold != 0.) aubio_onset_set_threshold (o, onset_threshold);
   onset = new_fvec (1);
 
-  pitchdet = new_aubio_pitch (pitch_method, buffer_size * 4,
-          overlap_size, samplerate);
-  aubio_pitch_set_tolerance (pitchdet, 0.7);
+  pitch = new_aubio_pitch (pitch_method, buffer_size * 4, hop_size, samplerate);
+  if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (pitch, pitch_tolerance);
   pitch_obuf = new_fvec (1);
+
   if (median) {
       note_buffer = new_fvec (median);
@@ -162,8 +147,10 @@
   }
 
-  examples_common_process(aubio_process, process_print);
+  examples_common_process((aubio_process_func_t)process_block, process_print);
 
+  // send a last note off
   send_noteon (curnote, 0);
-  del_aubio_pitch (pitchdet);
+
+  del_aubio_pitch (pitch);
   if (median) {
       del_fvec (note_buffer);
@@ -173,6 +160,4 @@
 
   examples_common_del();
-  debug("End of program.\n");
-  fflush(stderr);
   return 0;
 }
Index: examples/aubioonset.c
===================================================================
--- examples/aubioonset.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubioonset.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -20,8 +20,6 @@
 
 #include "utils.h"
-#define PROG_HAS_ONSET
+#define PROG_HAS_ONSET 1
 #include "parse_args.h"
-
-uint_t pos = 0; /*frames%dspblocksize*/
 
 aubio_onset_t *o;
@@ -29,39 +27,19 @@
 fvec_t *onset;
 
-static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
-    }
-    /*time for fft*/
-    if (pos == overlap_size-1) {
-      /* block loop */
-      fvec_zeros(obuf);
-      aubio_onset_do (o, ibuf, onset);
-      if ( fvec_read_sample(onset, 0) ) {
-        aubio_wavetable_play ( wavetable );
-      } else {
-        aubio_wavetable_stop ( wavetable );
-      }
-      aubio_wavetable_do (wavetable, obuf, obuf);
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
+void
+process_block(fvec_t *ibuf, fvec_t *obuf) {
+  fvec_zeros(obuf);
+  aubio_onset_do (o, ibuf, onset);
+  if ( fvec_read_sample(onset, 0) ) {
+    aubio_wavetable_play ( wavetable );
+  } else {
+    aubio_wavetable_stop ( wavetable );
   }
-  return 1;
+  aubio_wavetable_do (wavetable, obuf, obuf);
 }
 
-static void
+void
 process_print (void)
 {
-  /* output times in seconds, taking back some delay to ensure the label is
-   * _before_ the actual onset */
-  if (!verbose && usejack)
-    return;
   smpl_t onset_found = fvec_read_sample (onset, 0);
   if (onset_found) {
@@ -73,13 +51,19 @@
   examples_common_init(argc,argv);
 
-  o = new_aubio_onset (onset_method, buffer_size, overlap_size, samplerate);
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+  verbmsg ("onset method: %s, ", onset_method);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d, ", hop_size);
+  verbmsg ("threshold: %f\n", onset_threshold);
+
+  o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
   if (onset_threshold != 0.) aubio_onset_set_threshold (o, onset_threshold);
   onset = new_fvec (1);
 
-  wavetable = new_aubio_wavetable (samplerate, overlap_size);
+  wavetable = new_aubio_wavetable (samplerate, hop_size);
   aubio_wavetable_set_freq ( wavetable, 2450.);
   //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");
 
-  examples_common_process(aubio_process,process_print);
+  examples_common_process((aubio_process_func_t)process_block, process_print);
 
   del_aubio_onset (o);
@@ -88,7 +72,4 @@
 
   examples_common_del();
-  debug("End of program.\n");
-  fflush(stderr);
   return 0;
 }
-
Index: examples/aubiopitch.c
===================================================================
--- examples/aubiopitch.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubiopitch.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -23,44 +23,27 @@
 #include "parse_args.h"
 
-unsigned int pos = 0; /*frames%dspblocksize*/
-
 aubio_pitch_t *o;
 aubio_wavetable_t *wavetable;
 fvec_t *pitch;
 
-static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
-    }
-    /*time for fft*/
-    if (pos == overlap_size-1) {         
-      /* block loop */
-      aubio_pitch_do (o, ibuf, pitch);
-      smpl_t freq = fvec_read_sample(pitch, 0);
-      aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
-      if (freq != 0.0) {
-        aubio_wavetable_set_freq ( wavetable, freq );
-      } else {
-        aubio_wavetable_set_freq ( wavetable, 0.0 );
-      }
-      aubio_wavetable_do (wavetable, obuf, obuf);
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
+void
+process_block(fvec_t * ibuf, fvec_t * obuf) {
+  fvec_zeros(obuf);
+  aubio_pitch_do (o, ibuf, pitch);
+  smpl_t freq = fvec_read_sample(pitch, 0);
+  aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
+  if (freq != 0.0) {
+    aubio_wavetable_set_freq ( wavetable, freq );
+  } else {
+    aubio_wavetable_set_freq ( wavetable, 0.0 );
   }
-  return 1;
+  aubio_wavetable_do (wavetable, obuf, obuf);
 }
 
-static void process_print (void) {
-      if (!verbose && usejack) return;
-      smpl_t pitch_found = fvec_read_sample(pitch, 0);
-      outmsg("%f %f\n",(frames) 
-              *overlap_size/(float)samplerate, pitch_found);
+void
+process_print (void) {
+  smpl_t pitch_found = fvec_read_sample(pitch, 0);
+  outmsg("%f %f\n",(blocks)
+      *hop_size/(float)samplerate, pitch_found);
 }
 
@@ -68,11 +51,18 @@
   examples_common_init(argc,argv);
 
-  o = new_aubio_pitch (pitch_method, buffer_size, overlap_size, samplerate);
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+  verbmsg ("pitch method: %s, ", pitch_method);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d, ", hop_size);
+  verbmsg ("tolerance: %f\n", pitch_tolerance);
+
+  o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
+  if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance);
   pitch = new_fvec (1);
 
-  wavetable = new_aubio_wavetable (samplerate, overlap_size);
+  wavetable = new_aubio_wavetable (samplerate, hop_size);
   aubio_wavetable_play ( wavetable );
 
-  examples_common_process(aubio_process,process_print);
+  examples_common_process((aubio_process_func_t)process_block,process_print);
 
   del_aubio_pitch (o);
@@ -81,6 +71,4 @@
 
   examples_common_del();
-  debug("End of program.\n");
-  fflush(stderr);
   return 0;
 }
Index: examples/aubioquiet.c
===================================================================
--- examples/aubioquiet.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubioquiet.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -22,52 +22,35 @@
 #include "parse_args.h"
 
-unsigned int pos = 0; /*frames%dspblocksize*/
 sint_t wassilence = 1, issilence;
 
-int aubio_process(smpl_t **input, smpl_t **output, int nframes);
-int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
-    }
-    /*time for fft*/
-    if (pos == overlap_size-1) {         
-      /* test for silence */
-      if (aubio_silence_detection(ibuf, silence)==1) {
-        if (wassilence==1) issilence = 1;
-        else issilence = 2;
-        wassilence=1;
-      } else { 
-        if (wassilence<=0) issilence = 0;
-        else issilence = -1;
-        wassilence=0;
-      }
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
+void process_block(fvec_t * ibuf, fvec_t * obuf) {
+  fvec_zeros (obuf);
+  if (aubio_silence_detection(ibuf, silence)==1) {
+    if (wassilence==1) issilence = 1;
+    else issilence = 2;
+    wassilence=1;
+  } else {
+    if (wassilence<=0) issilence = 0;
+    else issilence = -1;
+    wassilence=0;
   }
-  return 1;
 }
 
 static void process_print (void) {
-      int curframes = (frames - 4) > 0 ? frames -4 : 0;
-      if (issilence == -1) {
-          outmsg("NOISY: %f\n",curframes*overlap_size/(float)samplerate);
-      } else if (issilence == 2) { 
-          outmsg("QUIET: %f\n",curframes*overlap_size/(float)samplerate);
-      }
+  int curblocks = (blocks - 4) > 0 ? blocks - 4 : 0;
+  if (issilence == -1) {
+    outmsg("NOISY: %f\n",curblocks*hop_size/(float)samplerate);
+  } else if (issilence == 2) {
+    outmsg("QUIET: %f\n",curblocks*hop_size/(float)samplerate);
+  }
 }
 
 int main(int argc, char **argv) {
   examples_common_init(argc,argv);
-  examples_common_process(aubio_process,process_print);
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d\n", hop_size);
+  examples_common_process((aubio_process_func_t)process_block,process_print);
   examples_common_del();
-  debug("End of program.\n");
-  fflush(stderr);
   return 0;
 }
Index: examples/aubiotrack.c
===================================================================
--- examples/aubiotrack.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/aubiotrack.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -23,78 +23,60 @@
 #include "parse_args.h"
 
-uint_t pos = 0;    /* frames%dspblocksize */
-aubio_tempo_t * bt = NULL;
+aubio_tempo_t * tempo;
 aubio_wavetable_t *wavetable;
-fvec_t * tempo_out = NULL;
+fvec_t * tempo_out;
 smpl_t istactus = 0;
 smpl_t isonset = 0;
 
-static int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
-  unsigned int j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    if(usejack) {
-      /* write input to datanew */
-      fvec_write_sample(ibuf, input[0][j], pos);
-      /* put synthnew in output */
-      output[0][j] = fvec_read_sample(obuf, pos);
-    }
-    /*time for fft*/
-    if (pos == overlap_size-1) {
-      /* block loop */
-      aubio_tempo_do (bt,ibuf,tempo_out);
-      istactus = fvec_read_sample (tempo_out, 0);
-      isonset = fvec_read_sample (tempo_out, 1);
-      fvec_zeros (obuf);
-      if (istactus > 0.) {
-        aubio_wavetable_play ( wavetable );
-      } else {
-        aubio_wavetable_stop ( wavetable );
-      }
-      aubio_wavetable_do (wavetable, obuf, obuf);
-      /* end of block loop */
-      pos = -1; /* so it will be zero next j loop */
-    }
-    pos++;
+void process_block(fvec_t * ibuf, fvec_t *obuf) {
+  aubio_tempo_do (tempo, ibuf, tempo_out);
+  istactus = fvec_read_sample (tempo_out, 0);
+  isonset = fvec_read_sample (tempo_out, 1);
+  fvec_zeros (obuf);
+  if (istactus > 0.) {
+    aubio_wavetable_play ( wavetable );
+  } else {
+    aubio_wavetable_stop ( wavetable );
   }
-  return 1;
+  aubio_wavetable_do (wavetable, obuf, obuf);
 }
 
-static void process_print (void) {
-  if (sink_uri == NULL) {
-    if (istactus) {
-      outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate);
-    }
-    if (isonset && verbose)
-      outmsg(" \t \t%f\n",(frames)*overlap_size/(float)samplerate);
+void process_print (void) {
+  if (istactus) {
+    outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
   }
+  //if (isonset && verbose)
+  //  outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
 }
 
 int main(int argc, char **argv) {
-  
+  // override general settings from utils.c
   buffer_size = 1024;
-  overlap_size = 512;
-  /* override default settings */
+  hop_size = 512;
+
   examples_common_init(argc,argv);
 
+  verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
+
+  verbmsg ("tempo method: %s, ", tempo_method);
+  verbmsg ("buffer_size: %d, ", buffer_size);
+  verbmsg ("hop_size: %d, ", hop_size);
+  verbmsg ("threshold: %f\n", onset_threshold);
+
   tempo_out = new_fvec(2);
-  bt = new_aubio_tempo(tempo_method,buffer_size,overlap_size, samplerate);
-  if (onset_threshold != 0.) aubio_tempo_set_threshold (bt, onset_threshold);
+  tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate);
+  if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold);
 
-  wavetable = new_aubio_wavetable (samplerate, overlap_size);
+  wavetable = new_aubio_wavetable (samplerate, hop_size);
   aubio_wavetable_set_freq ( wavetable, 2450.);
   //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");
 
-  examples_common_process(aubio_process,process_print);
+  examples_common_process((aubio_process_func_t)process_block,process_print);
 
-  del_aubio_tempo(bt);
+  del_aubio_tempo(tempo);
   del_aubio_wavetable (wavetable);
   del_fvec(tempo_out);
 
   examples_common_del();
-
-  debug("End of program.\n");
-
-  fflush(stderr);
-
   return 0;
 }
Index: examples/jackio.c
===================================================================
--- examples/jackio.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/jackio.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -36,5 +36,5 @@
 
 /**
- * jack device structure 
+ * jack device structure
  */
 struct _aubio_jack_t
@@ -70,4 +70,9 @@
   /** jack processing function */
   aubio_process_func_t callback;
+  /** internal fvec */
+  fvec_t *ibuf;
+  fvec_t *obuf;
+  uint_t hop_size;
+  int pos;
 };
 
@@ -75,5 +80,4 @@
 static aubio_jack_t *aubio_jack_alloc (uint_t ichan, uint_t ochan,
     uint_t imidichan, uint_t omidichan);
-static uint_t aubio_jack_free (aubio_jack_t * jack_setup);
 /* jack callback functions */
 static int aubio_jack_process (jack_nframes_t nframes, void *arg);
@@ -81,6 +85,6 @@
 
 aubio_jack_t *
-new_aubio_jack (uint_t ichan, uint_t ochan,
-    uint_t imidichan, uint_t omidichan, aubio_process_func_t callback)
+new_aubio_jack (uint_t hop_size, uint_t ichan, uint_t ochan,
+    uint_t imidichan, uint_t omidichan)
 {
   aubio_jack_t *jack_setup = aubio_jack_alloc (ichan, ochan,
@@ -149,6 +153,11 @@
   }
 
-  /* set processing callback */
-  jack_setup->callback = callback;
+  /* get sample rate */
+  jack_setup->samplerate = jack_get_sample_rate (jack_setup->client);
+
+  jack_setup->hop_size = hop_size;
+  jack_setup->ibuf = new_fvec(hop_size);
+  jack_setup->obuf = new_fvec(hop_size);
+  jack_setup->pos = 0;
   return jack_setup;
 
@@ -160,8 +169,13 @@
 
 uint_t
-aubio_jack_activate (aubio_jack_t * jack_setup)
-{
-  /* get sample rate */
-  jack_setup->samplerate = jack_get_sample_rate (jack_setup->client);
+aubio_jack_get_samplerate (aubio_jack_t * jack_setup) {
+  return jack_setup->samplerate;
+}
+
+uint_t
+aubio_jack_activate (aubio_jack_t * jack_setup, aubio_process_func_t callback)
+{
+  /* set processing callback */
+  jack_setup->callback = callback;
   /* actual jack process activation */
   if (jack_activate (jack_setup->client)) {
@@ -177,5 +191,4 @@
   /* bug : should disconnect all ports first */
   jack_client_close (jack_setup->client);
-  aubio_jack_free (jack_setup);
 }
 
@@ -209,10 +222,12 @@
 }
 
-static uint_t
-aubio_jack_free (aubio_jack_t * jack_setup)
+void
+del_aubio_jack (aubio_jack_t * jack_setup)
 {
   if (jack_setup->omidichan && jack_setup->midi_out_ring) {
     jack_ringbuffer_free (jack_setup->midi_out_ring);
   }
+  del_fvec (jack_setup->ibuf);
+  del_fvec (jack_setup->obuf);
   AUBIO_FREE (jack_setup->oports);
   AUBIO_FREE (jack_setup->iports);
@@ -220,5 +235,4 @@
   AUBIO_FREE (jack_setup->obufs);
   AUBIO_FREE (jack_setup);
-  return AUBIO_OK;
 }
 
@@ -232,4 +246,24 @@
 
 static void process_midi_output (aubio_jack_t * dev, jack_nframes_t nframes);
+
+static int block_process(aubio_jack_t *dev,
+    smpl_t **input, smpl_t **output, int nframes) {
+  unsigned int j;       /*frames*/
+  for (j=0;j<(unsigned)nframes;j++) {
+    /* put synthnew in output */
+    output[0][j] = fvec_read_sample(dev->obuf, dev->pos);
+    /* write input to datanew */
+    fvec_write_sample(dev->ibuf, input[0][j], dev->pos);
+    /*time for fft*/
+    if (dev->pos == (int)(dev->hop_size) - 1) {
+      /* block loop */
+      dev->callback(dev->ibuf, dev->obuf);
+      /* end of block loop */
+      dev->pos = -1; /* so it will be zero next j loop */
+    }
+    dev->pos++;
+  }
+  return 1;
+}
 
 static int
@@ -249,5 +283,5 @@
   }
 #ifndef AUBIO_JACK_NEEDS_CONVERSION
-  dev->callback (dev->ibufs, dev->obufs, nframes);
+  block_process(dev, dev->ibufs, dev->obufs, nframes);
 #else
   uint_t j;
@@ -257,5 +291,5 @@
     }
   }
-  dev->callback (dev->sibufs, dev->sobufs, nframes);
+  block_process(dev, dev->sibufs, dev->sobufs, nframes);
   for (j = 0; j < MIN (nframes, AUBIO_JACK_MAX_FRAMES); j++) {
     for (i = 0; i < dev->ochan; i++) {
Index: examples/jackio.h
===================================================================
--- examples/jackio.h	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/jackio.h	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -22,9 +22,9 @@
 #define JACKIO_H
 
-/** 
+/**
  * @file
  *
  * Jack driver for aubio
- * 
+ *
  */
 
@@ -41,15 +41,18 @@
 typedef struct _aubio_jack_t aubio_jack_t;
 /** jack process function */
-typedef int (*aubio_process_func_t) (smpl_t ** input,
-    smpl_t ** output, int nframes);
+typedef int (*aubio_process_func_t) (fvec_t * input, fvec_t * output);
 
 /** jack device creation function */
-aubio_jack_t *new_aubio_jack (uint_t inchannels, uint_t outchannels,
-    uint_t imidichan, uint_t omidichan,
+aubio_jack_t *new_aubio_jack (uint_t hop_size,
+    uint_t inchannels, uint_t outchannels,
+    uint_t imidichan, uint_t omidichan);
+/** activate jack client (run jackprocess function) */
+uint_t aubio_jack_activate (aubio_jack_t * jack_setup,
     aubio_process_func_t callback);
-/** activate jack client (run jackprocess function) */
-uint_t aubio_jack_activate (aubio_jack_t * jack_setup);
 /** close and delete jack client */
 void aubio_jack_close (aubio_jack_t * jack_setup);
+void del_aubio_jack (aubio_jack_t * jack_setup);
+/** get samplerate */
+uint_t aubio_jack_get_samplerate (aubio_jack_t * jack_setup);
 
 /** write a jack_midi_event_t to the midi output ringbuffer */
Index: examples/parse_args.h
===================================================================
--- examples/parse_args.h	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/parse_args.h	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -27,5 +27,5 @@
 extern uint_t samplerate;
 extern uint_t buffer_size;
-extern uint_t overlap_size;
+extern uint_t hop_size;
 // onset stuff
 extern char_t * onset_method;
@@ -48,5 +48,5 @@
 
 // internal stuff
-extern int frames;
+extern int blocks;
 
 extern fvec_t *ibuf;
@@ -156,5 +156,5 @@
         break;
       case 'H':
-        overlap_size = atoi (optarg);
+        hop_size = atoi (optarg);
         break;
       case 'O':                /*onset type */
Index: examples/utils.c
===================================================================
--- examples/utils.c	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/utils.c	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -33,4 +33,5 @@
 
 int verbose = 0;
+int usejack = 0;
 // input / output
 char_t *sink_uri = NULL;
@@ -39,5 +40,5 @@
 uint_t samplerate = 0;
 uint_t buffer_size = 512;
-uint_t overlap_size = 256;
+uint_t hop_size = 256;
 // onset stuff
 char_t * onset_method = "default";
@@ -60,12 +61,13 @@
 fvec_t *obuf;
 
-
 /* settings */
-int frames = 0;
-int usejack = 0;
-int frames_delay = 0;
+int blocks = 0;
 
 extern void usage (FILE * stream, int exit_code);
 extern int parse_args (int argc, char **argv);
+
+#if HAVE_JACK
+aubio_jack_t *jack_setup;
+#endif
 
 void
@@ -78,10 +80,12 @@
   if (!usejack) {
     debug ("Opening files ...\n");
-    this_source = new_aubio_source ((char_t*)source_uri, 0, overlap_size);
+    this_source = new_aubio_source ((char_t*)source_uri, samplerate, hop_size);
     if (this_source == NULL) {
       outmsg ("Could not open input file %s.\n", source_uri);
       exit (1);
     }
-    samplerate = aubio_source_get_samplerate(this_source);
+    if (samplerate == 0) {
+      samplerate = aubio_source_get_samplerate(this_source);
+    }
     if (sink_uri != NULL) {
       this_sink = new_aubio_sink ((char_t*)sink_uri, samplerate);
@@ -91,7 +95,14 @@
       }
     }
+#ifdef HAVE_JACK
+  } else {
+    debug ("Jack init ...\n");
+    jack_setup = new_aubio_jack (hop_size, 1, 1, 0, 1);
+    samplerate = aubio_jack_get_samplerate (jack_setup);
+    source_uri = "jack";
+#endif
   }
-  ibuf = new_fvec (overlap_size);
-  obuf = new_fvec (overlap_size);
+  ibuf = new_fvec (hop_size);
+  obuf = new_fvec (hop_size);
 
 }
@@ -103,9 +114,7 @@
   del_fvec (obuf);
   aubio_cleanup ();
+  fflush(stderr);
+  fflush(stdout);
 }
-
-#if HAVE_JACK
-aubio_jack_t *jack_setup;
-#endif
 
 void
@@ -118,9 +127,6 @@
 
 #if HAVE_JACK
-    debug ("Jack init ...\n");
-    jack_setup = new_aubio_jack (1, 1,
-        0, 1, (aubio_process_func_t) process_func);
     debug ("Jack activation ...\n");
-    aubio_jack_activate (jack_setup);
+    aubio_jack_activate (jack_setup, process_func);
     debug ("Processing (Ctrl+C to quit) ...\n");
     pause ();
@@ -133,19 +139,23 @@
   } else {
     /* phasevoc */
-    debug ("Processing ...\n");
-
-    frames = 0;
+    blocks = 0;
+    uint_t total_read = 0;
 
     do {
       aubio_source_do (this_source, ibuf, &read);
-      process_func (&ibuf->data, &obuf->data, overlap_size);
-      print ();
+      process_func (ibuf, obuf);
+      // print to console if verbose or no output given
+      if (verbose || sink_uri == NULL) {
+        print();
+      }
       if (this_sink) {
-        aubio_sink_do (this_sink, obuf, overlap_size);
+        aubio_sink_do (this_sink, obuf, hop_size);
       }
-      frames++;
-    } while (read == overlap_size);
+      blocks++;
+      total_read += read;
+    } while (read == hop_size);
 
-    debug ("Processed %d frames of %d samples.\n", frames, buffer_size);
+    verbmsg ("read %d samples (%d blocks of %d) from %s at %dHz\n",
+        total_read, blocks, hop_size, source_uri, samplerate);
 
     del_aubio_source (this_source);
@@ -175,10 +185,8 @@
   } else
 #endif
-  if (!verbose) {
-    if (velo == 0) {
-      outmsg ("%f\n", frames * overlap_size / (float) samplerate);
-    } else {
-      outmsg ("%f\t%f\t", mpitch, frames * overlap_size / (float) samplerate);
-    }
+  if (velo == 0) {
+    outmsg ("%f\n", blocks * hop_size / (float) samplerate);
+  } else {
+    outmsg ("%f\t%f\t", mpitch, blocks * hop_size / (float) samplerate);
   }
 }
Index: examples/utils.h
===================================================================
--- examples/utils.h	(revision 1b25a7084aa00576cc71583cacc9b2ba9cf1cf3f)
+++ examples/utils.h	(revision 466dff300724c1e61b6aa2e3b1ae3fc398a30ed6)
@@ -1,4 +1,4 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
@@ -30,19 +30,25 @@
 
 #ifdef HAVE_C99_VARARGS_MACROS
-#define debug(...)              if (verbose) fprintf (stderr, __VA_ARGS__)
-#define errmsg(...)             fprintf (stderr, __VA_ARGS__)
-#define outmsg(...)             fprintf (stdout, __VA_ARGS__)
+#ifdef HAVE_DEBUG
+#define debug(...)                fprintf (stderr, __VA_ARGS__)
 #else
-#define debug(format, args...)  if (verbose) fprintf(stderr, format , ##args)
-#define errmsg(format, args...) fprintf(stderr, format , ##args)
-#define outmsg(format, args...) fprintf(stdout, format , ##args)
+#define debug(...)
+#endif
+#define verbmsg(...)              if (verbose) fprintf (stderr, __VA_ARGS__)
+#define errmsg(...)               fprintf (stderr, __VA_ARGS__)
+#define outmsg(...)               fprintf (stdout, __VA_ARGS__)
+#else
+#ifdef HAVE_DEBUG
+#define debug(...)                fprintf (stderr, format , **args)
+#else
+#define debug(...)                ()
+#endif
+#define verbmsg(format, args...)  if (verbose) fprintf(stderr, format , ##args)
+#define errmsg(format, args...)   fprintf(stderr, format , ##args)
+#define outmsg(format, args...)   fprintf(stdout, format , ##args)
 #endif
 
 typedef void (aubio_print_func_t) (void);
-#ifndef HAVE_JACK
-typedef int (*aubio_process_func_t)
-  (smpl_t ** input, smpl_t ** output, int nframes);
-#endif
+typedef int (*aubio_process_func_t)(fvec_t * input, fvec_t * output);
 void send_noteon (int pitch, int velo);
 
-
