shithub: aubio

Download patch

ref: 1da7e08d47b21afa4d9ce791a38211c0efdfe1e6
parent: 97525e4f81d3798352e3a0ba310d857993661a77
parent: 100f950c3a113aab914a8a828445e8b6d2b63224
author: Paul Brossier <piem@piem.org>
date: Fri Nov 2 08:25:42 EDT 2007

merge main branch

--- /dev/null
+++ b/.bzrignore
@@ -1,0 +1,44 @@
+**/Makefile.in
+**/Makefile
+**/.deps
+**/.libs
+**/*.lo
+**/*.la
+
+# ignore compiled examples
+RE:examples/[a-z]*
+
+# ignore compiled test programs
+RE:tests/src/test-[a-z-]*$
+
+# ignore aubio
+plugins/puredata/aubio.pd_linux
+
+# only sgml manpages count
+doc/*.1
+
+# cachegrind/callgrind stuff
+**/cachegrind.out.[0-9]*
+**/callgrind.out.[0-9]*
+
+# autoreconf -f -i will create these
+INSTALL
+aclocal.m4
+aubio.pc
+autom4te.cache/
+compile
+config.guess
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+py-compile
+src/config.h
+src/config.h.in
+src/stamp-h1
+
--- a/configure.ac
+++ b/configure.ac
@@ -240,7 +240,8 @@
     src/Makefile
     ext/Makefile
     examples/Makefile
-    examples/tests/Makefile
+    tests/Makefile
+    tests/src/Makefile
     sounds/Makefile
     swig/Makefile
     python/Makefile
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,7 +1,3 @@
-if COMPILE_TESTS 
-SUBDIRS = tests
-endif
-
 # global flags
 AM_CFLAGS = -DAUBIO_PREFIX=\"$(prefix)\" -I$(top_srcdir)/src -I$(top_srcdir)/ext @AUBIO_CFLAGS@ @LASH_CFLAGS@ @FFTWLIB_CFLAGS@
 AM_LDFLAGS = -L$(top_builddir)/src -L$(top_builddir)/ext -laubioext -laubio @LASH_LIBS@
--- a/examples/tests/Makefile.am
+++ /dev/null
@@ -1,36 +1,0 @@
-AM_CFLAGS = -I$(top_srcdir)/src
-AM_LDFLAGS = -L$(top_builddir)/src -laubio @FFTWLIB_LIBS@
-
-test_phasevoc_jack_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/ext @JACK_CFLAGS@
-test_phasevoc_jack_LDADD  = $(AM_LDFLAGS) -laubioext -L$(top_builddir)/ext @JACK_LIBS@ 
-
-bin_PROGRAMS = \
-	test-fft \
-	test-mfft \
-	test-hist \
-	test-scale \
-	test-sample \
-	test-window \
-	test-filter \
-	test-biquad \
-	test-resample \
-	test-peakpick \
-	test-phasevoc \
-	test-phasevoc-jack \
-	test-onsetdetection \
-	test-pitchyin \
-	test-pitchyinfft \
-	test-pitchschmitt \
-	test-pitchfcomb \
-	test-pitchmcomb \
-	test-pitchdetection \
-	test-beattracking \
-	test-onset \
-	test-tempo \
-	test-tss
-
-run-tests: $(bin_PROGRAMS)
-	@for i in $(bin_PROGRAMS); do echo $$i; ((time ./$$i 2>&1 > /dev/null) 2>&1; echo $$?); done
-
-run-valgrind-tests: $(bin_PROGRAMS)
-	@for i in $(bin_PROGRAMS); do echo $$i; valgrind .libs/lt-$$i 2>&1 | grep ERROR\ SUMMARY -A4; echo $$?; done
--- a/examples/tests/test-beattracking.c
+++ /dev/null
@@ -1,39 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec (win_s/4, channels);     /* input buffer */
-  
-        /* allocate fft and other memory space */
-        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s, channels);
-
-        uint_t i = 0;
-
-        smpl_t curtempo, curtempoconf;
-
-        while (i < 10) {
-          aubio_beattracking_do(tempo,in,out);
-          curtempo = aubio_beattracking_get_bpm(tempo);
-          if (curtempo != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          curtempoconf = aubio_beattracking_get_confidence(tempo);
-          if (curtempoconf != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          i++;
-        };
-
-        del_aubio_beattracking(tempo);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
--- a/examples/tests/test-biquad.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        aubio_biquad_t * o = new_aubio_biquad(0.3,0.2,0.1,0.2,0.3);
-
-        aubio_biquad_do_filtfilt(o,in,in);
-        aubio_biquad_do(o,in);
-
-        del_aubio_biquad(o);
-        del_fvec(in);
-        return 0;
-}
--- a/examples/tests/test-fft.c
+++ /dev/null
@@ -1,58 +1,0 @@
-#include <stdlib.h>
-#include <math.h>
-#include <complex.h>
-#include <aubio.h>
-
-#define NEW_ARRAY(_t,_n)		(_t*)malloc((_n)*sizeof(_t))
-
-
-int main(){
-        uint_t i,j;
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
-        fvec_t * out      = new_fvec (win_s, channels); /* output buffer */
-  
-        /* allocate fft and other memory space */
-        aubio_fft_t * fft      = new_aubio_fft(win_s);      /* fft interface */
-        smpl_t * w             = NEW_ARRAY(smpl_t,win_s); /* window */
-        /* complex spectral data */
-        fft_data_t ** spec     = NEW_ARRAY(fft_data_t*,channels); 
-        for (i=0; i < channels; i++)
-                spec[i] = NEW_ARRAY(fft_data_t,win_s);
-        /* initialize the window (see mathutils.c) */
-        aubio_window(w,win_s,aubio_win_hanningz);
-  
-        /* fill input with some data */
-        in->data[0][win_s/2] = 1;
-  
-        /* execute stft */
-        for (i=0; i < channels; i++) {
-                aubio_fft_do (fft,in->data[i],spec[i],win_s);
-                /* put norm and phase into fftgrain */
-                aubio_fft_getnorm(fftgrain->norm[i], spec[i], win_s/2+1);
-                aubio_fft_getphas(fftgrain->phas[i], spec[i], win_s/2+1);
-        }
-  
-        /* execute inverse fourier transform */
-        for (i=0; i < channels; i++) {
-                for (j=0; j<win_s/2+1; j++) {
-                        spec[i][j]  = cexp(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
-                        spec[i][j] *= fftgrain->norm[i][j];
-                }
-                aubio_fft_rdo(fft,spec[i],out->data[i],win_s);
-        }
-
-        del_fvec(in);
-        del_fvec(out);
-        del_cvec(fftgrain);
-        free(w);
-        del_aubio_fft(fft);
-        for (i=0; i < channels; i++)
-                free(spec[i]);
-        free(spec); 
-        aubio_cleanup();
-        return 0;
-}
--- a/examples/tests/test-filter.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec (win_s, channels);     /* input buffer */
-  
-        /* allocate fft and other memory space */
-        aubio_filter_t * o = new_aubio_cdsgn_filter(44100);
-
-        aubio_filter_do(o,in);
-        aubio_filter_do_outplace(o,in,out);
-        aubio_filter_do_filtfilt(o,in,out);
-
-        del_aubio_filter(o);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-hist.c
+++ /dev/null
@@ -1,38 +1,0 @@
-#include <aubio.h>
-#include <stdlib.h>
-
-void print_array(fvec_t *f);
-void print_array(fvec_t *f){
-  uint i,j;
-  for (i=0;i<f->channels;i++){
-    for (j=0;j<f->length;j++){
-      printf("%f, ", f->data[i][j]); 
-    }
-    printf(";\n"); 
-  }
-}
-
-int main( int argc, char** argv )
-{
-  uint_t length;
-  for (length = 1; length < 10; length ++ ) {
-    fvec_t *t = new_fvec(length,5);
-    aubio_hist_t *o = new_aubio_hist(0, 1, length, 5);
-    aubio_window(t->data[0],t->length,aubio_win_hanning);
-    aubio_window(t->data[1],t->length,aubio_win_hanningz);
-    aubio_window(t->data[2],t->length,aubio_win_blackman);
-    aubio_window(t->data[3],t->length,aubio_win_blackman_harris);
-    aubio_window(t->data[4],t->length,aubio_win_hamming);
-    print_array(t);
-    aubio_hist_do(o,t);
-    print_array(t);
-    aubio_hist_do_notnull(o,t);
-    print_array(t);
-    aubio_hist_dyn_notnull(o,t);
-    print_array(t);
-    del_aubio_hist(o);
-    del_fvec(t);
-  }
-  return 0;
-}
-
--- a/examples/tests/test-mfft.c
+++ /dev/null
@@ -1,28 +1,0 @@
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 4096;                       /* window size        */
-        uint_t channels   = 100;                        /* number of channels */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
-        fvec_t * out      = new_fvec (win_s, channels); /* output buffer      */
-        /* allocate fft and other memory space */
-        aubio_mfft_t * fft = new_aubio_mfft(win_s,channels);
-        /* fill input with some data */
-        //printf("initialised\n");
-        /* execute stft */
-        aubio_mfft_do (fft,in,fftgrain);
-        //printf("computed forward\n");
-        /* execute inverse fourier transform */
-        aubio_mfft_rdo(fft,fftgrain,out);
-        //printf("computed backard\n");
-        del_aubio_mfft(fft);
-        del_fvec(in);
-        del_cvec(fftgrain);
-        del_fvec(out);
-        //printf("memory freed\n");
-        aubio_cleanup();
-        return 0;
-}
--- a/examples/tests/test-onset.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s/4, channels); /* input buffer */
-        fvec_t * out      = new_fvec (2, channels);     /* input buffer */
-        aubio_onset_t * onset  = new_aubio_onset(aubio_onset_complex, win_s, win_s/4, channels);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_onset(onset,in,out);
-          i++;
-        };
-
-        del_aubio_onset(onset);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-onsetdetection.c
+++ /dev/null
@@ -1,54 +1,0 @@
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        cvec_t * in       = new_cvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec (1, channels);     /* input buffer */
-  
-        /* allocate fft and other memory space */
-        aubio_onsetdetection_t * o = 
-          new_aubio_onsetdetection(aubio_onset_energy, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_energy(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_specdiff, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_specdiff(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_hfc, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_hfc(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_complex, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_complex(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_phase, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_phase(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_kl, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_kl(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        o = new_aubio_onsetdetection(aubio_onset_mkl, win_s, channels);
-        aubio_onsetdetection(o,in,out);
-        aubio_onsetdetection_mkl(o,in,out);
-        del_aubio_onsetdetection(o);
-
-        del_cvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
--- a/examples/tests/test-peakpick.c
+++ /dev/null
@@ -1,19 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        aubio_pickpeak_t * o = new_aubio_peakpicker(0.3);
-
-        aubio_peakpick_pimrt(in,o);
-        aubio_peakpick_pimrt(in,o);
-        aubio_peakpick_pimrt(in,o);
-        aubio_peakpick_pimrt(in,o);
-
-        del_aubio_peakpicker(o);
-        del_fvec(in);
-        return 0;
-}
-
--- a/examples/tests/test-phasevoc-jack.c
+++ /dev/null
@@ -1,84 +1,0 @@
-/* test sample for phase vocoder 
- *
- * this program should start correctly using JACK_START_SERVER=true and
- * reconstruct each audio input frame perfectly on the corresponding input with
- * a delay equal to the window size, hop_s.
- */
-
-#include <unistd.h>  /* pause() or sleep() */
-#include <aubio.h>
-#include <aubioext.h>
-
-uint_t win_s    = 32; /* window size                       */
-uint_t hop_s    = 8;  /* hop size                          */
-uint_t channels = 4;  /* number of channels                */
-uint_t pos      = 0;  /* frames%dspblocksize for jack loop */
-
-fvec_t * in;
-cvec_t * fftgrain;
-fvec_t * out;
-
-aubio_pvoc_t * pv;
-
-#ifdef JACK_SUPPORT
-aubio_jack_t * jack_setup;
-#endif
-
-int aubio_process(float **input, float **output, int nframes);
-
-int main(){
-        /* allocate some memory */
-        in       = new_fvec (hop_s, channels); /* input buffer       */
-        fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
-        out      = new_fvec (hop_s, channels); /* output buffer      */
-        /* allocate fft and other memory space */
-        pv = new_aubio_pvoc(win_s,hop_s,channels);
-        /* fill input with some data */
-        printf("initialised\n");
-        /* execute stft */
-        aubio_pvoc_do (pv,in,fftgrain);
-        printf("computed forward\n");
-        /* execute inverse fourier transform */
-        aubio_pvoc_rdo(pv,fftgrain,out);
-        printf("computed backard\n");
-
-#ifdef JACK_SUPPORT
-        jack_setup  = new_aubio_jack(channels, channels,
-                        (aubio_process_func_t)aubio_process);
-        aubio_jack_activate(jack_setup);
-        sleep(10); //pause(); /* enter main jack loop */
-        aubio_jack_close(jack_setup);
-#endif
-        
-        del_aubio_pvoc(pv);
-        del_cvec(fftgrain);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-        printf("memory freed\n");
-        return 0;
-}
-
-int aubio_process(float **input, float **output, int nframes) {
-  uint_t i;       /*channels*/
-  uint_t j;       /*frames*/
-  for (j=0;j<(unsigned)nframes;j++) {
-    for (i=0;i<channels;i++) {
-      /* write input to datanew */
-      fvec_write_sample(in, input[i][j], i, pos);
-      /* put synthnew in output */
-      output[i][j] = fvec_read_sample(out, i, pos);
-    }
-    /*time for fft*/
-    if (pos == hop_s-1) {
-      /* block loop */
-      aubio_pvoc_do (pv,in, fftgrain);
-      //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] *= 2.; 
-      //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] = 0.; 
-      aubio_pvoc_rdo(pv,fftgrain,out);
-      pos = -1;
-    }
-    pos++;
-  }
-  return 0;
-}
--- a/examples/tests/test-phasevoc.c
+++ /dev/null
@@ -1,30 +1,0 @@
-/* test sample for phase vocoder */
-
-#include <aubio.h>
-
-int main(){
-        uint_t win_s    = 1024; /* window size                       */
-        uint_t hop_s    = 256;  /* hop size                          */
-        uint_t channels = 4;  /* number of channels                */
-        /* allocate some memory */
-        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
-        fvec_t * out      = new_fvec (hop_s, channels); /* output buffer      */
-        /* allocate fft and other memory space */
-        aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s,channels);
-        /* fill input with some data */
-        printf("initialised\n");
-        /* execute stft */
-        aubio_pvoc_do (pv,in,fftgrain);
-        printf("computed forward\n");
-        /* execute inverse fourier transform */
-        aubio_pvoc_rdo(pv,fftgrain,out);
-        printf("computed backard\n");
-        del_aubio_pvoc(pv);
-        del_fvec(in);
-        del_cvec(fftgrain);
-        del_fvec(out);
-        aubio_cleanup();
-        printf("memory freed\n");
-        return 0;
-}
--- a/examples/tests/test-pitchdetection.c
+++ /dev/null
@@ -1,27 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        uint_t samplerate = 44100;                      /* samplerate */
-        uint_t channels   = 1;                          /* number of channel */
-        aubio_pitchdetection_mode mode = aubio_pitchm_freq;
-        aubio_pitchdetection_type type = aubio_pitch_yinfft;
-        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer */
-        aubio_pitchdetection_t * o  = new_aubio_pitchdetection(
-          win_s, hop_s, channels, samplerate, type, mode
-          );
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchdetection(o,in);
-          i++;
-        };
-
-        del_aubio_pitchdetection(o);
-        del_fvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-pitchfcomb.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        uint_t samplerate = 44100;                      /* samplerate */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer */
-        aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb (
-          win_s, hop_s, samplerate
-          );
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchfcomb_detect(o,in);
-          i++;
-        };
-
-        del_aubio_pitchfcomb(o);
-        del_fvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-pitchmcomb.c
+++ /dev/null
@@ -1,24 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        uint_t samplerate = 44100;
-        uint_t channels   = 1;                          /* number of channel */
-        cvec_t * in       = new_cvec (win_s, channels); /* input buffer */
-        aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(
-          win_s, hop_s, channels, samplerate );
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchmcomb_detect (o,in);
-          i++;
-        };
-
-        del_aubio_pitchmcomb(o);
-        del_cvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-pitchschmitt.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t samplerate = 44100;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, 1); /* input buffer */
-        aubio_pitchschmitt_t * o  = new_aubio_pitchschmitt(
-          win_s, samplerate );
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchschmitt_detect (o,in);
-          i++;
-        };
-
-        del_aubio_pitchschmitt(o);
-        del_fvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
-
--- a/examples/tests/test-pitchyin.c
+++ /dev/null
@@ -1,24 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec (win_s/2, channels); /* input buffer */
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_pitchyin_diff   (in,out);
-          aubio_pitchyin_getcum (out);
-          aubio_pitchyin_getpitch (out);
-          aubio_pitchyin_getpitchfast (in,out,0.2);
-          i++;
-        };
-
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-pitchyinfft.c
+++ /dev/null
@@ -1,22 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_pitchyinfft_detect (o,in,0.2);
-          i++;
-        };
-
-        del_aubio_pitchyinfft(o);
-        del_fvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
-
--- a/examples/tests/test-resample.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        smpl_t ratio      = 0.5;
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec ((uint_t)(win_s*ratio), channels);     /* input buffer */
-        aubio_resampler_t * o  = new_aubio_resampler(0.5, 0);
-        uint_t i = 0;
-
-        while (i < 100) {
-          aubio_resampler_process(o,in,out);
-          i++;
-        };
-
-        del_aubio_resampler(o);
-        del_fvec(in);
-        del_fvec(out);
-
-        return 0;
-}
--- a/examples/tests/test-sample.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        cvec_t * sp       = new_cvec (win_s, channels); /* input buffer */
-        del_fvec(in);
-        del_cvec(sp);
-
-        return 0;
-}
-
--- a/examples/tests/test-scale.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        aubio_scale_t * o = new_aubio_scale(0,1,2,3);
-        aubio_scale_set(o,0,1,2,3);
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_scale_do(o,in);
-          i++;
-        };
-
-        del_aubio_scale(o);
-        del_fvec(in);
-
-        return 0;
-}
--- a/examples/tests/test-tempo.c
+++ /dev/null
@@ -1,35 +1,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t channels   = 1;                          /* number of channel */
-        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
-        fvec_t * out      = new_fvec (2, channels);     /* input buffer */
-        aubio_tempo_t * o  = new_aubio_tempo(aubio_onset_complex, win_s, win_s/4, channels);
-        uint_t i = 0;
-
-        smpl_t curtempo, curtempoconf;
-
-        while (i < 1000) {
-          aubio_tempo(o,in,out);
-          curtempo = aubio_tempo_get_bpm(o);
-          if (curtempo != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          curtempoconf = aubio_beattracking_get_confidence(o);
-          if (curtempoconf != 0.) {
-            fprintf(stdout,"%f\n",curtempo);
-            return 1;
-          }
-          i++;
-        };
-
-        del_aubio_tempo(o);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
--- a/examples/tests/test-tss.c
+++ /dev/null
@@ -1,47 +1,0 @@
-/* test sample for phase vocoder 
- *
- * this program should start correctly using JACK_START_SERVER=true and
- * reconstruct each audio input frame perfectly on the corresponding input with
- * a delay equal to the window size, hop_s.
- */
-
-#include <aubio.h>
-
-int main(){
-	int i;
-        uint_t win_s    = 1024; /* window size                       */
-        uint_t hop_s    = 256;  /* hop size                          */
-        uint_t channels = 4;  /* number of channels                */
-        /* allocate some memory */
-        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
-        cvec_t * cstead   = new_cvec (win_s, channels); /* fft norm and phase */
-        cvec_t * ctrans   = new_cvec (win_s, channels); /* fft norm and phase */
-        fvec_t * stead    = new_fvec (hop_s, channels); /* output buffer      */
-        fvec_t * trans    = new_fvec (hop_s, channels); /* output buffer      */
-        /* allocate fft and other memory space */
-        aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s,channels);
-        aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s,channels);
-        aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s,channels);
-
-	aubio_tss_t *  tss = new_aubio_tss(0.01,3.,4.,win_s,hop_s,channels);
-        /* fill input with some data */
-        printf("initialised\n");
-        /* execute stft */
-	for (i = 0; i < 10; i++) {
-		aubio_pvoc_do (pv,in,fftgrain);
-		aubio_tss_do  (tss,fftgrain,ctrans,cstead);
-		aubio_pvoc_rdo(pvt,cstead,stead);
-		aubio_pvoc_rdo(pvs,ctrans,trans);
-	}
-        del_aubio_pvoc(pv);
-        del_fvec(in);
-        del_cvec(fftgrain);
-        del_cvec(cstead);
-        del_cvec(ctrans);
-        del_fvec(stead);
-        del_fvec(trans);
-        aubio_cleanup();
-        printf("memory freed\n");
-        return 0;
-}
--- a/examples/tests/test-window.c
+++ /dev/null
@@ -1,37 +1,0 @@
-#include <aubio.h>
-#include <stdlib.h>
-
-void print_array(fvec_t *f);
-void print_array(fvec_t *f){
-  uint i,j;
-  for (i=0;i<f->channels;i++)
-  {
-    for (j=0;j<f->length;j++)
-    {
-      printf("%1.3e, ", f->data[i][j]); 
-    }
-    printf(";\n"); 
-  }
-}
-
-int main( int argc, char** argv )
-{
-  uint_t length;
-  for (length = 2; length <= 5; length++)
-  {
-    fvec_t *t = new_fvec(length,9);
-    aubio_window(t->data[0],t->length,aubio_win_rectangle);
-    aubio_window(t->data[1],t->length,aubio_win_hamming);
-    aubio_window(t->data[2],t->length,aubio_win_hanning);
-    aubio_window(t->data[3],t->length,aubio_win_hanningz);
-    aubio_window(t->data[4],t->length,aubio_win_blackman);
-    aubio_window(t->data[5],t->length,aubio_win_blackman_harris);
-    aubio_window(t->data[6],t->length,aubio_win_gaussian);
-    aubio_window(t->data[7],t->length,aubio_win_welch);
-    aubio_window(t->data[8],t->length,aubio_win_parzen);
-    print_array(t);
-    del_fvec(t);
-  }
-  return 0;
-}
-
--- a/python/aubio/aubioclass.py
+++ b/python/aubio/aubioclass.py
@@ -42,8 +42,9 @@
             self.file = new_aubio_sndfile_wo(model.file,filename)
         else:
             self.file = new_aubio_sndfile_ro(filename)
+        if self.file == None: raise(ValueError, "failed opening file")
     def __del__(self):
-        del_aubio_sndfile(self.file)
+        if self.file != None: del_aubio_sndfile(self.file)
     def info(self):
         aubio_sndfile_info(self.file)
     def samplerate(self):
--- a/python/test/aubiomodule.py
+++ /dev/null
@@ -1,14 +1,0 @@
-import unittest
-
-class aubiomodule_test_case(unittest.TestCase):
-
-  def test_aubio(self):
-    """ try importing aubio module """
-    import aubio 
-
-  def test_aubiowrapper(self):
-    """ try importing aubio.aubiowrapper module """
-    from aubio import aubiowrapper 
- 
-if __name__ == '__main__':
-  unittest.main()
--- a/python/test/bench/onset/Makefile.am
+++ /dev/null
@@ -1,44 +1,0 @@
-export BASEDIR=../../../..
-export PYTHONPATH=$(BASEDIR)/python
-export LD_LIBRARY_PATH=$(BASEDIR)/src/.libs:$(BASEDIR)/ext/.libs
-
-DETAILSOURCE = \
-	/var/tmp/Onset-Mirex2005/poly_pitched \
-	/var/tmp/Onset-Mirex2005/solo_bars_and_bells \
-	/var/tmp/Onset-Mirex2005/solo_brass \
-	/var/tmp/Onset-Mirex2005/solo_drums \
-	/var/tmp/Onset-Mirex2005/solo_plucked_strings \
-	/var/tmp/Onset-Mirex2005/solo_singing_voice \
-	/var/tmp/Onset-Mirex2005/solo_sustained_strings \
-	/var/tmp/Onset-Mirex2005/solo_winds \
-	/var/tmp/Onset-Mirex2005/complex
-
-SOURCE = /var/tmp/Onset-Mirex2005
-
-TESTSOURCE = \
-	/var/tmp/Onset-Mirex2005/solo_bars_and_bells \
-	/var/tmp/Onset-Mirex2005/solo_winds \
-	/archives/samples/DB/PercussivePhrases/CM18/Samba_Audio
-
-test-aubiocut:            $(patsubst %, %.aubiocut,    $(TESTSOURCE))
-test-aubiodelay:          $(patsubst %, %.aubiodelay,  $(TESTSOURCE))
-test-aubiowindow:         $(patsubst %, %.aubiowindow, $(TESTSOURCE))
-
-final-aubiocut:           $(patsubst %, %.aubiocut,    $(DETAILSOURCE) $(SOURCE))
-final-aubiodelay:         $(patsubst %, %.aubiodelay,  $(SOURCE))
-final-aubiowindow:        $(patsubst %, %.aubiowindow, $(SOURCE))
-
-%.aubiocut: %
-	rm -f `basename $@`
-	./bench-onset $< | tee `basename $@`
-	-diff `basename $@`.ref `basename $@`
-
-%.aubiodelay: %
-	rm -f `basename $@`
-	./bench-delay $< | tee `basename $@`
-	-diff `basename $@`.ref `basename $@`
-
-%.aubiowindow: %
-	rm -f `basename $@`
-	./bench-window $< | tee `basename $@`
-	-diff `basename $@`.ref `basename $@`
--- a/python/test/bench/onset/bench-delay
+++ /dev/null
@@ -1,62 +1,0 @@
-#! /usr/bin/python
-
-from aubio.bench.onset import benchonset
-from aubio.task.onset import taskonset
-from aubio.task.params import taskparams
-
-class mybenchonset(benchonset):
-
-	def run_bench(self,modes=['dual'],thresholds=[0.5]):
-		from os.path import dirname,basename
-		self.thresholds = thresholds
-		self.pretty_titles()
-
-		for mode in modes:
-			d = []
-			self.params.onsetmode = mode
-			self.params.localmin = True
-			self.params.delay = 1. 
-			self.params.threshold = thresholds[0]
-			#
-			self.params.localmin = False 
-			self.params.delay = 0. 
-			self.dir_eval_print()
-			self.plotdiffs(d,plottitle="Causal")
-			#
-			self.params.localmin = True
-			self.params.delay = 0. 
-			self.dir_eval_print()
-			self.plotdiffs(d,plottitle="Local min")
-
-			self.params.localmin = False 
-			self.params.delay = 6. 
-			self.dir_eval_print()
-			self.plotdiffs(d,plottitle="Fixed delay")
-
-			#self.plotplotdiffs(d)
-			outplot = "_-_".join(("delay",mode,basename(self.datadir) ))
-			for ext in ("png","svg","ps"):
-				self.plotplotdiffs(d,outplot=outplot,extension=ext)
-
-if __name__ == "__main__":
-	import sys
-	if len(sys.argv) > 1: datapath = sys.argv[1]
-	else: print "ERR: a path is required"; sys.exit(1)
-	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
-	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
-	#modes = [ 'hfc' ]
-	thresholds = [0.5]
-
-	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
-	respath = '/var/tmp/DB-testings'
-
-	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
-	benchonset.params = taskparams()
-	benchonset.task = taskonset
-	benchonset.valuesdict = {}
-
-	try:
-		#benchonset.auto_learn2(modes=modes)
-		benchonset.run_bench(modes=modes,thresholds=thresholds)
-	except KeyboardInterrupt:
-		sys.exit(1)
--- a/python/test/bench/onset/bench-onset
+++ /dev/null
@@ -1,68 +1,0 @@
-#! /usr/bin/python
-
-from aubio.task import *
-
-from aubio.bench.onset import mmean, stdev, benchonset
-
-class mybenchonset(benchonset):
-
-	def run_bench(self,modes=['dual'],thresholds=[0.5]):
-		from os.path import dirname,basename
-		self.thresholds = thresholds
-		self.pretty_titles()
-		d,e,f,g = [],[],[],[]
-		for mode in modes:
-			self.vlist = []
-			self.params.onsetmode = mode
-			#self.params.localmin = True
-
-			for threshold in self.thresholds:
-				self.params.threshold = threshold
-				self.dir_eval_print()
-				self.vlist.append(self.v)
-			self.plotroc(d)
-			self.plotfmeas(e)
-			self.plotpr(f)
-			#self.plothistcat(g)
-
-
-
-		#self.plotplotroc(d)
-		#self.plotplotfmeas(e)
-		#self.plotplotpr(f)
-		outplot = basename(self.datadir)
-		for ext in ("png","svg","ps"):
-			self.plotplotroc(d,outplot=outplot,extension=ext)
-			self.plotplotfmeas(e,outplot=outplot,extension=ext)
-			self.plotplotpr(f,outplot=outplot,extension=ext)
-			#self.plotplothistcat(g,outplot=outplot,extension=ext)
-
-if __name__ == "__main__":
-	import sys
-	if len(sys.argv) > 1: datapath = sys.argv[1]
-	else: print "ERR: a path is required"; sys.exit(1)
-	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
-	thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
-	#modes = [ 'hfc' ]
-	#thresholds = [0.5]
-
-	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
-	respath = '/var/tmp/DB-testings'
-
-	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
-	benchonset.params = taskparams()
-	benchonset.params.dcthreshold = -1.
-	benchonset.params.silence = -100.
-	benchonset.params.delay = 5. 
-	benchonset.params.bufsize = 1024 
-	benchonset.params.hopsize = 256 
-	benchonset.params.step = float(benchonset.params.hopsize)/float(benchonset.params.samplerate)
-	benchonset.params.mintol = 4.1 
-	benchonset.task = taskonset
-	benchonset.valuesdict = {}
-
-	try:
-		#benchonset.auto_learn2(modes=modes)
-		benchonset.run_bench(modes=modes,thresholds=thresholds)
-	except KeyboardInterrupt:
-		sys.exit(1)
--- a/python/test/bench/onset/bench-window
+++ /dev/null
@@ -1,59 +1,0 @@
-#! /usr/bin/python
-
-from aubio.bench.onset import benchonset
-from aubio.task.onset import taskonset
-from aubio.task.params import taskparams
-
-class mybenchonset(benchonset):
-
-	def run_bench(self,modes=['dual'],thresholds=[0.5]):
-		from os.path import dirname,basename
-		self.thresholds = thresholds
-		self.pretty_titles()
-
-		for mode in modes:
-
-			self.params.onsetmode = mode
-			self.params.localmin = True
-			self.params.delay = 1. 
-			self.params.threshold = thresholds[0]
-			self.params.localmin = False 
-			#
-			for delay in (0., 4.):
-				d = []
-				self.params.delay = delay 
-				for buf in (2048, 1024, 512):
-					for hop in (buf/2, buf/4):
-						self.params.bufsize = buf 
-						self.params.hopsize = hop 
-						self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
-						self.dir_eval_print()
-						self.plotdiffs(d,plottitle="%s %s" % (buf,hop))
-				#plotplotdiffs(d)
-				outplot = "_-_".join(("window",mode,"delay-%s" % int(delay),
-					basename(self.datadir) ))
-				for ext in ("png","svg","ps"):
-					self.plotplotdiffs(d,outplot=outplot,extension=ext)
-
-if __name__ == "__main__":
-	import sys
-	if len(sys.argv) > 1: datapath = sys.argv[1]
-	else: print "ERR: a path is required"; sys.exit(1)
-	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
-	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
-	#modes = [ 'hfc' ]
-	thresholds = [0.5]
-
-	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
-	respath = '/var/tmp/DB-testings'
-
-	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
-	benchonset.params = taskparams()
-	benchonset.task = taskonset
-	benchonset.valuesdict = {}
-
-	try:
-		#benchonset.auto_learn2(modes=modes)
-		benchonset.run_bench(modes=modes,thresholds=thresholds)
-	except KeyboardInterrupt:
-		sys.exit(1)
--- a/python/test/bench/pitch/Makefile.am
+++ /dev/null
@@ -1,59 +1,0 @@
-export AUBIODIR=../../../..
-export PYTHONPATH=$(AUBIODIR)/python
-export LD_LIBRARY_PATH=$(AUBIODIR)/src/.libs:$(AUBIODIR)/ext/.libs
-
-CP=cp -a
-
-SOURCE = \
-	$(BASEDIR)/isolated/vibraphone \
-	$(BASEDIR)/isolated/clavinet \
-	$(BASEDIR)/isolated/elecguitar \
-	$(BASEDIR)/isolated/piano \
-	$(BASEDIR)/isolated/rhodes \
-	$(BASEDIR)/isolated
-
-
-MONOSOURCE = \
-	$(BASEDIR)/monophonic/Mirex04/daisy \
-	$(BASEDIR)/monophonic/Mirex04/midi \
-	$(BASEDIR)/monophonic/Mirex04/jazz \
-	$(BASEDIR)/monophonic/Mirex04/pop \
-	$(BASEDIR)/monophonic/Mirex04/opera \
-	$(BASEDIR)/monophonic/Mirex04
-
-POLYSOURCE = \
-	$(BASEDIR)/polyphonic/Mirex04/daisy \
-	$(BASEDIR)/polyphonic/Mirex04/midi \
-	$(BASEDIR)/polyphonic/Mirex04/jazz \
-	$(BASEDIR)/polyphonic/Mirex04/pop \
-	$(BASEDIR)/polyphonic/Mirex04/opera \
-	$(BASEDIR)/polyphonic/Mirex04
-
-test-aubiopitch-isolated:    $(patsubst %, %.aubiopitch-isolated, $(SOURCE))
-test-aubiopitch-monophonic:  $(patsubst %, %.aubiopitch-monophonic, $(MONOSOURCE))
-test-aubiopitch-polyphonic:  $(patsubst %, %.aubiopitch-polyphonic, $(POLYSOURCE))
-
-plotpitch:
-	../../../aubiopitch -m fcomb,mcomb,yinfft,yin,schmitt -i jazz2REF.wav -p -t 0.2 -l 100 -M 600 -O jazz2REF.ps
-	../../../aubiopitch -m fcomb,mcomb,yinfft,yin,schmitt -p -t 0.2 -l 300 -M 900 -i opera_fem2REF.wav -O opera_fem2REF.ps
-
-timings:
-	./bench-timings $(BASEDIR)/polyphonic/Mirex04/opera
-
-%.aubiopitch-isolated: %
-	$(CP) isolated/`basename $@` isolated/`basename $@`.old
-	./bench-pitch-isolated $< | tee isolated/`basename $@`
-	-diff isolated/`basename $@`.old isolated/`basename $@`
-	-diff isolated/`basename $@`.ref isolated/`basename $@`
-
-%.aubiopitch-monophonic: %
-	$(CP) monophonic/`basename $@` monophonic/`basename $@`.old
-	./bench-pitch-monophonic $< | tee monophonic/`basename $@`
-	-diff monophonic/`basename $@`.ref monophonic/`basename $@`
-	-diff monophonic/`basename $@`.old monophonic/`basename $@`
-
-%.aubiopitch-polyphonic: %
-	$(CP) polyphonic/`basename $@` polyphonic/`basename $@`.old
-	./bench-pitch-polyphonic $< | tee polyphonic/`basename $@`
-	-diff polyphonic/`basename $@`.ref polyphonic/`basename $@`
-	-diff polyphonic/`basename $@`.old polyphonic/`basename $@`
--- a/python/test/bench/pitch/bench-pitch-isolated
+++ /dev/null
@@ -1,198 +1,0 @@
-#! /usr/bin/python
-
-from aubio.bench.node import *
-from aubio.task import *
-
-class benchpitch(bench):
-	
-	""" list of values to store per file """
-	valuenames = ['mode']
-	""" list of lists to store per file """
-	valuelists = ['truth', 'osil', 'esil', 'opit', 'epit', 'echr', 
-               'Msil', 'Mpit', 'Mchr',
-	       'TotalPit', 'TotalPit', 'TotalChr' ]
-	""" list of values to print per dir """
-	printnames_total = [ 'mode', 'MinPit', 'MaxPit', 'TotalSil', 'TotalPit', 'TotalChr']
-	printnames_notes = [ 'mode', 'Note', 'Sil', 'Pit', 'Chr']
-	printnames = printnames_notes 
-
-	""" per dir """
-	formats = {'mode': "%12s" , 
-		'truth': "%s",
-		'osil': "%s", 'esil': "%s", 
-		'opit': "%s", 'epit': "%s", 'echr': "%s",
-    'Note': "%s", 'Sil': "%s", 'Chr': "%s", 'Pit': "%s",
-		'TotalPit': "%s", 'TotalSil': "%s", 'TotalChr': "%s",
-		'MinPit': "%s", 'MaxPit': "%s",
-		'Msil': "%s", 'Mpit': "%s", 'Mchr': "%s"}
-
-	def dir_eval(self):
-		""" evaluate statistical data over the directory """
-		v = self.v
-		v['mode']      = self.params.pitchmode
-
-	def file_exec(self,input,output):
-		filetask = self.task(input,params=self.params)
-		computed_data = filetask.compute_all()
- 		osil, esil, opit, epit, echr = filetask.eval(computed_data,tol=0.5)
-		self.v['truth'].append(int(filetask.truth))
-		assert opit > 0
-		
-		self.v['osil'].append(osil)
-		self.v['esil'].append(esil)
-		self.v['opit'].append(opit)
-		self.v['epit'].append(epit)
-		self.v['echr'].append(echr)
-
-		self.v['Msil'].append(esil/float(osil)*100.)
-		self.v['Mpit'].append(epit/float(opit)*100.)
-		self.v['Mchr'].append(echr/float(opit)*100.)
-		#print results#, computed_data
-		#print input, results, results - float(input.split('.')[-2])
-			
-	def run_bench(self,modes=['schmitt'],multiplot=0):
-		from os.path import basename
-		self.modes = modes
-		self.pretty_titles()
-		d = []
-		for mode in self.modes:
-			self.params.pitchmode = mode
-			self.dir_exec()
-			self.dir_eval()
-			truth   = [i for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allOsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allEsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allOpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allEpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allEchr = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allMsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allMpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			allMchr = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
-			for i in range(len(self.v['truth'])):
-				allOsil[self.v['truth'][i]-min(self.v['truth'])] += self.v['osil'][i]
-				allEsil[self.v['truth'][i]-min(self.v['truth'])] += self.v['esil'][i]
-				allOpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['opit'][i]
-				allEpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['epit'][i]
-				allEchr[self.v['truth'][i]-min(self.v['truth'])] += self.v['echr'][i]
-			for i in range(len(truth)):
-				allOsil[i] = max(1,allOsil[i])
-				allOpit[i] = max(1,allOpit[i])
-				allMsil[i] = allEsil[i]/float(allOsil[i])*100.
-				allMpit[i] = allEpit[i]/float(allOpit[i])*100.
-				allMchr[i] = allEchr[i]/float(allOpit[i])*100.
-				self.v['Sil'], self.v['Pit'], self.v['Chr'] = allMsil[i], allMpit[i], allMchr[i]
-				self.v['Note'] = truth[i]
-				#self.printnames = self.printnames_notes
-				self.pretty_print()
-			self.v['TotalSil'] = sum(allMsil)/len(truth)
-			self.v['TotalPit'] = sum(allMpit)/len(truth)
-			self.v['TotalChr'] = sum(allMchr)/len(truth)
-			self.v['MinPit'] = min(truth) 
-			self.v['MaxPit'] = max(truth) 
-			#self.printnames = self.printnames_total
-			#self.pretty_print()
-
-			plot = []
-			self.plotpitchtessiture(plot,
-				truth, 
-				allMpit,
-				plottitle="%s %s" % (self.v['mode'],self.params.bufsize),
-				plotmode='lines')
-			"""
-			self.plotpitchtessiture(plot,
-				truth, 
-				allMchr,
-				plottitle="%s %s" % (self.v['mode'],"%12"),
-				plotmode='lines')
-			self.plotpitchtessiture(plot,
-				truth, 
-				allMsil,
-				plottitle="%s %s" % (self.v['mode'],"sil"),
-				plotmode='lines')
-			"""
-			title = basename(self.datadir)
-			if multiplot:
-				d.append(plot)
-			else:
-				d += plot
-		outplot = "_-_".join(('pitchtessiture',title))
-		self.xmin = min(self.v['truth']) #20.
-		self.xmax = max(self.v['truth'])
-		for ext in ('ps','png','svg'): #,''):
-			self.plotplotpitchtessiture(d,
-				plottitle="".join(['Performance against MIDI Note number (',
-					title,
-					", %s" % len(self.sndlist), " samples)"]),
-				outplot=outplot,
-				extension=ext,multiplot=multiplot)
-		#d.append('beta = .25,orig(x) title \"-2 octave\"')
-		#d.append('beta = .50,orig(x) title \"-1 octave\"')
-		#d.append('beta = 1.0,orig(x) title \"original\"')
-		#d.append('beta = 2.0,orig(x) title \"+1 octave\"')
-
-	"""
-	Plot functions 
-	"""
-
-	def plotpitchtessiture(self,d,lx,ly,plottitle="",plotmode='linespoints'):
-		import Gnuplot, Gnuplot.funcutils
-		d.append(Gnuplot.Data(lx, ly, with=plotmode, title="%s" % (plottitle) ))
-
-	def plotplotpitchtessiture(self,d,plottitle='',outplot=0,extension='',multiplot=1):
-		from aubio.gnuplot import gnuplot_create
-		g = gnuplot_create(outplot=outplot,extension=extension) 
-		#g.title(plottitle)
-		#g('orig(x) = beta*x')
-		g.title(plottitle)
-		g('set yrange [50:100]')
-		# erase axis
-		g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax))
-		#g.plot(*d)
-		g('set border 3')
-		g('set xtics nomirror')
-		g('set ytics nomirror')
-		g('set key bottom')
-		if multiplot:
-			g('set multiplot')
-			for i in range(len(d)):
-				# plot onset detection functions
-				g('set size   1,%f' % ( 1.0/float(len(d)) ) )
-				g('set origin 0,%f' % ( 1.0*float(len(d)-i-1)/float(len(d)) ) )
-				#g.ylabel('%Correct detections')
-				g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax))
-				g.plot(*d[i])
-				g('unset title')
-			g('unset multiplot')
-		else:
-			g.plot(*d)
-
-
-if __name__ == "__main__":
-	import sys
-	if len(sys.argv) > 1: datapath = sys.argv[1]
-	else: print "error: a path is required"; sys.exit(1)
-	if len(sys.argv) > 2:
-		for each in sys.argv[3:-1]: print each
-	modes = ['schmitt', 'yin', 'yinfft', 'mcomb', 'fcomb']
-	#modes = ['mcomb']
-
-	params = taskparams()
-	params.bufsize = 2048 # 4096 
-	params.hopsize = 256
-	params.silence = -60.
-	params.pitchsmooth = 0 
-	params.pitchmax = 20000
-	params.pitchmin = 20
-	params.pitchyinfft = 0.95
-	benchpitch = benchpitch(datapath,params=params)
-	benchpitch.task = taskpitch
-
-	#benchpitch.titles  = [ 'mode', 'thres', 'avg', 'avgdist' ]
-	#benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ]
-	try:
-		benchpitch.run_bench(modes=modes)
-	except KeyboardInterrupt:
-		print "Interrupted by user"
-		sys.exit(1)
-
-	sys.exit(0)
--- a/python/test/bench/pitch/bench-pitch-plot-isolated
+++ /dev/null
@@ -1,63 +1,0 @@
-#! /usr/bin/python
-
-if __name__ == '__main__':
-  import sys, Gnuplot
-  from aubio.gnuplot import gnuplot_create
-  from aubio.txtfile import read_datafile
-  from aubio.plot.keyboard import draw_keyboard
-  lines = []
-  titles = []
-  for file in range(len(sys.argv)-1):
-    l = read_datafile(sys.argv[file+1])
-    notes, score = [],[]
-    for i in range(len(l)):
-      notes.append(l[i][0])
-      score.append(l[i][2])
-    lines.append(Gnuplot.Data(notes,score,
-      with='linespoints',
-      title=sys.argv[file+1].split('.')[-1]))
-    titles.append(sys.argv[file+1].split('.')[-1])
-  blacks,whites = draw_keyboard(firstnote = notes[0], lastnote = notes[-1], 
-    y0= 40, y1 = 50)
-
-  g = gnuplot_create(sys.argv[file+1].split('.')[-3],'ps')
-  #g = gnuplot_create('','')
-  #g = gnuplot_create('/tmp/test','eps')
-  g('set yrange [40:100]')
-  #g('set xrange [%f:%f]' % (notes[0],notes[-1]+60))
-  g('set size 0.5')
-  g('set key outside')
-
-  g('set border 3')
-  g('set xtics nomirror')
-  g('set ytics nomirror')
-  multiplot = 1
-  oplots = lines
-  g('set size 1,2')
-  if multiplot:
-    height = 2.
-    g('set lmargin 10')
-    #g('set rmargin 15')
-    g('set multiplot')
-    g('set yrange [50:100]')
-    g('set xrange [%f:%f]' % (notes[0],notes[-1]))
-    g('set xtics %f,12' % notes[0])
-    g('set nokey')
-    for i in range(len(oplots)):
-      g.ylabel(titles[i])
-      g('set size %f,%f' % (1.,height*.85/float(len(oplots))))
-      g('set origin 0,%f' % (height*(.15+.85*float(len(oplots)-i-1)/float(len(oplots)))))
-      g.plot(oplots[i])
-    g('set title "Raw pitch accuracy (%) against midi note numbers"')
-    g('set noxtics')
-    g('set noytics')
-    g('set size %f,%f' % (1.,.15*height))
-    g('set origin 0,%f' % 0)
-    g('set yrange [40:50]')
-    g('set xrange [%f:%f]' % (notes[0],notes[-1]))
-    g.xlabel('')
-    g.ylabel('')
-    g.plot(whites,blacks)
-    g('unset multiplot')
-  else:
-    g.plot(whites,blacks,*lines)
--- a/python/test/bench/tempo/demo-tempo
+++ /dev/null
@@ -1,313 +1,0 @@
-#! /usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys,time
-from aubio.task import taskbeat,taskparams
-from aubio.aubioclass import fvec, aubio_autocorr
-from aubio.gnuplot import gnuplot_create, gnuplot_addargs
-from aubio.aubiowrapper import *
-from math import exp,log
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        parser.add_option("-n","--printframe",
-                          action="store", dest="printframe", default=-1, 
-                          help="make a plot of the n_th frame")
-        gnuplot_addargs(parser)
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-def plotdata(x,y,plottitle="",**keyw):
-	import Gnuplot
-	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
-
-options, args = parse_args()
-filename = options.filename
-xsize = float(options.xsize)
-ysize = float(options.ysize)
-
-printframe = int(options.printframe)
-
-if options.outplot and printframe > 0: 
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else: 
-  extension = ''
-  outplot = None
-f = gnuplot_create(outplot=outplot,extension=extension,options=options)
-
-params = taskparams()
-params.onsetmode = 'specdiff'
-task = taskbeat(filename,params=params)
-
-hopsize = params.hopsize
-bufsize = params.bufsize
-btstep = task.btstep
-winlen = task.btwinlen
-laglen = winlen/4
-step = winlen/4
-
-timesig = 0
-maxnumelem = 4
-gp = 0
-counter = 0
-flagconst = 0
-constthresh = 3.901
-g_var      = 3.901
-rp = 0
-rp1 = 0
-rp2 = 0
-g_mu = 0
-
-rayparam = 48/512.*winlen
-
-#t     = [i for i in range(hopsize)]
-#tlong = [i for i in range(hopsize*(btstep-1))]
-#tall  = [i for i in range(hopsize*btstep)]
-#a     = [0 for i in range(hopsize*btstep)]
-dfx = [i for i in range(winlen)]
-dfframe = [0 for i in range(winlen)]
-dfrev = [0 for i in range(winlen)]
-acframe = [0 for i in range(winlen)]
-
-localacf = [0 for i in range(winlen)]
-inds = [0 for i in range(maxnumelem)]
-
-acx = [i for i in range(laglen)]
-acfout  = [0 for i in range(laglen)]
-
-phwv  = [0 for i in range(2*laglen)]
-phwvx = [i for i in range(2*laglen)]
-
-dfwvnorm = exp(log(2.0)*(winlen+2.)/rayparam);
-dfwv = [exp(log(2.)*(i+1.)/rayparam)/dfwvnorm for i in range(winlen)]
-
-gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
-rwv = [(i+1.)/rayparam**2 * exp(-(i+1.)**2 / (2.*rayparam)**2)
-        for i in range(0,laglen)] 
-acf = fvec(winlen,1)
-
-nrframe = 0
-while (task.readsize == params.hopsize):
-  task()
-  #print task.pos2
-  #a[:-hopsize] = [i for i in a[-(btstep-1)*hopsize:]]
-  #a[-hopsize:] = [task.myvec.get(i,0) for i in t]
-
-  #g('set xrange [%f:%f]' % (t[0],t[-1]))
-  #time.sleep(.2)
-  if task.pos2==btstep-1:
-    nrframe += 1
-    dfframe = [task.dfframe.get(i,0) for i in range(winlen)]
-    if printframe == nrframe or printframe == -1:
-      d  = [[plotdata(range(-winlen,0),dfframe,plottitle="onset detection", with='lines')]]
-    # start beattracking_do
-    for i in range(winlen):
-      dfrev[winlen-1-i] = 0.
-      dfrev[winlen-1-i] = dfframe[i]*dfwv[i]
-    aubio_autocorr(task.dfframe(),acf()); 
-    acframe = [acf.get(i,0) for i in range(winlen)]
-    if not timesig:
-      numelem = 4
-    else:
-      numelem = timesig
-
-    old = 0
-    acfout = [0 for i in range(winlen/4)]
-    for i in range(1,laglen-1):
-      for a in range(1,numelem+1):
-        for b in range (1-a,a):
-          acfout[i] += acframe[a*(i+1)+b-1] * 1./(2.*a-1.)*rwv[i]
-          if old < acfout[i]:
-            old = acfout[i]
-            maxi = i
-    rp = max(maxi,1);
-
-    if printframe == nrframe or printframe == -1:
-      rwvs = [rwv[i]*max(acframe) for i in range(len(rwv))]
-      d += [[plotdata(acx,acfout,plottitle="comb filterbank", with='lines', axes='x1y1'),
-          plotdata([rp,rp],[1.2*old,min(acfout)],plottitle="period", with='impulses', axes='x1y1'),
-          plotdata(acx,rwvs,plottitle="L_w", with='lines', axes='x1y1')]]
-
-    # getperiod
-    inds = [0 for i in range(maxnumelem)]
-    localacf = [0 for i in range(winlen)]
-    period = 0
-    for a in range(1,4+1):
-      for b in range(1-a,a):
-        localacf[a*rp+b-1] = acframe[a*rp+b-1]
-    for i in range(numelem):
-      maxindex = 0
-      maxval = 0.0
-      for j in range(rp*(i+1)+i):
-        if localacf[j] > maxval:
-          maxval = localacf[j]
-          maxind = j
-        localacf[j] = 0
-      inds[i] = maxind
-    for i in range(numelem):
-      period += inds[i]/(i+1.)
-    period = period/numelem
-    #print "period", period
-
-    # checkstate 
-    if gp:
-      # context dependant model
-      acfout = [0 for i in range(winlen/4)]
-      old = 0
-      for i in range(laglen-1):
-        for a in range(timesig):
-          for b in range(1-a,a):
-            acfout[i] += acframe[a*(i+1)+b-1] * gwv[i]
-        if old < acfout[i]:
-          old = acfout[i]
-          maxi = i
-      gp = maxi
-    else:
-      # general model
-      gp = 0
-    #print "gp", gp
-    if printframe == nrframe or printframe == -1:
-      gwvs = [gwv[i]*max(acfout) for i in range(len(gwv))]
-      d += [[plotdata(acx,acfout,plottitle="comb filterbank", with='lines', axes='x1y1'),
-          plotdata(gp,old,plottitle="period", with='impulses', axes='x1y1'),
-          plotdata(acx,gwvs,plottitle="L_{gw}", with='lines', axes='x1y1')]]
-
-    if counter == 0:
-      # initial step
-      if abs(gp-rp) > 2.*constthresh:
-        flagstep = 1
-        counter  = 3
-      else:
-        flagstep = 0
-    #print "flagstep", flagstep
-    #print "rp2,rp1,rp", rp2,rp1,rp
-    acfw = [dfframe[i]*dfwv[i] for i in range(winlen)]
-
-    if counter == 1 and flagstep == 1:
-      # "3rd frame after flagstep set"
-      if abs(2.*rp-rp1- rp2) < constthresh:
-        flagconst = 1
-        counter = 0
-      else:
-        flagconst = 0
-        counter = 2
-    elif counter > 0:
-      counter -= 1
-
-    rp2 = rp1; rp1 = rp
-
-    if flagconst:
-      # "first run of new hypothesis"
-      gp = rp
-      g_mu = gp
-      timesig = 4 #FIXME
-      gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
-      flagconst = 0
-      bp = gp
-      phwv = [1 for i in range(2*laglen)]
-    elif timesig:
-      # "contex dependant"
-      bp = gp
-      if step > lastbeat:
-        phwv = [exp(-.5*(1.+j-step+lastbeat)**2/(bp/8.)) for j in range(2*laglen)]
-      else:
-        print "NOT using phase weighting"
-        phwv = [1 for i in range(2*laglen)]
-    else:
-      # "initial state"
-      bp = rp
-      phwv = [1 for i in range(2*laglen)]
-
-    while bp < 25:
-      print "WARNING, doubling the beat period"
-      bp *= 2
-
-    # 
-    phout = [0. for i in range(winlen)]
-
-    kmax = int(winlen/float(bp));
-
-    old = 0
-    for i in range(bp):
-      phout[i] = 0.
-      for k in range(kmax):
-        phout[i] += dfrev[i+bp*k] * phwv[i]
-      if phout[i] > old:
-        old = phout[i]
-        maxi = i
-    maxindex = maxi 
-    if (maxindex == winlen - 1): maxindex = 0
-    phase = 1 + maxindex
-    i = 1
-    beat = bp - phase
-    beats= []
-    if beat >= 0: beats.append(beat)
-    while beat+bp < step: 
-      beat += bp
-      beats.append(beat)
-    lastbeat = beat
-    #print beats,
-    #print "the lastbeat is", lastbeat
-
-    # plot all this
-    if printframe == nrframe or printframe == -1:
-      phwvs = [phwv[i]*max(phout) for i in range(len(phwv))]
-      d += [[plotdata(range(-laglen,0),phwvs[laglen:0:-1],plottitle="A_{gw}", with='lines',axes='x1y1'),
-          plotdata(range(-laglen,0),phout[laglen:0:-1],plottitle="df", with='lines'),
-          plotdata(-phase,old,plottitle="phase", with='impulses', axes='x1y1'),
-          plotdata([i for i in beats],[old for i in beats],plottitle="predicted", with='impulses')
-          ]]
-    #d += [[plotdata(dfx,dfwv,plottitle="phase weighting", with='lines', axes='x1y2'),
-    #    plotdata(dfx,dfrev,plottitle="df reverse", with='lines', axes='x1y1')]]
-    #d += [[plotdata(dfx,phout,plottitle="phase", with='lines', axes='x1y2')]]
-    #d += [[plotdata(dfx,dfwv,plottitle="phase weighting", with='lines', axes='x1y2'),
-    #    plotdata(dfx,dfrev,plottitle="df reverse", with='lines', axes='x1y1')]]
-    #d += [[plotdata(dfx,phout,plottitle="phase", with='lines', axes='x1y2')]]
-
-      f('set lmargin 4')
-      f('set rmargin 4')
-      f('set size %f,%f' % (1.0*xsize,1.0*ysize) )
-      f('set key spacing 1.3')
-      f('set multiplot')
-
-      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
-      f('set xrange [%f:%f]' % (-winlen,0) )
-      f.title('Onset detection function')
-      f.xlabel('time (df samples)')
-      f.plot(*d[0])
-      f('set size %f,%f' % (0.5*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
-      f('set xrange [%f:%f]' % (0,laglen) )
-      f.title('Period detection: Rayleygh weighting')
-      f.xlabel('lag (df samples)')
-      f.plot(*d[1])
-      f('set size %f,%f' % (0.5*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.5*xsize,0.33*ysize) )
-      f('set xrange [%f:%f]' % (0,laglen) )
-      f.title('Period detection: Gaussian weighting')
-      f.xlabel('lag (df samples)')
-      f.plot(*d[2])
-      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.00*ysize) )
-      f('set xrange [%f:%f]' % (-laglen,laglen) )
-      f.title('Phase detection and predicted beats')
-      f.xlabel('time (df samples)')
-      f.plot(*d[3])
-      f('set nomultiplot')
-    if printframe == -1: a = sys.stdin.read()
-    elif 0 < printframe and printframe < nrframe:
-      break
--- a/python/test/bench/tempo/demo-tempo-acf
+++ /dev/null
@@ -1,157 +1,0 @@
-#! /usr/bin/python
-
-""" this file was written by Paul Brossier 
-  it is released under the GNU/GPL license.
-"""
-
-import sys,time
-from aubio.task import taskbeat,taskparams
-from aubio.aubioclass import fvec, aubio_autocorr
-from aubio.gnuplot import gnuplot_create, gnuplot_addargs
-from aubio.aubiowrapper import *
-from math import exp,log
-
-usage = "usage: %s [options] -i soundfile" % sys.argv[0]
-
-def parse_args():
-        from optparse import OptionParser
-        parser = OptionParser(usage=usage)
-        parser.add_option("-i","--input",
-                          action="store", dest="filename", 
-                          help="input sound file")
-        parser.add_option("-n","--printframe",
-                          action="store", dest="printframe", default=-1, 
-                          help="make a plot of the n_th frame")
-        gnuplot_addargs(parser)
-        (options, args) = parser.parse_args()
-        if not options.filename: 
-                 print "no file name given\n", usage
-                 sys.exit(1)
-        return options, args
-
-def plotdata(x,y,plottitle="",**keyw):
-	import Gnuplot
-	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
-
-options, args = parse_args()
-filename = options.filename
-xsize = float(options.xsize)
-ysize = float(options.ysize)
-
-printframe = int(options.printframe)
-
-if options.outplot and printframe > 0: 
-  extension = options.outplot.split('.')[-1] 
-  outplot = '.'.join(options.outplot.split('.')[:-1])
-else: 
-  extension = ''
-  outplot = None
-f = gnuplot_create(outplot,extension,options)
-
-params = taskparams()
-params.onsetmode = 'specdiff'
-task = taskbeat(filename,params=params)
-
-hopsize = params.hopsize
-bufsize = params.bufsize
-btstep = task.btstep
-winlen = task.btwinlen
-laglen = winlen/4
-step = winlen/4
-
-timesig = 0
-maxnumelem = 4
-gp = 0
-counter = 0
-flagconst = 0
-constthresh = 3.901
-g_var      = 3.901
-rp = 0
-rp1 = 0
-rp2 = 0
-g_mu = 0
-
-rayparam = 48/512.*winlen
-
-t     = [i for i in range(hopsize)]
-#tlong = [i for i in range(hopsize*(btstep-1))]
-#tall  = [i for i in range(hopsize*btstep)]
-sig    = [0 for i in range(hopsize*btstep*4)]
-dfx = [i for i in range(winlen)]
-dfframe = [0 for i in range(winlen)]
-dfrev = [0 for i in range(winlen)]
-acframe = [0 for i in range(winlen/2)]
-
-localacf = [0 for i in range(winlen)]
-inds = [0 for i in range(maxnumelem)]
-
-acx = [i for i in range(laglen)]
-acfout  = [0 for i in range(laglen)]
-
-phwv  = [0 for i in range(2*laglen)]
-phwvx = [i for i in range(2*laglen)]
-
-dfwvnorm = exp(log(2.0)*(winlen+2.)/rayparam);
-dfwv = [exp(log(2.)*(i+1.)/rayparam)/dfwvnorm for i in range(winlen)]
-
-gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
-rwv = [(i+1.)/rayparam**2 * exp(-(i+1.)**2 / (2.*rayparam)**2)
-        for i in range(0,laglen)] 
-acf = fvec(winlen,1)
-
-nrframe = 0
-while (task.readsize == params.hopsize):
-  task()
-  #print task.pos2
-  sig[:-hopsize] = [i for i in sig[-(btstep*4-1)*hopsize:]]
-  sig[-hopsize:] = [task.myvec.get(i,0) for i in t]
-
-  #g('set xrange [%f:%f]' % (t[0],t[-1]))
-  #time.sleep(.2)
-  if task.pos2==btstep-1:
-    nrframe += 1
-    dfframe = [task.dfframe.get(i,0) for i in range(winlen)]
-    # start beattracking_do
-    for i in range(winlen):
-      dfrev[winlen-1-i] = 0.
-      dfrev[winlen-1-i] = dfframe[i]*dfwv[i]
-    aubio_autocorr(task.dfframe(),acf()); 
-    acframe = [acf.get(i,0) for i in range(winlen/2)]
-    if printframe == nrframe or printframe == -1:
-      d  = [[plotdata(range(0,btstep*hopsize*4,4),sig[0:-1:4],plottitle="input signal", with='lines')]]
-      d  += [[plotdata(range(-winlen,0),dfframe,plottitle="onset detection", with='lines')]]
-      d  += [[plotdata(range(winlen/2),acframe,plottitle="autocorrelation", with='lines')]]
-
-    # plot all this
-    if printframe == nrframe or printframe == -1:
-
-      f('set lmargin 4')
-      f('set rmargin 4')
-      f('set size %f,%f' % (1.0*xsize,1.0*ysize) )
-      f('set key spacing 1.3')
-      f('set multiplot')
-
-      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
-      f('set xrange [%f:%f]' % (0,btstep*hopsize*4) )
-      f('set yrange [%f:%f]' % (-1.2*max(sig),1.2*max(sig)) )
-      f.title('Input signal')
-      f.xlabel('time (samples)')
-      f.plot(*d[0])
-      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
-      f('set xrange [%f:%f]' % (-winlen,0) )
-      f('set autoscale y')
-      f.title('Onset detection function')
-      f.xlabel('time (df samples)')
-      f.plot(*d[1])
-      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
-      f('set orig %f,%f' % (0.0*xsize,0.00*ysize) )
-      f('set xrange [%f:%f]' % (0,winlen/2) )
-      f.title('Autocorrelation')
-      f.xlabel('lag (df samples)')
-      f.plot(*d[2])
-      f('set nomultiplot')
-    if printframe == -1: a = sys.stdin.read()
-    elif 0 < printframe and printframe < nrframe:
-      break
--- a/python/test/cvec.py
+++ /dev/null
@@ -1,51 +1,0 @@
-import unittest
-
-from aubio.aubiowrapper import *
-
-buf_size = 2048
-channels = 3
-
-class cvec_test_case(unittest.TestCase):
-
-  def setUp(self):
-    self.vector = new_cvec(buf_size, channels)
-
-  def tearDown(self):
-    del_cvec(self.vector)
-
-  def test_cvec(self):
-    """ create and delete cvec """
-    pass
-
-  def test_cvec_read_norm(self):
-    """ check new cvec norm elements are set to 0. """
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        self.assertEqual(cvec_read_norm(self.vector,channel,index),0.)
-
-  def test_cvec_read_phas(self):
-    """ check new cvec phas elements are set to 0. """
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        self.assertEqual(cvec_read_phas(self.vector,channel,index),0.)
-
-  def test_cvec_write_norm(self):
-    """ check new cvec norm elements are set with cvec_write_norm """
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        cvec_write_norm(self.vector,1.,channel,index)
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        self.assertEqual(cvec_read_norm(self.vector,channel,index),1.)
-
-  def test_cvec_write_phas(self):
-    """ check new cvec phas elements are set with cvec_write_phas """
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        cvec_write_phas(self.vector,1.,channel,index)
-    for index in range(buf_size/2+1):
-      for channel in range(channels):
-        self.assertEqual(cvec_read_phas(self.vector,channel,index),1.)
-
-if __name__ == '__main__':
-  unittest.main()
--- a/python/test/fvec.py
+++ /dev/null
@@ -1,36 +1,0 @@
-import unittest
-
-from aubio.aubiowrapper import *
-
-buf_size = 2048
-channels = 3
-
-class fvec_test_case(unittest.TestCase):
-
-  def setUp(self):
-    self.vector = new_fvec(buf_size, channels)
-
-  def tearDown(self):
-    del_fvec(self.vector)
-
-  def test_fvec(self):
-    """ create and delete fvec """
-    pass
-
-  def test_fvec_read_sample(self):
-    """ check new fvec elements are set to 0. """
-    for index in range(buf_size):
-      for channel in range(channels):
-        self.assertEqual(fvec_read_sample(self.vector,channel,index),0.)
-
-  def test_fvec_write_sample(self):
-    """ check new fvec elements are set with fvec_write_sample """
-    for index in range(buf_size):
-      for channel in range(channels):
-        fvec_write_sample(self.vector,1.,channel,index)
-    for index in range(buf_size):
-      for channel in range(channels):
-        self.assertEqual(fvec_read_sample(self.vector,channel,index),1.)
-
-if __name__ == '__main__':
-  unittest.main()
--- a/python/test/list_missing_tests
+++ /dev/null
@@ -1,30 +1,0 @@
-#! /usr/bin/python
-
-from glob import glob
-from os.path import splitext, exists
-import sys
-
-if len(sys.argv) > 1: verbose = True
-else: verbose = False
-
-cfiles = [ file.split('/')[-1] for file in glob('../../src/*.c') ]
-cfiles.sort()
-
-for cfile in cfiles: 
-  pythonfile=splitext(cfile)[0]+'.py'
-  if not exists(pythonfile):
-    print "[X] %30s" % cfile, "[ ] %30s" % pythonfile
-    #print cfile, "has NO test", pythonfile
-  elif verbose:
-    print "[X] %30s" % cfile, "[X] %30s" % pythonfile
-
-pythonfiles = [ file.split('/')[-1] for file in glob('*.py') ]
-pythonfiles.sort()
-
-for pythonfile in pythonfiles: 
-  cfile=splitext(pythonfile)[0]+'.c'
-  if not exists('../../'+cfile):
-    print "[ ] %30s" % cfile, "[X] %30s" % pythonfile
-    #print pythonfile, "has NO source", cfile
-  elif verbose:
-    print "[X] %30s" % cfile, "[X] %30s" % pythonfile
--- a/python/test/run_all_tests
+++ /dev/null
@@ -1,15 +1,0 @@
-#! /usr/bin/python
-
-# add ${src}/python and ${src}/python/aubio/.libs to python path
-# so the script is runnable from a compiled source tree.
-import sys, os
-sys.path.append('..')
-sys.path.append(os.path.join('..','aubio','.libs'))
-
-import unittest
-
-modules_to_test = ['aubiomodule', 'fvec', 'cvec']
-
-if __name__ == '__main__':
-  for module in modules_to_test: exec('from %s import *' % module)
-  unittest.main()
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,8 @@
 	mathutils.h \
 	fft.h \
 	sample.h \
+	fvec.h \
+	cvec.h \
 	hist.h \
 	scale.h \
 	resample.h \
@@ -33,8 +35,10 @@
 	mathutils.h \
 	fft.c \
 	fft.h \
-	sample.c \
-	sample.h \
+	fvec.c \
+	fvec.h \
+	cvec.c \
+	cvec.h \
 	hist.c \
 	hist.h \
 	scale.c \
--- a/src/aubio.h
+++ b/src/aubio.h
@@ -1,20 +1,20 @@
 /*
-	 Copyright (C) 2003 Paul Brossier <piem@altern.org>
+   Copyright (C) 2003 Paul Brossier <piem@altern.org>
 
-	 This program is free software; you can redistribute it and/or modify
-	 it under the terms of the GNU General Public License as published by
-	 the Free Software Foundation; either version 2 of the License, or
-	 (at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-	 This program is distributed in the hope that it will be useful,
-	 but WITHOUT ANY WARRANTY; without even the implied warranty of
-	 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-	 GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-	 You should have received a copy of the GNU General Public License
-	 along with this program; if not, write to the Free Software
-	 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-	 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   
 */
 
 /** \mainpage 
@@ -21,15 +21,15 @@
  *
  * \section whatis Introduction
  *
- * 	Aubio is a library for audio labelling: it provides functions for pitch
- * 	estimation, onset detection, beat tracking, and other annotation tasks.
+ *  Aubio is a library for audio labelling: it provides functions for pitch
+ *  estimation, onset detection, beat tracking, and other annotation tasks.
  *
  *  \verbinclude README
  *
  * \section bugs bugs and todo
  *
- *	This software is under development. It needs debugging and
- *	optimisations.
+ *  This software is under development. It needs debugging and
+ *  optimisations.
  *
  *  See <a href='bug.html'>bugs</a> and <a href='todo.html'>todo</a> lists.
  * 
--- /dev/null
+++ b/src/cvec.c
@@ -1,0 +1,82 @@
+/*
+   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "aubio_priv.h"
+#include "cvec.h"
+
+cvec_t * new_cvec( uint_t length, uint_t channels) {
+  cvec_t * s = AUBIO_NEW(cvec_t);
+  uint_t i,j;
+  s->channels = channels;
+  s->length = length/2 + 1;
+  s->norm = AUBIO_ARRAY(smpl_t*,s->channels);
+  s->phas = AUBIO_ARRAY(smpl_t*,s->channels);
+  for (i=0; i< s->channels; i++) {
+    s->norm[i] = AUBIO_ARRAY(smpl_t,s->length);
+    s->phas[i] = AUBIO_ARRAY(smpl_t,s->length);
+    for (j=0; j< s->length; j++) {
+      s->norm[i][j]=0.;
+      s->phas[i][j]=0.;
+    }
+  }
+  return s;
+}
+
+void del_cvec(cvec_t *s) {
+  uint_t i;
+  for (i=0; i<s->channels; i++) {
+    AUBIO_FREE(s->norm[i]);
+    AUBIO_FREE(s->phas[i]);
+  }
+  AUBIO_FREE(s->norm);
+  AUBIO_FREE(s->phas);
+  AUBIO_FREE(s);
+}
+
+void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position) {
+  s->norm[channel][position] = data;
+}
+void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position) {
+  s->phas[channel][position] = data;
+}
+smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position) {
+  return s->norm[channel][position];
+}
+smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position) {
+  return s->phas[channel][position];
+}
+void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel) {
+  s->norm[channel] = data;
+}
+void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel) {
+  s->phas[channel] = data;
+}
+smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel) {
+  return s->norm[channel];
+}
+smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel) {
+  return s->phas[channel];
+}
+smpl_t ** cvec_get_norm(cvec_t *s) {
+  return s->norm;
+}
+smpl_t ** cvec_get_phas(cvec_t *s) {
+  return s->phas;
+}
+
--- /dev/null
+++ b/src/cvec.h
@@ -1,0 +1,188 @@
+/*
+   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef _CVEC_H
+#define _CVEC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file
+
+  Real and complex buffers
+
+  This file specifies the cvec_t buffer type, which is used throughout aubio to
+  store complex data. Complex values are stored in terms of phase and
+  norm, within size/2+1 long vectors.
+
+*/
+
+/** Spectrum buffer type */
+typedef struct _cvec_t cvec_t;
+/** Buffer for complex data */
+struct _cvec_t {
+  uint_t length;   /**< length of buffer = (requested length)/2 + 1 */
+  uint_t channels; /**< number of channels */
+  smpl_t **norm;   /**< norm array of size [length] * [channels] */
+  smpl_t **phas;   /**< phase array of size [length] * [channels] */
+};
+
+/** cvec_t buffer creation function
+
+  This function creates a cvec_t structure holding two arrays of size
+  [length/2+1] * channels, corresponding to the norm and phase values of the
+  spectral frame. The length stored in the structure is the actual size of both
+  arrays, not the length of the complex and symetrical vector, specified as
+  creation argument.
+
+  \param length the length of the buffer to create
+  \param channels the number of channels in the buffer
+
+*/
+cvec_t * new_cvec(uint_t length, uint_t channels);
+/** cvec_t buffer deletion function
+
+  \param s buffer to delete as returned by new_cvec()
+
+*/
+void del_cvec(cvec_t *s);
+/** write norm value in a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->norm[channel][position]. Its purpose
+  is to access these values from wrappers, as created by swig.
+
+  \param s vector to write to 
+  \param data norm value to write in s->norm[channel][position]
+  \param channel channel to write to 
+  \param position sample position to write to
+
+*/
+void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
+/** write phase value in a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->phas[channel][position]. Its purpose
+  is to access these values from wrappers, as created by swig.
+
+  \param s vector to write to
+  \param data phase value to write in s->phas[channel][position]
+  \param channel channel to write to
+  \param position sample position to write to
+
+*/
+void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
+/** read norm value from a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->norm[channel][position]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to read from
+  \param channel channel to read from
+  \param position sample position to read from
+
+*/
+smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position);
+/** read phase value from a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->phas[channel][position]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to read from
+  \param channel channel to read from
+  \param position sample position to read from
+
+*/
+smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position);
+/** write norm channel in a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->norm[channel]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to write to
+  \param data norm vector of [length] samples to write in s->norm[channel]
+  \param channel channel to write to
+
+*/
+void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel);
+/** write phase channel in a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->phas[channel]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to write to
+  \param data phase vector of [length] samples to write in s->phas[channel]
+  \param channel channel to write to
+
+*/
+void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel);
+/** read norm channel from a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->norm[channel]. Its purpose is to access
+  these values from wrappers, as created by swig.
+
+  \param s vector to read from 
+  \param channel channel to read from
+
+*/
+smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel);
+/** write phase channel in a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->phas[channel]. Its purpose is to access
+  these values from wrappers, as created by swig.
+
+  \param s vector to read from 
+  \param channel channel to read from 
+
+*/
+smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel);
+/** read norm data from a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->norm. Its purpose is to access these values
+  from wrappers, as created by swig.
+
+  \param s vector to read from
+
+*/
+smpl_t ** cvec_get_norm(cvec_t *s);
+/** read phase data from a complex buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->phas. Its purpose is to access these values
+  from wrappers, as created by swig.
+
+  \param s vector to read from
+
+*/
+smpl_t ** cvec_get_phas(cvec_t *s);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CVEC_H */
+
--- /dev/null
+++ b/src/fvec.c
@@ -1,0 +1,63 @@
+/*
+   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "aubio_priv.h"
+#include "sample.h"
+
+fvec_t * new_fvec( uint_t length, uint_t channels) {
+  fvec_t * s = AUBIO_NEW(fvec_t);
+  uint_t i,j;
+  s->channels = channels;
+  s->length = length;
+  s->data = AUBIO_ARRAY(smpl_t*,s->channels);
+  for (i=0; i< s->channels; i++) {
+    s->data[i] = AUBIO_ARRAY(smpl_t, s->length);
+    for (j=0; j< s->length; j++) {
+      s->data[i][j]=0.;
+    }
+  }
+  return s;
+}
+
+void del_fvec(fvec_t *s) {
+  uint_t i;
+  for (i=0; i<s->channels; i++) {
+    AUBIO_FREE(s->data[i]);
+  }
+  AUBIO_FREE(s->data);
+  AUBIO_FREE(s);
+}
+
+void fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position) {
+  s->data[channel][position] = data;
+}
+smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position) {
+  return s->data[channel][position];
+}
+void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel) {
+  s->data[channel] = data;
+}
+smpl_t * fvec_get_channel(fvec_t *s, uint_t channel) {
+  return s->data[channel];
+}
+
+smpl_t ** fvec_get_data(fvec_t *s) {
+  return s->data;
+}
+
--- /dev/null
+++ b/src/fvec.h
@@ -1,0 +1,120 @@
+/*
+   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef _FVEC_H
+#define _FVEC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file
+
+  Real buffers
+
+  This file specifies the fvec_t buffer type, which is used throughout aubio to
+  store real data.
+
+*/
+
+/** Sample buffer type */
+typedef struct _fvec_t fvec_t;
+/** Buffer for real values */
+struct _fvec_t {
+  uint_t length;   /**< length of buffer */
+  uint_t channels; /**< number of channels */
+  smpl_t **data;   /**< data array of size [length] * [channels] */
+};
+/** fvec_t buffer creation function
+
+  \param length the length of the buffer to create
+  \param channels the number of channels in the buffer
+
+*/
+fvec_t * new_fvec(uint_t length, uint_t channels);
+/** fvec_t buffer deletion function
+
+  \param s buffer to delete as returned by new_fvec()
+
+*/
+void del_fvec(fvec_t *s);
+/** read sample value in a buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained using vec->data[channel][position]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to read from
+  \param channel channel to read from
+  \param position sample position to read from 
+
+*/
+smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position);
+/** write sample value in a buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->data[channel][position]. Its purpose
+  is to access these values from wrappers, as created by swig.
+
+  \param s vector to write to 
+  \param data value to write in s->data[channel][position]
+  \param channel channel to write to 
+  \param position sample position to write to 
+
+*/
+void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position);
+/** read channel vector from a buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->data[channel]. Its purpose is to access
+  these values from wrappers, as created by swig.
+
+  \param s vector to read from
+  \param channel channel to read from
+
+*/
+smpl_t * fvec_get_channel(fvec_t *s, uint_t channel);
+/** write channel vector into a buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained by assigning vec->data[channel]. Its purpose is to
+  access these values from wrappers, as created by swig.
+
+  \param s vector to write to 
+  \param data vector of [length] values to write
+  \param channel channel to write to 
+
+*/
+void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel);
+/** read data from a buffer
+
+  Note that this function is not used in the aubio library, since the same
+  result can be obtained with vec->data. Its purpose is to access these values
+  from wrappers, as created by swig.
+
+  \param s vector to read from
+
+*/
+smpl_t ** fvec_get_data(fvec_t *s);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FVEC_H */
--- a/src/pitchdetection.c
+++ b/src/pitchdetection.c
@@ -14,7 +14,7 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+   */
 
 #include "aubio_priv.h"
 #include "sample.h"
@@ -28,16 +28,18 @@
 #include "pitchyinfft.h"
 #include "pitchdetection.h"
 
-typedef smpl_t (*aubio_pitchdetection_func_t)(aubio_pitchdetection_t *p, 
-                fvec_t * ibuf);
-typedef smpl_t (*aubio_pitchdetection_conv_t)(smpl_t value,uint_t srate,uint_t bufsize);
+typedef smpl_t (*aubio_pitchdetection_func_t)
+  (aubio_pitchdetection_t *p, fvec_t * ibuf);
+typedef smpl_t (*aubio_pitchdetection_conv_t)
+  (smpl_t value, uint_t srate, uint_t bufsize);
+
 void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf);
 
-smpl_t aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t * ibuf);
-smpl_t aubio_pitchdetection_yin(aubio_pitchdetection_t *p, fvec_t *ibuf);
-smpl_t aubio_pitchdetection_schmitt(aubio_pitchdetection_t *p, fvec_t *ibuf);
-smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf);
-smpl_t aubio_pitchdetection_yinfft(aubio_pitchdetection_t *p, fvec_t *ibuf);
+smpl_t aubio_pitchdetection_mcomb   (aubio_pitchdetection_t *p, fvec_t *ibuf);
+smpl_t aubio_pitchdetection_yin     (aubio_pitchdetection_t *p, fvec_t *ibuf);
+smpl_t aubio_pitchdetection_schmitt (aubio_pitchdetection_t *p, fvec_t *ibuf);
+smpl_t aubio_pitchdetection_fcomb   (aubio_pitchdetection_t *p, fvec_t *ibuf);
+smpl_t aubio_pitchdetection_yinfft  (aubio_pitchdetection_t *p, fvec_t *ibuf);
 
 /** generic pitch detection structure */
 struct _aubio_pitchdetection_t {
@@ -63,183 +65,181 @@
  * should probably be rewritten with #defines */
 smpl_t freqconvbin(smpl_t f,uint_t srate,uint_t bufsize);
 smpl_t freqconvbin(smpl_t f,uint_t srate,uint_t bufsize){
-        return aubio_freqtobin(f,srate,bufsize);
+  return aubio_freqtobin(f,srate,bufsize);
 }
 
 smpl_t freqconvmidi(smpl_t f,uint_t srate,uint_t bufsize);
 smpl_t freqconvmidi(smpl_t f,uint_t srate UNUSED,uint_t bufsize UNUSED){
-        return aubio_freqtomidi(f);
+  return aubio_freqtomidi(f);
 }
 
 smpl_t freqconvpass(smpl_t f,uint_t srate,uint_t bufsize);
 smpl_t freqconvpass(smpl_t f,uint_t srate UNUSED,uint_t bufsize UNUSED){
-        return f;
+  return f;
 }
 
 aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, 
-		uint_t hopsize, 
-		uint_t channels,
-		uint_t samplerate,
-		aubio_pitchdetection_type type,
-		aubio_pitchdetection_mode mode)
+    uint_t hopsize, 
+    uint_t channels,
+    uint_t samplerate,
+    aubio_pitchdetection_type type,
+    aubio_pitchdetection_mode mode)
 {
-	aubio_pitchdetection_t *p = AUBIO_NEW(aubio_pitchdetection_t);
-	p->srate = samplerate;
-	p->type = type;
-	p->mode = mode;
-	p->bufsize = bufsize;
-	switch(p->type) {
-		case aubio_pitch_yin:
-			p->buf      = new_fvec(bufsize,channels);
-			p->yin      = new_fvec(bufsize/2,channels);
-                        p->callback = aubio_pitchdetection_yin;
-			p->yinthres = 0.15;
-			break;
-		case aubio_pitch_mcomb:
-			p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
-			p->fftgrain = new_cvec(bufsize, channels);
-			p->mcomb    = new_aubio_pitchmcomb(bufsize,hopsize,channels,samplerate);
-			p->filter   = new_aubio_cdsgn_filter(samplerate);
-                        p->callback = aubio_pitchdetection_mcomb;
-			break;
-                case aubio_pitch_fcomb:
-			p->buf      = new_fvec(bufsize,channels);
-                        p->fcomb    = new_aubio_pitchfcomb(bufsize,hopsize,samplerate);
-                        p->callback = aubio_pitchdetection_fcomb;
-                        break;
-                case aubio_pitch_schmitt:
-			p->buf      = new_fvec(bufsize,channels);
-                        p->schmitt  = new_aubio_pitchschmitt(bufsize,samplerate);
-                        p->callback = aubio_pitchdetection_schmitt;
-                        break;
-		case aubio_pitch_yinfft:
-			p->buf      = new_fvec(bufsize,channels);
-                        p->yinfft   = new_aubio_pitchyinfft(bufsize);
-                        p->callback = aubio_pitchdetection_yinfft;
-			p->yinthres = 0.85;
-                        break;
-                default:
-                        break;
-	}
-	switch(p->mode) {
-		case aubio_pitchm_freq:
-                        p->freqconv = freqconvpass;
-                        break;
-		case aubio_pitchm_midi:
-                        p->freqconv = freqconvmidi;
-                        break;
-		case aubio_pitchm_cent:
-                        /* bug: not implemented */
-                        p->freqconv = freqconvmidi;
-                        break;
-		case aubio_pitchm_bin:
-                        p->freqconv = freqconvbin;
-                        break;
-                default:
-                        break;
-        }
-	return p;
+  aubio_pitchdetection_t *p = AUBIO_NEW(aubio_pitchdetection_t);
+  p->srate = samplerate;
+  p->type = type;
+  p->mode = mode;
+  p->bufsize = bufsize;
+  switch(p->type) {
+    case aubio_pitch_yin:
+      p->buf      = new_fvec(bufsize,channels);
+      p->yin      = new_fvec(bufsize/2,channels);
+      p->callback = aubio_pitchdetection_yin;
+      p->yinthres = 0.15;
+      break;
+    case aubio_pitch_mcomb:
+      p->pv       = new_aubio_pvoc(bufsize, hopsize, channels);
+      p->fftgrain = new_cvec(bufsize, channels);
+      p->mcomb    = new_aubio_pitchmcomb(bufsize,hopsize,channels,samplerate);
+      p->filter   = new_aubio_cdsgn_filter(samplerate);
+      p->callback = aubio_pitchdetection_mcomb;
+      break;
+    case aubio_pitch_fcomb:
+      p->buf      = new_fvec(bufsize,channels);
+      p->fcomb    = new_aubio_pitchfcomb(bufsize,hopsize,samplerate);
+      p->callback = aubio_pitchdetection_fcomb;
+      break;
+    case aubio_pitch_schmitt:
+      p->buf      = new_fvec(bufsize,channels);
+      p->schmitt  = new_aubio_pitchschmitt(bufsize,samplerate);
+      p->callback = aubio_pitchdetection_schmitt;
+      break;
+    case aubio_pitch_yinfft:
+      p->buf      = new_fvec(bufsize,channels);
+      p->yinfft   = new_aubio_pitchyinfft(bufsize);
+      p->callback = aubio_pitchdetection_yinfft;
+      p->yinthres = 0.85;
+      break;
+    default:
+      break;
+  }
+  switch(p->mode) {
+    case aubio_pitchm_freq:
+      p->freqconv = freqconvpass;
+      break;
+    case aubio_pitchm_midi:
+      p->freqconv = freqconvmidi;
+      break;
+    case aubio_pitchm_cent:
+      /* bug: not implemented */
+      p->freqconv = freqconvmidi;
+      break;
+    case aubio_pitchm_bin:
+      p->freqconv = freqconvbin;
+      break;
+    default:
+      break;
+  }
+  return p;
 }
 
 void del_aubio_pitchdetection(aubio_pitchdetection_t * p) {
-	switch(p->type) {
-		case aubio_pitch_yin:
-			del_fvec(p->yin);
-			del_fvec(p->buf);
-			break;
-		case aubio_pitch_mcomb:
-			del_aubio_pvoc(p->pv);
-			del_cvec(p->fftgrain);
-			del_aubio_pitchmcomb(p->mcomb);
-			break;
-                case aubio_pitch_schmitt:
-			del_fvec(p->buf);
-                        del_aubio_pitchschmitt(p->schmitt);
-                        break;
-                case aubio_pitch_fcomb:
-			del_fvec(p->buf);
-                        del_aubio_pitchfcomb(p->fcomb);
-                        break;
-                case aubio_pitch_yinfft:
-			del_fvec(p->buf);
-                        del_aubio_pitchyinfft(p->yinfft);
-                        break;
-		default:
-			break;
-	}
-	AUBIO_FREE(p);
+  switch(p->type) {
+    case aubio_pitch_yin:
+      del_fvec(p->yin);
+      del_fvec(p->buf);
+      break;
+    case aubio_pitch_mcomb:
+      del_aubio_pvoc(p->pv);
+      del_cvec(p->fftgrain);
+      del_aubio_pitchmcomb(p->mcomb);
+      break;
+    case aubio_pitch_schmitt:
+      del_fvec(p->buf);
+      del_aubio_pitchschmitt(p->schmitt);
+      break;
+    case aubio_pitch_fcomb:
+      del_fvec(p->buf);
+      del_aubio_pitchfcomb(p->fcomb);
+      break;
+    case aubio_pitch_yinfft:
+      del_fvec(p->buf);
+      del_aubio_pitchyinfft(p->yinfft);
+      break;
+    default:
+      break;
+  }
+  AUBIO_FREE(p);
 }
 
 void aubio_pitchdetection_slideblock(aubio_pitchdetection_t *p, fvec_t *ibuf){
-        uint_t i,j = 0, overlap_size = 0;
-        overlap_size = p->buf->length-ibuf->length;
-        for (i=0;i<p->buf->channels;i++){
-                for (j=0;j<overlap_size;j++){
-                        p->buf->data[i][j] = 
-                                p->buf->data[i][j+ibuf->length];
-                }
-        }
-        for (i=0;i<ibuf->channels;i++){
-                for (j=0;j<ibuf->length;j++){
-                        p->buf->data[i][j+overlap_size] = 
-                                ibuf->data[i][j];
-                }
-        }
-}
+  uint_t i,j = 0, overlap_size = 0;
+  overlap_size = p->buf->length-ibuf->length;
+  for (i=0;i<p->buf->channels;i++){
+    for (j=0;j<overlap_size;j++){
+      p->buf->data[i][j] = p->buf->data[i][j+ibuf->length];
+    }
+  }
+  for (i=0;i<ibuf->channels;i++){
+    for (j=0;j<ibuf->length;j++){
+      p->buf->data[i][j+overlap_size] = ibuf->data[i][j];
+    }
+  }
+}
 
 void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres) {
-        p->yinthres = thres;
+  p->yinthres = thres;
 }
 
 smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) {
-        return p->freqconv(p->callback(p,ibuf),p->srate,p->bufsize);
+  return p->freqconv(p->callback(p,ibuf),p->srate,p->bufsize);
 }
 
 smpl_t aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t *ibuf) {
-	smpl_t pitch = 0.;
-	aubio_filter_do(p->filter,ibuf);
-        aubio_pvoc_do(p->pv,ibuf,p->fftgrain);
-        pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain);
-        /** \bug should move the >0 check within aubio_bintofreq */
-        if (pitch>0.) {
-                pitch = aubio_bintofreq(pitch,p->srate,p->bufsize);
-        } else {
-                pitch = 0.;
-        }
-        return pitch;
+  smpl_t pitch = 0.;
+  aubio_filter_do(p->filter,ibuf);
+  aubio_pvoc_do(p->pv,ibuf,p->fftgrain);
+  pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain);
+  /** \bug should move the >0 check within aubio_bintofreq */
+  if (pitch>0.) {
+    pitch = aubio_bintofreq(pitch,p->srate,p->bufsize);
+  } else {
+    pitch = 0.;
+  }
+  return pitch;
 }
 
 smpl_t aubio_pitchdetection_yin(aubio_pitchdetection_t *p, fvec_t *ibuf) {
-	smpl_t pitch = 0.;
-        aubio_pitchdetection_slideblock(p,ibuf);
-        pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, p->yinthres);
-        if (pitch>0) {
-                pitch = p->srate/(pitch+0.);
-        } else {
-                pitch = 0.;
-        }
-        return pitch;
+  smpl_t pitch = 0.;
+  aubio_pitchdetection_slideblock(p,ibuf);
+  pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, p->yinthres);
+  if (pitch>0) {
+    pitch = p->srate/(pitch+0.);
+  } else {
+    pitch = 0.;
+  }
+  return pitch;
 }
 
 
 smpl_t aubio_pitchdetection_yinfft(aubio_pitchdetection_t *p, fvec_t *ibuf){
-	smpl_t pitch = 0.;
-	aubio_pitchdetection_slideblock(p,ibuf);
-	pitch = aubio_pitchyinfft_detect(p->yinfft,p->buf,p->yinthres);
-        if (pitch>0) {
-                pitch = p->srate/(pitch+0.);
-        } else {
-                pitch = 0.;
-        }
-	return pitch; 
+  smpl_t pitch = 0.;
+  aubio_pitchdetection_slideblock(p,ibuf);
+  pitch = aubio_pitchyinfft_detect(p->yinfft,p->buf,p->yinthres);
+  if (pitch>0) {
+    pitch = p->srate/(pitch+0.);
+  } else {
+    pitch = 0.;
+  }
+  return pitch; 
 }
 
 smpl_t aubio_pitchdetection_fcomb(aubio_pitchdetection_t *p, fvec_t *ibuf){
-        aubio_pitchdetection_slideblock(p,ibuf);
-        return aubio_pitchfcomb_detect(p->fcomb,p->buf);
+  aubio_pitchdetection_slideblock(p,ibuf);
+  return aubio_pitchfcomb_detect(p->fcomb,p->buf);
 }
 
 smpl_t aubio_pitchdetection_schmitt(aubio_pitchdetection_t *p, fvec_t *ibuf){
-        aubio_pitchdetection_slideblock(p,ibuf);
-        return aubio_pitchschmitt_detect(p->schmitt,p->buf);
+  aubio_pitchdetection_slideblock(p,ibuf);
+  return aubio_pitchschmitt_detect(p->schmitt,p->buf);
 }
--- a/src/pitchdetection.h
+++ b/src/pitchdetection.h
@@ -14,7 +14,7 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+   */
 
 #ifndef PITCHAUTOTCORR_H
 #define PITCHAUTOTCORR_H
@@ -25,7 +25,7 @@
 
 /** \file
 
-  Generic method for pitch detection  
+  Generic method for pitch detection
 
   This file creates the objects required for the computation of the selected
   pitch detection algorithm and output the results, in midi note or Hz.
@@ -34,19 +34,19 @@
 
 /** pitch detection algorithm */
 typedef enum {
-        aubio_pitch_yin,     /**< YIN algorithm */
-        aubio_pitch_mcomb,   /**< Multi-comb filter */
-        aubio_pitch_schmitt, /**< Schmitt trigger */
-        aubio_pitch_fcomb,   /**< Fast comb filter */
-        aubio_pitch_yinfft   /**< Spectral YIN */
+  aubio_pitch_yin,     /**< YIN algorithm */
+  aubio_pitch_mcomb,   /**< Multi-comb filter */
+  aubio_pitch_schmitt, /**< Schmitt trigger */
+  aubio_pitch_fcomb,   /**< Fast comb filter */
+  aubio_pitch_yinfft   /**< Spectral YIN */
 } aubio_pitchdetection_type;
 
 /** pitch detection output mode */
 typedef enum {
-        aubio_pitchm_freq,   /**< Frequency (Hz) */
-        aubio_pitchm_midi,   /**< MIDI note (0.,127) */
-        aubio_pitchm_cent,   /**< Cent */
-        aubio_pitchm_bin     /**< Frequency bin (0,bufsize) */
+  aubio_pitchm_freq,   /**< Frequency (Hz) */
+  aubio_pitchm_midi,   /**< MIDI note (0.,127) */
+  aubio_pitchm_cent,   /**< Cent */
+  aubio_pitchm_bin     /**< Frequency bin (0,bufsize) */
 } aubio_pitchdetection_mode;
 
 /** pitch detection object */
@@ -53,46 +53,46 @@
 typedef struct _aubio_pitchdetection_t aubio_pitchdetection_t;
 
 /** execute pitch detection on an input signal frame
- 
+
   \param p pitch detection object as returned by new_aubio_pitchdetection
-  \param ibuf input signal of length hopsize 
- 
+  \param ibuf input signal of length hopsize
+
 */
 smpl_t aubio_pitchdetection(aubio_pitchdetection_t * p, fvec_t * ibuf);
 
 /** change yin or yinfft tolerance threshold
-  
+
   default is 0.15 for yin and 0.85 for yinfft
- 
+
 */
 void aubio_pitchdetection_set_yinthresh(aubio_pitchdetection_t *p, smpl_t thres);
 
 /** deletion of the pitch detection object
- 
+
   \param p pitch detection object as returned by new_aubio_pitchdetection
- 
+
 */
 void del_aubio_pitchdetection(aubio_pitchdetection_t * p);
 
 /** creation of the pitch detection object
- 
-  \param bufsize size of the input buffer to analyse 
-  \param hopsize step size between two consecutive analysis instant 
+
+  \param bufsize size of the input buffer to analyse
+  \param hopsize step size between two consecutive analysis instant
   \param channels number of channels to analyse
-  \param samplerate sampling rate of the signal 
+  \param samplerate sampling rate of the signal
   \param type set pitch detection algorithm
   \param mode set pitch units for output
- 
+
 */
-aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize, 
-        uint_t hopsize, 
-        uint_t channels,
-        uint_t samplerate,
-        aubio_pitchdetection_type type,
-        aubio_pitchdetection_mode mode);
+aubio_pitchdetection_t * new_aubio_pitchdetection(uint_t bufsize,
+    uint_t hopsize,
+    uint_t channels,
+    uint_t samplerate,
+    aubio_pitchdetection_type type,
+    aubio_pitchdetection_mode mode);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /*PITCHDETECTION_H*/ 
+#endif /*PITCHDETECTION_H*/
--- a/src/sample.c
+++ /dev/null
@@ -1,122 +1,0 @@
-/*
-   Copyright (C) 2003 Paul Brossier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "aubio_priv.h"
-#include "sample.h"
-
-fvec_t * new_fvec( uint_t length, uint_t channels) {
-  fvec_t * s = AUBIO_NEW(fvec_t);
-  uint_t i,j;
-  s->channels = channels;
-  s->length = length;
-  s->data = AUBIO_ARRAY(smpl_t*,s->channels);
-  for (i=0; i< s->channels; i++) {
-    s->data[i] = AUBIO_ARRAY(smpl_t, s->length);
-    for (j=0; j< s->length; j++) {
-      s->data[i][j]=0.;
-    }
-  }
-  return s;
-}
-
-void del_fvec(fvec_t *s) {
-  uint_t i;
-  for (i=0; i<s->channels; i++) {
-    AUBIO_FREE(s->data[i]);
-  }
-  AUBIO_FREE(s->data);
-  AUBIO_FREE(s);
-}
-
-void fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position) {
-  s->data[channel][position] = data;
-}
-smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position) {
-  return s->data[channel][position];
-}
-void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel) {
-  s->data[channel] = data;
-}
-smpl_t * fvec_get_channel(fvec_t *s, uint_t channel) {
-  return s->data[channel];
-}
-
-smpl_t ** fvec_get_data(fvec_t *s) {
-  return s->data;
-}
-
-cvec_t * new_cvec( uint_t length, uint_t channels) {
-  cvec_t * s = AUBIO_NEW(cvec_t);
-  uint_t i,j;
-  s->channels = channels;
-  s->length = length/2 + 1;
-  s->norm = AUBIO_ARRAY(smpl_t*,s->channels);
-  s->phas = AUBIO_ARRAY(smpl_t*,s->channels);
-  for (i=0; i< s->channels; i++) {
-    s->norm[i] = AUBIO_ARRAY(smpl_t,s->length);
-    s->phas[i] = AUBIO_ARRAY(smpl_t,s->length);
-    for (j=0; j< s->length; j++) {
-      s->norm[i][j]=0.;
-      s->phas[i][j]=0.;
-    }
-  }
-  return s;
-}
-
-void del_cvec(cvec_t *s) {
-  uint_t i;
-  for (i=0; i<s->channels; i++) {
-    AUBIO_FREE(s->norm[i]);
-    AUBIO_FREE(s->phas[i]);
-  }
-  AUBIO_FREE(s->norm);
-  AUBIO_FREE(s->phas);
-  AUBIO_FREE(s);
-}
-
-void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position) {
-  s->norm[channel][position] = data;
-}
-void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position) {
-  s->phas[channel][position] = data;
-}
-smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position) {
-  return s->norm[channel][position];
-}
-smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position) {
-  return s->phas[channel][position];
-}
-void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel) {
-  s->norm[channel] = data;
-}
-void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel) {
-  s->phas[channel] = data;
-}
-smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel) {
-  return s->norm[channel];
-}
-smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel) {
-  return s->phas[channel];
-}
-smpl_t ** cvec_get_norm(cvec_t *s) {
-  return s->norm;
-}
-smpl_t ** cvec_get_phas(cvec_t *s) {
-  return s->phas;
-}
--- a/src/sample.h
+++ b/src/sample.h
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2003 Paul Brossier
+   Copyright (C) 2003-2007 Paul Brossier <piem@piem.org>
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,247 +20,7 @@
 #ifndef _SAMPLE_H
 #define _SAMPLE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** \file
-
-  Real and complex buffers
-
-  This file specifies fvec_t and cvec_t buffers types, which are used
-  throughout aubio to store real and complex data. Complex values are stored in
-  terms of phase and norm.
-
-*/
-
-/** Sample buffer type */
-typedef struct _fvec_t fvec_t;
-/** Spectrum buffer type */
-typedef struct _cvec_t cvec_t;
-/** Buffer for real values */
-struct _fvec_t {
-  uint_t length;   /**< length of buffer */
-  uint_t channels; /**< number of channels */
-  smpl_t **data;   /**< data array of size [length] * [channels] */
-};
-/** Buffer for complex data */
-struct _cvec_t {
-  uint_t length;   /**< length of buffer = (requested length)/2 + 1 */
-  uint_t channels; /**< number of channels */
-  smpl_t **norm;   /**< norm array of size [length] * [channels] */
-  smpl_t **phas;   /**< phase array of size [length] * [channels] */
-};
-/** fvec_t buffer creation function
-
-  \param length the length of the buffer to create
-  \param channels the number of channels in the buffer
-
-*/
-fvec_t * new_fvec(uint_t length, uint_t channels);
-/** fvec_t buffer deletion function
-
-  \param s buffer to delete as returned by new_fvec()
-
-*/
-void del_fvec(fvec_t *s);
-/** read sample value in a buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained using vec->data[channel][position]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to read from
-  \param channel channel to read from
-  \param position sample position to read from 
-
-*/
-smpl_t fvec_read_sample(fvec_t *s, uint_t channel, uint_t position);
-/** write sample value in a buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->data[channel][position]. Its purpose
-  is to access these values from wrappers, as created by swig.
-
-  \param s vector to write to 
-  \param data value to write in s->data[channel][position]
-  \param channel channel to write to 
-  \param position sample position to write to 
-
-*/
-void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position);
-/** read channel vector from a buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->data[channel]. Its purpose is to access
-  these values from wrappers, as created by swig.
-
-  \param s vector to read from
-  \param channel channel to read from
-
-*/
-smpl_t * fvec_get_channel(fvec_t *s, uint_t channel);
-/** write channel vector into a buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->data[channel]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to write to 
-  \param data vector of [length] values to write
-  \param channel channel to write to 
-
-*/
-void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel);
-/** read data from a buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->data. Its purpose is to access these values
-  from wrappers, as created by swig.
-
-  \param s vector to read from
-
-*/
-smpl_t ** fvec_get_data(fvec_t *s);
-
-/** cvec_t buffer creation function
-
-  This function creates a cvec_t structure holding two arrays of size
-  [length/2+1] * channels, corresponding to the norm and phase values of the
-  spectral frame. The length stored in the structure is the actual size of both
-  arrays, not the length of the complex and symetrical vector, specified as
-  creation argument.
-
-  \param length the length of the buffer to create
-  \param channels the number of channels in the buffer
-
-*/
-cvec_t * new_cvec(uint_t length, uint_t channels);
-/** cvec_t buffer deletion function
-
-  \param s buffer to delete as returned by new_cvec()
-
-*/
-void del_cvec(cvec_t *s);
-/** write norm value in a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->norm[channel][position]. Its purpose
-  is to access these values from wrappers, as created by swig.
-
-  \param s vector to write to 
-  \param data norm value to write in s->norm[channel][position]
-  \param channel channel to write to 
-  \param position sample position to write to
-
-*/
-void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
-/** write phase value in a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->phas[channel][position]. Its purpose
-  is to access these values from wrappers, as created by swig.
-
-  \param s vector to write to
-  \param data phase value to write in s->phas[channel][position]
-  \param channel channel to write to
-  \param position sample position to write to
-
-*/
-void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position);
-/** read norm value from a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->norm[channel][position]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to read from
-  \param channel channel to read from
-  \param position sample position to read from
-
-*/
-smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position);
-/** read phase value from a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->phas[channel][position]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to read from
-  \param channel channel to read from
-  \param position sample position to read from
-
-*/
-smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position);
-/** write norm channel in a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->norm[channel]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to write to
-  \param data norm vector of [length] samples to write in s->norm[channel]
-  \param channel channel to write to
-
-*/
-void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel);
-/** write phase channel in a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained by assigning vec->phas[channel]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
-  \param s vector to write to
-  \param data phase vector of [length] samples to write in s->phas[channel]
-  \param channel channel to write to
-
-*/
-void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel);
-/** read norm channel from a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->norm[channel]. Its purpose is to access
-  these values from wrappers, as created by swig.
-
-  \param s vector to read from 
-  \param channel channel to read from
-
-*/
-smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel);
-/** write phase channel in a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->phas[channel]. Its purpose is to access
-  these values from wrappers, as created by swig.
-
-  \param s vector to read from 
-  \param channel channel to read from 
-
-*/
-smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel);
-/** read norm data from a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->norm. Its purpose is to access these values
-  from wrappers, as created by swig.
-
-  \param s vector to read from
-
-*/
-smpl_t ** cvec_get_norm(cvec_t *s);
-/** read phase data from a complex buffer
-
-  Note that this function is not used in the aubio library, since the same
-  result can be obtained with vec->phas. Its purpose is to access these values
-  from wrappers, as created by swig.
-
-  \param s vector to read from
-
-*/
-smpl_t ** cvec_get_phas(cvec_t *s);
-
-#ifdef __cplusplus
-}
-#endif
+#include "fvec.h"
+#include "cvec.h"
 
 #endif /* _SAMPLE_H */
--- /dev/null
+++ b/tests/Makefile.am
@@ -1,0 +1,3 @@
+if COMPILE_TESTS 
+SUBDIRS = src 
+endif
--- /dev/null
+++ b/tests/list_missing_tests
@@ -1,0 +1,64 @@
+#! /usr/bin/python
+
+from glob import glob
+from os.path import splitext, exists, join, dirname, basename
+import sys
+
+def check_tst_against_src(src_dir, src_ext, ext_dir, verbose = False, tst_prefix = ''):
+  src_files = [ basename(file) for file in glob( join(src_dir, '*'+src_ext) ) ]
+  src_files.sort()
+  status = 0
+  for src_file in src_files: 
+    tst_file = (splitext(src_file)[0] + tst_ext).replace(tst_prefix,"")
+    if not exists(join(tst_dir,tst_prefix+tst_file)):
+      print "%20s [X]" % src_file, "[ ] %s" % tst_file
+      status = 1
+    elif verbose:
+      print "%20s [X]" % src_file, "[X] %s" % tst_file
+  return status
+
+def check_src_against_tst(tst_dir, tst_ext, src_dir, verbose = False, tst_prefix = ''):
+  tst_files = [ basename(file) for file in glob( join(tst_dir, '*'+tst_ext) ) ]
+  tst_files.sort()
+  status = 0
+  for tst_file in tst_files: 
+    src_file = (splitext(tst_file)[0] + src_ext).replace(tst_prefix,"")
+    if not exists(join(src_dir,src_file)):
+      print "%20s [ ]" % src_file, "[X] %s" % tst_file
+      status = 2
+    elif verbose:
+      print "%20s [X]" % src_file, "[X] %s" % tst_file
+  return status
+
+def check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = False, tst_prefix = ''):
+  print "%20s    " % (" FILES IN " + src_dir) + "|" + "    FILES IN " + tst_dir
+  status  = check_tst_against_src(src_dir, src_ext, tst_dir, verbose = verbose, tst_prefix = tst_prefix)
+  status += check_src_against_tst(tst_dir, tst_ext, src_dir, verbose = verbose, tst_prefix = tst_prefix)
+  return status
+
+if __name__ == '__main__':
+
+  if len(sys.argv) > 1: verbose = True
+  else: verbose = False
+
+  base_directory = dirname(sys.argv[0])
+
+  status = 0
+
+  src_dir = join(base_directory,'..','src')
+  src_ext = '.c'
+  tst_dir = join(base_directory,'python')
+  tst_ext = '.py'
+  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose)
+
+  tst_dir = join(base_directory,'src')
+  tst_ext = '.c'
+  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose, tst_prefix = 'test-')
+
+  src_dir = join(base_directory,'..','examples')
+  src_ext = '.c'
+  tst_dir = join(base_directory,'python','examples')
+  tst_ext = '.py'
+  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose)
+
+  sys.exit(status)
--- /dev/null
+++ b/tests/python/aubiomodule.py
@@ -1,0 +1,14 @@
+import unittest
+
+class aubiomodule_test_case(unittest.TestCase):
+
+  def test_aubio(self):
+    """ try importing aubio module """
+    import aubio 
+
+  def test_aubiowrapper(self):
+    """ try importing aubio.aubiowrapper module """
+    from aubio import aubiowrapper 
+ 
+if __name__ == '__main__':
+  unittest.main()
--- /dev/null
+++ b/tests/python/bench/onset/Makefile.am
@@ -1,0 +1,44 @@
+export BASEDIR=../../../..
+export PYTHONPATH=$(BASEDIR)/python
+export LD_LIBRARY_PATH=$(BASEDIR)/src/.libs:$(BASEDIR)/ext/.libs
+
+DETAILSOURCE = \
+	/var/tmp/Onset-Mirex2005/poly_pitched \
+	/var/tmp/Onset-Mirex2005/solo_bars_and_bells \
+	/var/tmp/Onset-Mirex2005/solo_brass \
+	/var/tmp/Onset-Mirex2005/solo_drums \
+	/var/tmp/Onset-Mirex2005/solo_plucked_strings \
+	/var/tmp/Onset-Mirex2005/solo_singing_voice \
+	/var/tmp/Onset-Mirex2005/solo_sustained_strings \
+	/var/tmp/Onset-Mirex2005/solo_winds \
+	/var/tmp/Onset-Mirex2005/complex
+
+SOURCE = /var/tmp/Onset-Mirex2005
+
+TESTSOURCE = \
+	/var/tmp/Onset-Mirex2005/solo_bars_and_bells \
+	/var/tmp/Onset-Mirex2005/solo_winds \
+	/archives/samples/DB/PercussivePhrases/CM18/Samba_Audio
+
+test-aubiocut:            $(patsubst %, %.aubiocut,    $(TESTSOURCE))
+test-aubiodelay:          $(patsubst %, %.aubiodelay,  $(TESTSOURCE))
+test-aubiowindow:         $(patsubst %, %.aubiowindow, $(TESTSOURCE))
+
+final-aubiocut:           $(patsubst %, %.aubiocut,    $(DETAILSOURCE) $(SOURCE))
+final-aubiodelay:         $(patsubst %, %.aubiodelay,  $(SOURCE))
+final-aubiowindow:        $(patsubst %, %.aubiowindow, $(SOURCE))
+
+%.aubiocut: %
+	rm -f `basename $@`
+	./bench-onset $< | tee `basename $@`
+	-diff `basename $@`.ref `basename $@`
+
+%.aubiodelay: %
+	rm -f `basename $@`
+	./bench-delay $< | tee `basename $@`
+	-diff `basename $@`.ref `basename $@`
+
+%.aubiowindow: %
+	rm -f `basename $@`
+	./bench-window $< | tee `basename $@`
+	-diff `basename $@`.ref `basename $@`
--- /dev/null
+++ b/tests/python/bench/onset/bench-delay
@@ -1,0 +1,62 @@
+#! /usr/bin/python
+
+from aubio.bench.onset import benchonset
+from aubio.task.onset import taskonset
+from aubio.task.params import taskparams
+
+class mybenchonset(benchonset):
+
+	def run_bench(self,modes=['dual'],thresholds=[0.5]):
+		from os.path import dirname,basename
+		self.thresholds = thresholds
+		self.pretty_titles()
+
+		for mode in modes:
+			d = []
+			self.params.onsetmode = mode
+			self.params.localmin = True
+			self.params.delay = 1. 
+			self.params.threshold = thresholds[0]
+			#
+			self.params.localmin = False 
+			self.params.delay = 0. 
+			self.dir_eval_print()
+			self.plotdiffs(d,plottitle="Causal")
+			#
+			self.params.localmin = True
+			self.params.delay = 0. 
+			self.dir_eval_print()
+			self.plotdiffs(d,plottitle="Local min")
+
+			self.params.localmin = False 
+			self.params.delay = 6. 
+			self.dir_eval_print()
+			self.plotdiffs(d,plottitle="Fixed delay")
+
+			#self.plotplotdiffs(d)
+			outplot = "_-_".join(("delay",mode,basename(self.datadir) ))
+			for ext in ("png","svg","ps"):
+				self.plotplotdiffs(d,outplot=outplot,extension=ext)
+
+if __name__ == "__main__":
+	import sys
+	if len(sys.argv) > 1: datapath = sys.argv[1]
+	else: print "ERR: a path is required"; sys.exit(1)
+	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
+	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
+	#modes = [ 'hfc' ]
+	thresholds = [0.5]
+
+	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
+	respath = '/var/tmp/DB-testings'
+
+	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
+	benchonset.params = taskparams()
+	benchonset.task = taskonset
+	benchonset.valuesdict = {}
+
+	try:
+		#benchonset.auto_learn2(modes=modes)
+		benchonset.run_bench(modes=modes,thresholds=thresholds)
+	except KeyboardInterrupt:
+		sys.exit(1)
--- /dev/null
+++ b/tests/python/bench/onset/bench-onset
@@ -1,0 +1,68 @@
+#! /usr/bin/python
+
+from aubio.task import *
+
+from aubio.bench.onset import mmean, stdev, benchonset
+
+class mybenchonset(benchonset):
+
+	def run_bench(self,modes=['dual'],thresholds=[0.5]):
+		from os.path import dirname,basename
+		self.thresholds = thresholds
+		self.pretty_titles()
+		d,e,f,g = [],[],[],[]
+		for mode in modes:
+			self.vlist = []
+			self.params.onsetmode = mode
+			#self.params.localmin = True
+
+			for threshold in self.thresholds:
+				self.params.threshold = threshold
+				self.dir_eval_print()
+				self.vlist.append(self.v)
+			self.plotroc(d)
+			self.plotfmeas(e)
+			self.plotpr(f)
+			#self.plothistcat(g)
+
+
+
+		#self.plotplotroc(d)
+		#self.plotplotfmeas(e)
+		#self.plotplotpr(f)
+		outplot = basename(self.datadir)
+		for ext in ("png","svg","ps"):
+			self.plotplotroc(d,outplot=outplot,extension=ext)
+			self.plotplotfmeas(e,outplot=outplot,extension=ext)
+			self.plotplotpr(f,outplot=outplot,extension=ext)
+			#self.plotplothistcat(g,outplot=outplot,extension=ext)
+
+if __name__ == "__main__":
+	import sys
+	if len(sys.argv) > 1: datapath = sys.argv[1]
+	else: print "ERR: a path is required"; sys.exit(1)
+	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
+	thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
+	#modes = [ 'hfc' ]
+	#thresholds = [0.5]
+
+	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
+	respath = '/var/tmp/DB-testings'
+
+	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
+	benchonset.params = taskparams()
+	benchonset.params.dcthreshold = -1.
+	benchonset.params.silence = -100.
+	benchonset.params.delay = 5. 
+	benchonset.params.bufsize = 1024 
+	benchonset.params.hopsize = 256 
+	benchonset.params.step = float(benchonset.params.hopsize)/float(benchonset.params.samplerate)
+	benchonset.params.mintol = 4.1 
+	benchonset.task = taskonset
+	benchonset.valuesdict = {}
+
+	try:
+		#benchonset.auto_learn2(modes=modes)
+		benchonset.run_bench(modes=modes,thresholds=thresholds)
+	except KeyboardInterrupt:
+		sys.exit(1)
--- /dev/null
+++ b/tests/python/bench/onset/bench-window
@@ -1,0 +1,59 @@
+#! /usr/bin/python
+
+from aubio.bench.onset import benchonset
+from aubio.task.onset import taskonset
+from aubio.task.params import taskparams
+
+class mybenchonset(benchonset):
+
+	def run_bench(self,modes=['dual'],thresholds=[0.5]):
+		from os.path import dirname,basename
+		self.thresholds = thresholds
+		self.pretty_titles()
+
+		for mode in modes:
+
+			self.params.onsetmode = mode
+			self.params.localmin = True
+			self.params.delay = 1. 
+			self.params.threshold = thresholds[0]
+			self.params.localmin = False 
+			#
+			for delay in (0., 4.):
+				d = []
+				self.params.delay = delay 
+				for buf in (2048, 1024, 512):
+					for hop in (buf/2, buf/4):
+						self.params.bufsize = buf 
+						self.params.hopsize = hop 
+						self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
+						self.dir_eval_print()
+						self.plotdiffs(d,plottitle="%s %s" % (buf,hop))
+				#plotplotdiffs(d)
+				outplot = "_-_".join(("window",mode,"delay-%s" % int(delay),
+					basename(self.datadir) ))
+				for ext in ("png","svg","ps"):
+					self.plotplotdiffs(d,outplot=outplot,extension=ext)
+
+if __name__ == "__main__":
+	import sys
+	if len(sys.argv) > 1: datapath = sys.argv[1]
+	else: print "ERR: a path is required"; sys.exit(1)
+	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
+	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
+	#modes = [ 'hfc' ]
+	thresholds = [0.5]
+
+	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
+	respath = '/var/tmp/DB-testings'
+
+	benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
+	benchonset.params = taskparams()
+	benchonset.task = taskonset
+	benchonset.valuesdict = {}
+
+	try:
+		#benchonset.auto_learn2(modes=modes)
+		benchonset.run_bench(modes=modes,thresholds=thresholds)
+	except KeyboardInterrupt:
+		sys.exit(1)
--- /dev/null
+++ b/tests/python/bench/pitch/Makefile.am
@@ -1,0 +1,59 @@
+export AUBIODIR=../../../..
+export PYTHONPATH=$(AUBIODIR)/python
+export LD_LIBRARY_PATH=$(AUBIODIR)/src/.libs:$(AUBIODIR)/ext/.libs
+
+CP=cp -a
+
+SOURCE = \
+	$(BASEDIR)/isolated/vibraphone \
+	$(BASEDIR)/isolated/clavinet \
+	$(BASEDIR)/isolated/elecguitar \
+	$(BASEDIR)/isolated/piano \
+	$(BASEDIR)/isolated/rhodes \
+	$(BASEDIR)/isolated
+
+
+MONOSOURCE = \
+	$(BASEDIR)/monophonic/Mirex04/daisy \
+	$(BASEDIR)/monophonic/Mirex04/midi \
+	$(BASEDIR)/monophonic/Mirex04/jazz \
+	$(BASEDIR)/monophonic/Mirex04/pop \
+	$(BASEDIR)/monophonic/Mirex04/opera \
+	$(BASEDIR)/monophonic/Mirex04
+
+POLYSOURCE = \
+	$(BASEDIR)/polyphonic/Mirex04/daisy \
+	$(BASEDIR)/polyphonic/Mirex04/midi \
+	$(BASEDIR)/polyphonic/Mirex04/jazz \
+	$(BASEDIR)/polyphonic/Mirex04/pop \
+	$(BASEDIR)/polyphonic/Mirex04/opera \
+	$(BASEDIR)/polyphonic/Mirex04
+
+test-aubiopitch-isolated:    $(patsubst %, %.aubiopitch-isolated, $(SOURCE))
+test-aubiopitch-monophonic:  $(patsubst %, %.aubiopitch-monophonic, $(MONOSOURCE))
+test-aubiopitch-polyphonic:  $(patsubst %, %.aubiopitch-polyphonic, $(POLYSOURCE))
+
+plotpitch:
+	../../../aubiopitch -m fcomb,mcomb,yinfft,yin,schmitt -i jazz2REF.wav -p -t 0.2 -l 100 -M 600 -O jazz2REF.ps
+	../../../aubiopitch -m fcomb,mcomb,yinfft,yin,schmitt -p -t 0.2 -l 300 -M 900 -i opera_fem2REF.wav -O opera_fem2REF.ps
+
+timings:
+	./bench-timings $(BASEDIR)/polyphonic/Mirex04/opera
+
+%.aubiopitch-isolated: %
+	$(CP) isolated/`basename $@` isolated/`basename $@`.old
+	./bench-pitch-isolated $< | tee isolated/`basename $@`
+	-diff isolated/`basename $@`.old isolated/`basename $@`
+	-diff isolated/`basename $@`.ref isolated/`basename $@`
+
+%.aubiopitch-monophonic: %
+	$(CP) monophonic/`basename $@` monophonic/`basename $@`.old
+	./bench-pitch-monophonic $< | tee monophonic/`basename $@`
+	-diff monophonic/`basename $@`.ref monophonic/`basename $@`
+	-diff monophonic/`basename $@`.old monophonic/`basename $@`
+
+%.aubiopitch-polyphonic: %
+	$(CP) polyphonic/`basename $@` polyphonic/`basename $@`.old
+	./bench-pitch-polyphonic $< | tee polyphonic/`basename $@`
+	-diff polyphonic/`basename $@`.ref polyphonic/`basename $@`
+	-diff polyphonic/`basename $@`.old polyphonic/`basename $@`
--- /dev/null
+++ b/tests/python/bench/pitch/bench-pitch-isolated
@@ -1,0 +1,198 @@
+#! /usr/bin/python
+
+from aubio.bench.node import *
+from aubio.task import *
+
+class benchpitch(bench):
+	
+	""" list of values to store per file """
+	valuenames = ['mode']
+	""" list of lists to store per file """
+	valuelists = ['truth', 'osil', 'esil', 'opit', 'epit', 'echr', 
+               'Msil', 'Mpit', 'Mchr',
+	       'TotalPit', 'TotalPit', 'TotalChr' ]
+	""" list of values to print per dir """
+	printnames_total = [ 'mode', 'MinPit', 'MaxPit', 'TotalSil', 'TotalPit', 'TotalChr']
+	printnames_notes = [ 'mode', 'Note', 'Sil', 'Pit', 'Chr']
+	printnames = printnames_notes 
+
+	""" per dir """
+	formats = {'mode': "%12s" , 
+		'truth': "%s",
+		'osil': "%s", 'esil': "%s", 
+		'opit': "%s", 'epit': "%s", 'echr': "%s",
+    'Note': "%s", 'Sil': "%s", 'Chr': "%s", 'Pit': "%s",
+		'TotalPit': "%s", 'TotalSil': "%s", 'TotalChr': "%s",
+		'MinPit': "%s", 'MaxPit': "%s",
+		'Msil': "%s", 'Mpit': "%s", 'Mchr': "%s"}
+
+	def dir_eval(self):
+		""" evaluate statistical data over the directory """
+		v = self.v
+		v['mode']      = self.params.pitchmode
+
+	def file_exec(self,input,output):
+		filetask = self.task(input,params=self.params)
+		computed_data = filetask.compute_all()
+ 		osil, esil, opit, epit, echr = filetask.eval(computed_data,tol=0.5)
+		self.v['truth'].append(int(filetask.truth))
+		assert opit > 0
+		
+		self.v['osil'].append(osil)
+		self.v['esil'].append(esil)
+		self.v['opit'].append(opit)
+		self.v['epit'].append(epit)
+		self.v['echr'].append(echr)
+
+		self.v['Msil'].append(esil/float(osil)*100.)
+		self.v['Mpit'].append(epit/float(opit)*100.)
+		self.v['Mchr'].append(echr/float(opit)*100.)
+		#print results#, computed_data
+		#print input, results, results - float(input.split('.')[-2])
+			
+	def run_bench(self,modes=['schmitt'],multiplot=0):
+		from os.path import basename
+		self.modes = modes
+		self.pretty_titles()
+		d = []
+		for mode in self.modes:
+			self.params.pitchmode = mode
+			self.dir_exec()
+			self.dir_eval()
+			truth   = [i for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allOsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allEsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allOpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allEpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allEchr = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allMsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allMpit = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			allMchr = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
+			for i in range(len(self.v['truth'])):
+				allOsil[self.v['truth'][i]-min(self.v['truth'])] += self.v['osil'][i]
+				allEsil[self.v['truth'][i]-min(self.v['truth'])] += self.v['esil'][i]
+				allOpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['opit'][i]
+				allEpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['epit'][i]
+				allEchr[self.v['truth'][i]-min(self.v['truth'])] += self.v['echr'][i]
+			for i in range(len(truth)):
+				allOsil[i] = max(1,allOsil[i])
+				allOpit[i] = max(1,allOpit[i])
+				allMsil[i] = allEsil[i]/float(allOsil[i])*100.
+				allMpit[i] = allEpit[i]/float(allOpit[i])*100.
+				allMchr[i] = allEchr[i]/float(allOpit[i])*100.
+				self.v['Sil'], self.v['Pit'], self.v['Chr'] = allMsil[i], allMpit[i], allMchr[i]
+				self.v['Note'] = truth[i]
+				#self.printnames = self.printnames_notes
+				self.pretty_print()
+			self.v['TotalSil'] = sum(allMsil)/len(truth)
+			self.v['TotalPit'] = sum(allMpit)/len(truth)
+			self.v['TotalChr'] = sum(allMchr)/len(truth)
+			self.v['MinPit'] = min(truth) 
+			self.v['MaxPit'] = max(truth) 
+			#self.printnames = self.printnames_total
+			#self.pretty_print()
+
+			plot = []
+			self.plotpitchtessiture(plot,
+				truth, 
+				allMpit,
+				plottitle="%s %s" % (self.v['mode'],self.params.bufsize),
+				plotmode='lines')
+			"""
+			self.plotpitchtessiture(plot,
+				truth, 
+				allMchr,
+				plottitle="%s %s" % (self.v['mode'],"%12"),
+				plotmode='lines')
+			self.plotpitchtessiture(plot,
+				truth, 
+				allMsil,
+				plottitle="%s %s" % (self.v['mode'],"sil"),
+				plotmode='lines')
+			"""
+			title = basename(self.datadir)
+			if multiplot:
+				d.append(plot)
+			else:
+				d += plot
+		outplot = "_-_".join(('pitchtessiture',title))
+		self.xmin = min(self.v['truth']) #20.
+		self.xmax = max(self.v['truth'])
+		for ext in ('ps','png','svg'): #,''):
+			self.plotplotpitchtessiture(d,
+				plottitle="".join(['Performance against MIDI Note number (',
+					title,
+					", %s" % len(self.sndlist), " samples)"]),
+				outplot=outplot,
+				extension=ext,multiplot=multiplot)
+		#d.append('beta = .25,orig(x) title \"-2 octave\"')
+		#d.append('beta = .50,orig(x) title \"-1 octave\"')
+		#d.append('beta = 1.0,orig(x) title \"original\"')
+		#d.append('beta = 2.0,orig(x) title \"+1 octave\"')
+
+	"""
+	Plot functions 
+	"""
+
+	def plotpitchtessiture(self,d,lx,ly,plottitle="",plotmode='linespoints'):
+		import Gnuplot, Gnuplot.funcutils
+		d.append(Gnuplot.Data(lx, ly, with=plotmode, title="%s" % (plottitle) ))
+
+	def plotplotpitchtessiture(self,d,plottitle='',outplot=0,extension='',multiplot=1):
+		from aubio.gnuplot import gnuplot_create
+		g = gnuplot_create(outplot=outplot,extension=extension) 
+		#g.title(plottitle)
+		#g('orig(x) = beta*x')
+		g.title(plottitle)
+		g('set yrange [50:100]')
+		# erase axis
+		g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax))
+		#g.plot(*d)
+		g('set border 3')
+		g('set xtics nomirror')
+		g('set ytics nomirror')
+		g('set key bottom')
+		if multiplot:
+			g('set multiplot')
+			for i in range(len(d)):
+				# plot onset detection functions
+				g('set size   1,%f' % ( 1.0/float(len(d)) ) )
+				g('set origin 0,%f' % ( 1.0*float(len(d)-i-1)/float(len(d)) ) )
+				#g.ylabel('%Correct detections')
+				g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax))
+				g.plot(*d[i])
+				g('unset title')
+			g('unset multiplot')
+		else:
+			g.plot(*d)
+
+
+if __name__ == "__main__":
+	import sys
+	if len(sys.argv) > 1: datapath = sys.argv[1]
+	else: print "error: a path is required"; sys.exit(1)
+	if len(sys.argv) > 2:
+		for each in sys.argv[3:-1]: print each
+	modes = ['schmitt', 'yin', 'yinfft', 'mcomb', 'fcomb']
+	#modes = ['mcomb']
+
+	params = taskparams()
+	params.bufsize = 2048 # 4096 
+	params.hopsize = 256
+	params.silence = -60.
+	params.pitchsmooth = 0 
+	params.pitchmax = 20000
+	params.pitchmin = 20
+	params.pitchyinfft = 0.95
+	benchpitch = benchpitch(datapath,params=params)
+	benchpitch.task = taskpitch
+
+	#benchpitch.titles  = [ 'mode', 'thres', 'avg', 'avgdist' ]
+	#benchpitch.formats = ["%12s" , "| %6s", "| %6s", "| %6s", "| %6s", "| %6s" ]
+	try:
+		benchpitch.run_bench(modes=modes)
+	except KeyboardInterrupt:
+		print "Interrupted by user"
+		sys.exit(1)
+
+	sys.exit(0)
--- /dev/null
+++ b/tests/python/bench/pitch/bench-pitch-plot-isolated
@@ -1,0 +1,63 @@
+#! /usr/bin/python
+
+if __name__ == '__main__':
+  import sys, Gnuplot
+  from aubio.gnuplot import gnuplot_create
+  from aubio.txtfile import read_datafile
+  from aubio.plot.keyboard import draw_keyboard
+  lines = []
+  titles = []
+  for file in range(len(sys.argv)-1):
+    l = read_datafile(sys.argv[file+1])
+    notes, score = [],[]
+    for i in range(len(l)):
+      notes.append(l[i][0])
+      score.append(l[i][2])
+    lines.append(Gnuplot.Data(notes,score,
+      with='linespoints',
+      title=sys.argv[file+1].split('.')[-1]))
+    titles.append(sys.argv[file+1].split('.')[-1])
+  blacks,whites = draw_keyboard(firstnote = notes[0], lastnote = notes[-1], 
+    y0= 40, y1 = 50)
+
+  g = gnuplot_create(sys.argv[file+1].split('.')[-3],'ps')
+  #g = gnuplot_create('','')
+  #g = gnuplot_create('/tmp/test','eps')
+  g('set yrange [40:100]')
+  #g('set xrange [%f:%f]' % (notes[0],notes[-1]+60))
+  g('set size 0.5')
+  g('set key outside')
+
+  g('set border 3')
+  g('set xtics nomirror')
+  g('set ytics nomirror')
+  multiplot = 1
+  oplots = lines
+  g('set size 1,2')
+  if multiplot:
+    height = 2.
+    g('set lmargin 10')
+    #g('set rmargin 15')
+    g('set multiplot')
+    g('set yrange [50:100]')
+    g('set xrange [%f:%f]' % (notes[0],notes[-1]))
+    g('set xtics %f,12' % notes[0])
+    g('set nokey')
+    for i in range(len(oplots)):
+      g.ylabel(titles[i])
+      g('set size %f,%f' % (1.,height*.85/float(len(oplots))))
+      g('set origin 0,%f' % (height*(.15+.85*float(len(oplots)-i-1)/float(len(oplots)))))
+      g.plot(oplots[i])
+    g('set title "Raw pitch accuracy (%) against midi note numbers"')
+    g('set noxtics')
+    g('set noytics')
+    g('set size %f,%f' % (1.,.15*height))
+    g('set origin 0,%f' % 0)
+    g('set yrange [40:50]')
+    g('set xrange [%f:%f]' % (notes[0],notes[-1]))
+    g.xlabel('')
+    g.ylabel('')
+    g.plot(whites,blacks)
+    g('unset multiplot')
+  else:
+    g.plot(whites,blacks,*lines)
--- /dev/null
+++ b/tests/python/bench/tempo/demo-tempo
@@ -1,0 +1,313 @@
+#! /usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys,time
+from aubio.task import taskbeat,taskparams
+from aubio.aubioclass import fvec, aubio_autocorr
+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
+from aubio.aubiowrapper import *
+from math import exp,log
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        parser.add_option("-n","--printframe",
+                          action="store", dest="printframe", default=-1, 
+                          help="make a plot of the n_th frame")
+        gnuplot_addargs(parser)
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+def plotdata(x,y,plottitle="",**keyw):
+	import Gnuplot
+	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
+
+options, args = parse_args()
+filename = options.filename
+xsize = float(options.xsize)
+ysize = float(options.ysize)
+
+printframe = int(options.printframe)
+
+if options.outplot and printframe > 0: 
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else: 
+  extension = ''
+  outplot = None
+f = gnuplot_create(outplot=outplot,extension=extension,options=options)
+
+params = taskparams()
+params.onsetmode = 'specdiff'
+task = taskbeat(filename,params=params)
+
+hopsize = params.hopsize
+bufsize = params.bufsize
+btstep = task.btstep
+winlen = task.btwinlen
+laglen = winlen/4
+step = winlen/4
+
+timesig = 0
+maxnumelem = 4
+gp = 0
+counter = 0
+flagconst = 0
+constthresh = 3.901
+g_var      = 3.901
+rp = 0
+rp1 = 0
+rp2 = 0
+g_mu = 0
+
+rayparam = 48/512.*winlen
+
+#t     = [i for i in range(hopsize)]
+#tlong = [i for i in range(hopsize*(btstep-1))]
+#tall  = [i for i in range(hopsize*btstep)]
+#a     = [0 for i in range(hopsize*btstep)]
+dfx = [i for i in range(winlen)]
+dfframe = [0 for i in range(winlen)]
+dfrev = [0 for i in range(winlen)]
+acframe = [0 for i in range(winlen)]
+
+localacf = [0 for i in range(winlen)]
+inds = [0 for i in range(maxnumelem)]
+
+acx = [i for i in range(laglen)]
+acfout  = [0 for i in range(laglen)]
+
+phwv  = [0 for i in range(2*laglen)]
+phwvx = [i for i in range(2*laglen)]
+
+dfwvnorm = exp(log(2.0)*(winlen+2.)/rayparam);
+dfwv = [exp(log(2.)*(i+1.)/rayparam)/dfwvnorm for i in range(winlen)]
+
+gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
+rwv = [(i+1.)/rayparam**2 * exp(-(i+1.)**2 / (2.*rayparam)**2)
+        for i in range(0,laglen)] 
+acf = fvec(winlen,1)
+
+nrframe = 0
+while (task.readsize == params.hopsize):
+  task()
+  #print task.pos2
+  #a[:-hopsize] = [i for i in a[-(btstep-1)*hopsize:]]
+  #a[-hopsize:] = [task.myvec.get(i,0) for i in t]
+
+  #g('set xrange [%f:%f]' % (t[0],t[-1]))
+  #time.sleep(.2)
+  if task.pos2==btstep-1:
+    nrframe += 1
+    dfframe = [task.dfframe.get(i,0) for i in range(winlen)]
+    if printframe == nrframe or printframe == -1:
+      d  = [[plotdata(range(-winlen,0),dfframe,plottitle="onset detection", with='lines')]]
+    # start beattracking_do
+    for i in range(winlen):
+      dfrev[winlen-1-i] = 0.
+      dfrev[winlen-1-i] = dfframe[i]*dfwv[i]
+    aubio_autocorr(task.dfframe(),acf()); 
+    acframe = [acf.get(i,0) for i in range(winlen)]
+    if not timesig:
+      numelem = 4
+    else:
+      numelem = timesig
+
+    old = 0
+    acfout = [0 for i in range(winlen/4)]
+    for i in range(1,laglen-1):
+      for a in range(1,numelem+1):
+        for b in range (1-a,a):
+          acfout[i] += acframe[a*(i+1)+b-1] * 1./(2.*a-1.)*rwv[i]
+          if old < acfout[i]:
+            old = acfout[i]
+            maxi = i
+    rp = max(maxi,1);
+
+    if printframe == nrframe or printframe == -1:
+      rwvs = [rwv[i]*max(acframe) for i in range(len(rwv))]
+      d += [[plotdata(acx,acfout,plottitle="comb filterbank", with='lines', axes='x1y1'),
+          plotdata([rp,rp],[1.2*old,min(acfout)],plottitle="period", with='impulses', axes='x1y1'),
+          plotdata(acx,rwvs,plottitle="L_w", with='lines', axes='x1y1')]]
+
+    # getperiod
+    inds = [0 for i in range(maxnumelem)]
+    localacf = [0 for i in range(winlen)]
+    period = 0
+    for a in range(1,4+1):
+      for b in range(1-a,a):
+        localacf[a*rp+b-1] = acframe[a*rp+b-1]
+    for i in range(numelem):
+      maxindex = 0
+      maxval = 0.0
+      for j in range(rp*(i+1)+i):
+        if localacf[j] > maxval:
+          maxval = localacf[j]
+          maxind = j
+        localacf[j] = 0
+      inds[i] = maxind
+    for i in range(numelem):
+      period += inds[i]/(i+1.)
+    period = period/numelem
+    #print "period", period
+
+    # checkstate 
+    if gp:
+      # context dependant model
+      acfout = [0 for i in range(winlen/4)]
+      old = 0
+      for i in range(laglen-1):
+        for a in range(timesig):
+          for b in range(1-a,a):
+            acfout[i] += acframe[a*(i+1)+b-1] * gwv[i]
+        if old < acfout[i]:
+          old = acfout[i]
+          maxi = i
+      gp = maxi
+    else:
+      # general model
+      gp = 0
+    #print "gp", gp
+    if printframe == nrframe or printframe == -1:
+      gwvs = [gwv[i]*max(acfout) for i in range(len(gwv))]
+      d += [[plotdata(acx,acfout,plottitle="comb filterbank", with='lines', axes='x1y1'),
+          plotdata(gp,old,plottitle="period", with='impulses', axes='x1y1'),
+          plotdata(acx,gwvs,plottitle="L_{gw}", with='lines', axes='x1y1')]]
+
+    if counter == 0:
+      # initial step
+      if abs(gp-rp) > 2.*constthresh:
+        flagstep = 1
+        counter  = 3
+      else:
+        flagstep = 0
+    #print "flagstep", flagstep
+    #print "rp2,rp1,rp", rp2,rp1,rp
+    acfw = [dfframe[i]*dfwv[i] for i in range(winlen)]
+
+    if counter == 1 and flagstep == 1:
+      # "3rd frame after flagstep set"
+      if abs(2.*rp-rp1- rp2) < constthresh:
+        flagconst = 1
+        counter = 0
+      else:
+        flagconst = 0
+        counter = 2
+    elif counter > 0:
+      counter -= 1
+
+    rp2 = rp1; rp1 = rp
+
+    if flagconst:
+      # "first run of new hypothesis"
+      gp = rp
+      g_mu = gp
+      timesig = 4 #FIXME
+      gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
+      flagconst = 0
+      bp = gp
+      phwv = [1 for i in range(2*laglen)]
+    elif timesig:
+      # "contex dependant"
+      bp = gp
+      if step > lastbeat:
+        phwv = [exp(-.5*(1.+j-step+lastbeat)**2/(bp/8.)) for j in range(2*laglen)]
+      else:
+        print "NOT using phase weighting"
+        phwv = [1 for i in range(2*laglen)]
+    else:
+      # "initial state"
+      bp = rp
+      phwv = [1 for i in range(2*laglen)]
+
+    while bp < 25:
+      print "WARNING, doubling the beat period"
+      bp *= 2
+
+    # 
+    phout = [0. for i in range(winlen)]
+
+    kmax = int(winlen/float(bp));
+
+    old = 0
+    for i in range(bp):
+      phout[i] = 0.
+      for k in range(kmax):
+        phout[i] += dfrev[i+bp*k] * phwv[i]
+      if phout[i] > old:
+        old = phout[i]
+        maxi = i
+    maxindex = maxi 
+    if (maxindex == winlen - 1): maxindex = 0
+    phase = 1 + maxindex
+    i = 1
+    beat = bp - phase
+    beats= []
+    if beat >= 0: beats.append(beat)
+    while beat+bp < step: 
+      beat += bp
+      beats.append(beat)
+    lastbeat = beat
+    #print beats,
+    #print "the lastbeat is", lastbeat
+
+    # plot all this
+    if printframe == nrframe or printframe == -1:
+      phwvs = [phwv[i]*max(phout) for i in range(len(phwv))]
+      d += [[plotdata(range(-laglen,0),phwvs[laglen:0:-1],plottitle="A_{gw}", with='lines',axes='x1y1'),
+          plotdata(range(-laglen,0),phout[laglen:0:-1],plottitle="df", with='lines'),
+          plotdata(-phase,old,plottitle="phase", with='impulses', axes='x1y1'),
+          plotdata([i for i in beats],[old for i in beats],plottitle="predicted", with='impulses')
+          ]]
+    #d += [[plotdata(dfx,dfwv,plottitle="phase weighting", with='lines', axes='x1y2'),
+    #    plotdata(dfx,dfrev,plottitle="df reverse", with='lines', axes='x1y1')]]
+    #d += [[plotdata(dfx,phout,plottitle="phase", with='lines', axes='x1y2')]]
+    #d += [[plotdata(dfx,dfwv,plottitle="phase weighting", with='lines', axes='x1y2'),
+    #    plotdata(dfx,dfrev,plottitle="df reverse", with='lines', axes='x1y1')]]
+    #d += [[plotdata(dfx,phout,plottitle="phase", with='lines', axes='x1y2')]]
+
+      f('set lmargin 4')
+      f('set rmargin 4')
+      f('set size %f,%f' % (1.0*xsize,1.0*ysize) )
+      f('set key spacing 1.3')
+      f('set multiplot')
+
+      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
+      f('set xrange [%f:%f]' % (-winlen,0) )
+      f.title('Onset detection function')
+      f.xlabel('time (df samples)')
+      f.plot(*d[0])
+      f('set size %f,%f' % (0.5*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
+      f('set xrange [%f:%f]' % (0,laglen) )
+      f.title('Period detection: Rayleygh weighting')
+      f.xlabel('lag (df samples)')
+      f.plot(*d[1])
+      f('set size %f,%f' % (0.5*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.5*xsize,0.33*ysize) )
+      f('set xrange [%f:%f]' % (0,laglen) )
+      f.title('Period detection: Gaussian weighting')
+      f.xlabel('lag (df samples)')
+      f.plot(*d[2])
+      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.00*ysize) )
+      f('set xrange [%f:%f]' % (-laglen,laglen) )
+      f.title('Phase detection and predicted beats')
+      f.xlabel('time (df samples)')
+      f.plot(*d[3])
+      f('set nomultiplot')
+    if printframe == -1: a = sys.stdin.read()
+    elif 0 < printframe and printframe < nrframe:
+      break
--- /dev/null
+++ b/tests/python/bench/tempo/demo-tempo-acf
@@ -1,0 +1,157 @@
+#! /usr/bin/python
+
+""" this file was written by Paul Brossier 
+  it is released under the GNU/GPL license.
+"""
+
+import sys,time
+from aubio.task import taskbeat,taskparams
+from aubio.aubioclass import fvec, aubio_autocorr
+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
+from aubio.aubiowrapper import *
+from math import exp,log
+
+usage = "usage: %s [options] -i soundfile" % sys.argv[0]
+
+def parse_args():
+        from optparse import OptionParser
+        parser = OptionParser(usage=usage)
+        parser.add_option("-i","--input",
+                          action="store", dest="filename", 
+                          help="input sound file")
+        parser.add_option("-n","--printframe",
+                          action="store", dest="printframe", default=-1, 
+                          help="make a plot of the n_th frame")
+        gnuplot_addargs(parser)
+        (options, args) = parser.parse_args()
+        if not options.filename: 
+                 print "no file name given\n", usage
+                 sys.exit(1)
+        return options, args
+
+def plotdata(x,y,plottitle="",**keyw):
+	import Gnuplot
+	return Gnuplot.Data(x, y, title="%s" % plottitle,**keyw)
+
+options, args = parse_args()
+filename = options.filename
+xsize = float(options.xsize)
+ysize = float(options.ysize)
+
+printframe = int(options.printframe)
+
+if options.outplot and printframe > 0: 
+  extension = options.outplot.split('.')[-1] 
+  outplot = '.'.join(options.outplot.split('.')[:-1])
+else: 
+  extension = ''
+  outplot = None
+f = gnuplot_create(outplot,extension,options)
+
+params = taskparams()
+params.onsetmode = 'specdiff'
+task = taskbeat(filename,params=params)
+
+hopsize = params.hopsize
+bufsize = params.bufsize
+btstep = task.btstep
+winlen = task.btwinlen
+laglen = winlen/4
+step = winlen/4
+
+timesig = 0
+maxnumelem = 4
+gp = 0
+counter = 0
+flagconst = 0
+constthresh = 3.901
+g_var      = 3.901
+rp = 0
+rp1 = 0
+rp2 = 0
+g_mu = 0
+
+rayparam = 48/512.*winlen
+
+t     = [i for i in range(hopsize)]
+#tlong = [i for i in range(hopsize*(btstep-1))]
+#tall  = [i for i in range(hopsize*btstep)]
+sig    = [0 for i in range(hopsize*btstep*4)]
+dfx = [i for i in range(winlen)]
+dfframe = [0 for i in range(winlen)]
+dfrev = [0 for i in range(winlen)]
+acframe = [0 for i in range(winlen/2)]
+
+localacf = [0 for i in range(winlen)]
+inds = [0 for i in range(maxnumelem)]
+
+acx = [i for i in range(laglen)]
+acfout  = [0 for i in range(laglen)]
+
+phwv  = [0 for i in range(2*laglen)]
+phwvx = [i for i in range(2*laglen)]
+
+dfwvnorm = exp(log(2.0)*(winlen+2.)/rayparam);
+dfwv = [exp(log(2.)*(i+1.)/rayparam)/dfwvnorm for i in range(winlen)]
+
+gwv = [exp(-.5*(j+1.-g_mu)**2/g_var**2) for j in range(laglen)]
+rwv = [(i+1.)/rayparam**2 * exp(-(i+1.)**2 / (2.*rayparam)**2)
+        for i in range(0,laglen)] 
+acf = fvec(winlen,1)
+
+nrframe = 0
+while (task.readsize == params.hopsize):
+  task()
+  #print task.pos2
+  sig[:-hopsize] = [i for i in sig[-(btstep*4-1)*hopsize:]]
+  sig[-hopsize:] = [task.myvec.get(i,0) for i in t]
+
+  #g('set xrange [%f:%f]' % (t[0],t[-1]))
+  #time.sleep(.2)
+  if task.pos2==btstep-1:
+    nrframe += 1
+    dfframe = [task.dfframe.get(i,0) for i in range(winlen)]
+    # start beattracking_do
+    for i in range(winlen):
+      dfrev[winlen-1-i] = 0.
+      dfrev[winlen-1-i] = dfframe[i]*dfwv[i]
+    aubio_autocorr(task.dfframe(),acf()); 
+    acframe = [acf.get(i,0) for i in range(winlen/2)]
+    if printframe == nrframe or printframe == -1:
+      d  = [[plotdata(range(0,btstep*hopsize*4,4),sig[0:-1:4],plottitle="input signal", with='lines')]]
+      d  += [[plotdata(range(-winlen,0),dfframe,plottitle="onset detection", with='lines')]]
+      d  += [[plotdata(range(winlen/2),acframe,plottitle="autocorrelation", with='lines')]]
+
+    # plot all this
+    if printframe == nrframe or printframe == -1:
+
+      f('set lmargin 4')
+      f('set rmargin 4')
+      f('set size %f,%f' % (1.0*xsize,1.0*ysize) )
+      f('set key spacing 1.3')
+      f('set multiplot')
+
+      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
+      f('set xrange [%f:%f]' % (0,btstep*hopsize*4) )
+      f('set yrange [%f:%f]' % (-1.2*max(sig),1.2*max(sig)) )
+      f.title('Input signal')
+      f.xlabel('time (samples)')
+      f.plot(*d[0])
+      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
+      f('set xrange [%f:%f]' % (-winlen,0) )
+      f('set autoscale y')
+      f.title('Onset detection function')
+      f.xlabel('time (df samples)')
+      f.plot(*d[1])
+      f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
+      f('set orig %f,%f' % (0.0*xsize,0.00*ysize) )
+      f('set xrange [%f:%f]' % (0,winlen/2) )
+      f.title('Autocorrelation')
+      f.xlabel('lag (df samples)')
+      f.plot(*d[2])
+      f('set nomultiplot')
+    if printframe == -1: a = sys.stdin.read()
+    elif 0 < printframe and printframe < nrframe:
+      break
--- /dev/null
+++ b/tests/python/cvec.py
@@ -1,0 +1,51 @@
+import unittest
+
+from aubio.aubiowrapper import *
+
+buf_size = 2048
+channels = 3
+
+class cvec_test_case(unittest.TestCase):
+
+  def setUp(self):
+    self.vector = new_cvec(buf_size, channels)
+
+  def tearDown(self):
+    del_cvec(self.vector)
+
+  def test_cvec(self):
+    """ create and delete cvec """
+    pass
+
+  def test_cvec_read_norm(self):
+    """ check new cvec norm elements are set to 0. """
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        self.assertEqual(cvec_read_norm(self.vector,channel,index),0.)
+
+  def test_cvec_read_phas(self):
+    """ check new cvec phas elements are set to 0. """
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        self.assertEqual(cvec_read_phas(self.vector,channel,index),0.)
+
+  def test_cvec_write_norm(self):
+    """ check new cvec norm elements are set with cvec_write_norm """
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        cvec_write_norm(self.vector,1.,channel,index)
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        self.assertEqual(cvec_read_norm(self.vector,channel,index),1.)
+
+  def test_cvec_write_phas(self):
+    """ check new cvec phas elements are set with cvec_write_phas """
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        cvec_write_phas(self.vector,1.,channel,index)
+    for index in range(buf_size/2+1):
+      for channel in range(channels):
+        self.assertEqual(cvec_read_phas(self.vector,channel,index),1.)
+
+if __name__ == '__main__':
+  unittest.main()
--- /dev/null
+++ b/tests/python/examples/README
@@ -1,0 +1,1 @@
+Python unit tests checking the output of the programs in aubio/examples/
--- /dev/null
+++ b/tests/python/examples/aubionotes.py
@@ -1,0 +1,41 @@
+from template import *
+
+class aubionotes_test_case(program_test_case):
+
+  import os.path
+  filename = os.path.join('..','..','sounds','woodblock.aiff')
+  progname = os.path.join('..','..','examples','aubionotes')
+
+  def test_aubionotes(self):
+    """ test aubionotes with default parameters """
+    self.getOutput()
+    # FIXME: useless check
+    self.assertEqual(len(self.output.split('\n')), 1)
+    self.assertEqual(float(self.output.strip()), 0.017415)
+
+  def test_aubionotes_verbose(self):
+    """ test aubionotes with -v parameter """
+    self.command += " -v "
+    self.getOutput()
+    # FIXME: loose checking: make sure at least 8 lines are printed
+    assert len(self.output) >= 8
+
+  def test_aubionotes_devnull(self):
+    """ test aubionotes on /dev/null """
+    self.filename = "/dev/null"
+    # exit status should not be 0
+    self.getOutput(expected_status = 256)
+    # and there should be an error message
+    assert len(self.output) > 0
+    # that looks like this 
+    output_lines = self.output.split('\n')
+    assert output_lines[0] == "Unable to open input file /dev/null."
+    #assert output_lines[1] == "Supported file format but file is malformed."
+    assert output_lines[2] == "Could not open input file /dev/null."
+
+mode_names = ["yinfft", "yin", "fcomb", "mcomb", "schmitt"]
+for name in mode_names:
+  exec("class aubionotes_test_case_" + name + "(aubionotes_test_case):\n\
+    options = \" -p " + name + " \"")
+
+if __name__ == '__main__': unittest.main()
--- /dev/null
+++ b/tests/python/examples/aubioonset.py
@@ -1,0 +1,36 @@
+from template import *
+
+class aubioonset_test_case(program_test_case):
+  
+  import os.path
+  filename = os.path.join('..','..','sounds','woodblock.aiff')
+  progname = os.path.join('..','..','examples','aubioonset')
+
+  def test_aubioonset(self):
+    """ test aubioonset with default parameters """
+    self.getOutput()
+    assert len(str(self.output)) != 0, "no output produced with command:\n" \
+      + self.command
+
+  def test_aubioonset_with_inf_silence(self):
+    """ test aubioonset with -s 0  """
+    self.command += " -s 0" 
+    self.getOutput()
+    assert len(self.output) == 0, self.output
+
+  def test_aubioonset_with_no_silence(self):
+    """ test aubioonset with -s -100 """ 
+    self.command += " -s -100 " 
+    self.getOutput()
+    # only one onset in woodblock.aiff
+    assert len(str(self.output)) != 0, "no output produced with command:\n" \
+      + self.command
+    assert len(self.output.split('\n')) == 1
+    # onset should be at 0.00000
+    assert float(self.output.strip()) == 0.
+
+for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]:
+  exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\
+  options = \" -O "+name+" \"")
+
+if __name__ == '__main__': unittest.main()
--- /dev/null
+++ b/tests/python/examples/template.py
@@ -1,0 +1,18 @@
+import unittest
+from commands import getstatusoutput
+
+class program_test_case(unittest.TestCase):
+
+  filename = "/dev/null"
+  progname = "UNDEFINED"
+  command = ""
+  options = ""
+
+  def getOutput(self, expected_status = 0):
+    self.command = self.progname + ' -i ' + self.filename + self.command
+    self.command += self.options
+    [self.status, self.output] = getstatusoutput(self.command)
+    if expected_status != -1:
+      assert self.status == expected_status, \
+        "expected status was %s, got %s\nOutput was:\n%s" % \
+        (expected_status, self.status, self.output)
--- /dev/null
+++ b/tests/python/fvec.py
@@ -1,0 +1,36 @@
+import unittest
+
+from aubio.aubiowrapper import *
+
+buf_size = 2048
+channels = 3
+
+class fvec_test_case(unittest.TestCase):
+
+  def setUp(self):
+    self.vector = new_fvec(buf_size, channels)
+
+  def tearDown(self):
+    del_fvec(self.vector)
+
+  def test_fvec(self):
+    """ create and delete fvec """
+    pass
+
+  def test_fvec_read_sample(self):
+    """ check new fvec elements are set to 0. """
+    for index in range(buf_size):
+      for channel in range(channels):
+        self.assertEqual(fvec_read_sample(self.vector,channel,index),0.)
+
+  def test_fvec_write_sample(self):
+    """ check new fvec elements are set with fvec_write_sample """
+    for index in range(buf_size):
+      for channel in range(channels):
+        fvec_write_sample(self.vector,1.,channel,index)
+    for index in range(buf_size):
+      for channel in range(channels):
+        self.assertEqual(fvec_read_sample(self.vector,channel,index),1.)
+
+if __name__ == '__main__':
+  unittest.main()
--- /dev/null
+++ b/tests/python/pitchdetection.py
@@ -1,0 +1,106 @@
+import unittest
+
+from aubio.aubiowrapper import *
+
+buf_size = 4096
+hop_size = 512
+channels = 1
+samplerate = 44100.
+
+class pitchdetection_test_case(unittest.TestCase):
+
+  def setUp(self, type = aubio_pitch_yinfft, mode = aubio_pitchm_freq):
+    self.create(type=type)
+  
+  def create(self, type = aubio_pitch_yinfft,
+      mode = aubio_pitchm_freq):
+    self.type = type
+    self.o = new_aubio_pitchdetection(buf_size, hop_size,
+        channels, int(samplerate), type, mode)
+
+  def tearDown(self):
+    del_aubio_pitchdetection(self.o)
+
+  def test_pitchdetection(self):
+    """ create and delete pitchdetection """
+    pass
+
+  def test_pitchdetection_run_zeroes(self):
+    """ run pitchdetection on an empty buffer """
+    vec = new_fvec(buf_size, channels)
+    for i in range(100):
+      self.assertEqual(aubio_pitchdetection(self.o,vec),0.)
+    del vec
+
+  def test_pitchdetection_run_4_impulses(self):
+    """ run pitchdetection on a train of 4 impulses """
+    vec = new_fvec(buf_size, channels)
+    fvec_write_sample(vec,-1.,0,  0)
+    fvec_write_sample(vec, 1.,0,  buf_size/4)
+    fvec_write_sample(vec,-1.,0,  buf_size/2)
+    fvec_write_sample(vec, 1.,0,3*buf_size/4)
+    frequency = samplerate/2*4/buf_size
+    for i in range(100):
+      self.assertEqual(aubio_pitchdetection(self.o,vec),frequency)
+    del vec
+
+  def test_pitchdetection_run_4_positive_impulses(self):
+    """ run pitchdetection on a train of 4 positive impulses of arbitrary size """
+    vec = new_fvec(buf_size, channels)
+    frequency = samplerate/2*8/buf_size
+    for i in range(100):
+      fvec_write_sample(vec, 2.-.01*i,0,  0)
+      fvec_write_sample(vec, 2.-.01*i,0,  buf_size/4)
+      fvec_write_sample(vec, 2.-.01*i,0,  buf_size/2)
+      fvec_write_sample(vec, 2.-.01*i,0,3*buf_size/4)
+      self.assertAlmostEqual(aubio_pitchdetection(self.o,vec),frequency,1)
+    del vec
+
+  def test_pitchdetection_run_4_negative_impulses(self):
+    """ run pitchdetection on a train of 4 negative impulses of arbitrary size """
+    vec = new_fvec(buf_size, channels)
+    frequency = samplerate/2*8/buf_size
+    for i in range(1,100):
+      fvec_write_sample(vec,-.01*i,0,  0)
+      fvec_write_sample(vec,-.01*i,0,  buf_size/4)
+      fvec_write_sample(vec,-.01*i,0,  buf_size/2)
+      fvec_write_sample(vec,-.01*i,0,3*buf_size/4)
+      self.assertAlmostEqual(aubio_pitchdetection(self.o,vec),frequency,1)
+    del vec
+
+  def test_pitchdetection_run_8_impulses(self):
+    """ run pitchdetection on a train of 8 impulses """
+    vec = new_fvec(buf_size, channels)
+    fvec_write_sample(vec, 1.,0,  0)
+    fvec_write_sample(vec,-1.,0,  buf_size/8)
+    fvec_write_sample(vec, 1.,0,  buf_size/4)
+    fvec_write_sample(vec,-1.,0,3*buf_size/8)
+    fvec_write_sample(vec, 1.,0,  buf_size/2)
+    fvec_write_sample(vec,-1.,0,5*buf_size/8)
+    fvec_write_sample(vec, 1.,0,3*buf_size/4)
+    fvec_write_sample(vec,-1.,0,7*buf_size/8)
+    for i in range(100):
+      self.assertAlmostEqual(aubio_pitchdetection(self.o,vec),
+        samplerate/2/buf_size*8, 1) 
+    del vec
+
+"""
+class pitchdetection_yin_test_case(pitchdetection_test_case):
+  def setUp(self, type = aubio_pitch_yin):
+    self.create(type=type)
+
+class pitchdetection_fcomb_test_case(pitchdetection_test_case):
+  def setUp(self, type = aubio_pitch_fcomb):
+    self.create(type=type)
+
+class pitchdetection_mcomb_test_case(pitchdetection_test_case):
+  def setUp(self, type = aubio_pitch_mcomb):
+    self.create(type=type)
+
+class pitchdetection_schmitt_test_case(pitchdetection_test_case):
+  def setUp(self, type = aubio_pitch_schmitt):
+    self.create(type=type)
+"""
+
+if __name__ == '__main__':
+  unittest.main()
--- /dev/null
+++ b/tests/python/run_all_tests
@@ -1,0 +1,24 @@
+#! /usr/bin/python
+
+# add ${src}/python and ${src}/python/aubio/.libs to python path
+# so the script is runnable from a compiled source tree.
+import sys, os
+
+cur_dir = os.path.dirname(sys.argv[0])
+sys.path.append(os.path.join(cur_dir,'..','..','python'))
+sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs'))
+
+import unittest
+
+from glob import glob
+def list_of_test_files(path):
+  return [i.split('.')[0].replace('/','.') for i in glob(path)]
+
+modules_to_test  = list_of_test_files('*.py')
+modules_to_test += list_of_test_files('examples/aubio*.py')
+
+if __name__ == '__main__':
+  for module in modules_to_test: 
+    if module != 'run_all_tests': # (not actually needed)
+      exec('from %s import *' % module)
+  unittest.main()
--- /dev/null
+++ b/tests/python/unittest_examples.py
@@ -1,0 +1,31 @@
+import unittest
+
+# this file is just to illustrates and test some of the unittest module
+# functionalities.
+
+class raise_test_case(unittest.TestCase):
+  def test_assertEqual(self):
+    """ check assertEqual returns AssertionError """
+    try:
+      self.assertEqual(0.,1.)
+    except AssertionError:
+      pass
+    else:
+      fail('expected an AssertionError exception')
+
+  def test_assertAlmostEqual(self):
+    """ check assertAlmostEqual returns AssertionError """
+    try:
+      self.assertAlmostEqual(0.,1.)
+    except AssertionError:
+      pass
+    else:
+      fail('expected an AssertionError exception')
+
+  def test_assertRaises(self):
+    """ check assertRaises works as expected """
+    self.assertRaises(AssertionError, self.assertEqual, 0.,1.)
+    self.assertRaises(AssertionError, self.assertAlmostEqual, 0.,1.,1)
+
+if __name__ == '__main__':
+  unittest.main()
--- /dev/null
+++ b/tests/src/Makefile.am
@@ -1,0 +1,36 @@
+AM_CFLAGS = -I$(top_srcdir)/src
+AM_LDFLAGS = -L$(top_builddir)/src -laubio @FFTWLIB_LIBS@
+
+test_phasevoc_jack_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/ext @JACK_CFLAGS@
+test_phasevoc_jack_LDADD  = $(AM_LDFLAGS) -laubioext -L$(top_builddir)/ext @JACK_LIBS@ 
+
+bin_PROGRAMS = \
+	test-fft \
+	test-mfft \
+	test-hist \
+	test-scale \
+	test-sample \
+	test-window \
+	test-filter \
+	test-biquad \
+	test-resample \
+	test-peakpick \
+	test-phasevoc \
+	test-phasevoc-jack \
+	test-onsetdetection \
+	test-pitchyin \
+	test-pitchyinfft \
+	test-pitchschmitt \
+	test-pitchfcomb \
+	test-pitchmcomb \
+	test-pitchdetection \
+	test-beattracking \
+	test-onset \
+	test-tempo \
+	test-tss
+
+run-tests: $(bin_PROGRAMS)
+	@for i in $(bin_PROGRAMS); do echo $$i; ((time ./$$i 2>&1 > /dev/null) 2>&1; echo $$?); done
+
+run-valgrind-tests: $(bin_PROGRAMS)
+	@for i in $(bin_PROGRAMS); do echo $$i; valgrind .libs/lt-$$i 2>&1 | grep ERROR\ SUMMARY -A4; echo $$?; done
--- /dev/null
+++ b/tests/src/test-beattracking.c
@@ -1,0 +1,39 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (win_s/4, channels);     /* input buffer */
+  
+        /* allocate fft and other memory space */
+        aubio_beattracking_t * tempo  = new_aubio_beattracking(win_s, channels);
+
+        uint_t i = 0;
+
+        smpl_t curtempo, curtempoconf;
+
+        while (i < 10) {
+          aubio_beattracking_do(tempo,in,out);
+          curtempo = aubio_beattracking_get_bpm(tempo);
+          if (curtempo != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_beattracking_get_confidence(tempo);
+          if (curtempoconf != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          i++;
+        };
+
+        del_aubio_beattracking(tempo);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-biquad.c
@@ -1,0 +1,16 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        aubio_biquad_t * o = new_aubio_biquad(0.3,0.2,0.1,0.2,0.3);
+
+        aubio_biquad_do_filtfilt(o,in,in);
+        aubio_biquad_do(o,in);
+
+        del_aubio_biquad(o);
+        del_fvec(in);
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-fft.c
@@ -1,0 +1,57 @@
+#include <stdlib.h>
+#include <math.h>
+#include <complex.h>
+#include <aubio.h>
+
+#define NEW_ARRAY(_t,_n)		(_t*)malloc((_n)*sizeof(_t))
+
+
+int main(){
+        uint_t i,j;
+        uint_t win_s      = 1024;                       // window size
+        uint_t channels   = 1;                          // number of channel
+        fvec_t * in       = new_fvec (win_s, channels); // input buffer
+        cvec_t * fftgrain = new_cvec (win_s, channels); // fft norm and phase
+        fvec_t * out      = new_fvec (win_s, channels); // output buffer
+  
+        // allocate fft and other memory space
+        aubio_fft_t * fft      = new_aubio_fft(win_s);    // fft interface
+        smpl_t * w             = NEW_ARRAY(smpl_t,win_s); // window
+        // complex spectral data
+        fft_data_t ** spec     = NEW_ARRAY(fft_data_t*,channels); 
+        for (i=0; i < channels; i++)
+                spec[i] = NEW_ARRAY(fft_data_t,win_s);
+        // initialize the window (see mathutils.c)
+        aubio_window(w,win_s,aubio_win_hanningz);
+  
+        // fill input with some data
+        in->data[0][win_s/2] = 1;
+  
+        // execute stft
+        for (i=0; i < channels; i++) {
+                aubio_fft_do (fft,in->data[i],spec[i],win_s);
+                // put norm and phase into fftgrain
+                aubio_fft_getnorm(fftgrain->norm[i], spec[i], win_s/2+1);
+                aubio_fft_getphas(fftgrain->phas[i], spec[i], win_s/2+1);
+        }
+  
+        // execute inverse fourier transform
+        for (i=0; i < channels; i++) {
+                for (j=0; j<win_s/2+1; j++) {
+                        spec[i][j]  = cexp(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
+                        spec[i][j] *= fftgrain->norm[i][j];
+                }
+                aubio_fft_rdo(fft,spec[i],out->data[i],win_s);
+        }
+
+        del_fvec(in);
+        del_fvec(out);
+        del_cvec(fftgrain);
+        free(w);
+        del_aubio_fft(fft);
+        for (i=0; i < channels; i++)
+                free(spec[i]);
+        free(spec); 
+        aubio_cleanup();
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-filter.c
@@ -1,0 +1,23 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (win_s, channels);     /* input buffer */
+  
+        /* allocate fft and other memory space */
+        aubio_filter_t * o = new_aubio_cdsgn_filter(44100);
+
+        aubio_filter_do(o,in);
+        aubio_filter_do_outplace(o,in,out);
+        aubio_filter_do_filtfilt(o,in,out);
+
+        del_aubio_filter(o);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-hist.c
@@ -1,0 +1,38 @@
+#include <aubio.h>
+#include <stdlib.h>
+
+void print_array(fvec_t *f);
+void print_array(fvec_t *f){
+  uint i,j;
+  for (i=0;i<f->channels;i++){
+    for (j=0;j<f->length;j++){
+      printf("%f, ", f->data[i][j]); 
+    }
+    printf(";\n"); 
+  }
+}
+
+int main( int argc, char** argv )
+{
+  uint_t length;
+  for (length = 1; length < 10; length ++ ) {
+    fvec_t *t = new_fvec(length,5);
+    aubio_hist_t *o = new_aubio_hist(0, 1, length, 5);
+    aubio_window(t->data[0],t->length,aubio_win_hanning);
+    aubio_window(t->data[1],t->length,aubio_win_hanningz);
+    aubio_window(t->data[2],t->length,aubio_win_blackman);
+    aubio_window(t->data[3],t->length,aubio_win_blackman_harris);
+    aubio_window(t->data[4],t->length,aubio_win_hamming);
+    print_array(t);
+    aubio_hist_do(o,t);
+    print_array(t);
+    aubio_hist_do_notnull(o,t);
+    print_array(t);
+    aubio_hist_dyn_notnull(o,t);
+    print_array(t);
+    del_aubio_hist(o);
+    del_fvec(t);
+  }
+  return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-mfft.c
@@ -1,0 +1,28 @@
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 4096;                       /* window size        */
+        uint_t channels   = 100;                        /* number of channels */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
+        fvec_t * out      = new_fvec (win_s, channels); /* output buffer      */
+        /* allocate fft and other memory space */
+        aubio_mfft_t * fft = new_aubio_mfft(win_s,channels);
+        /* fill input with some data */
+        //printf("initialised\n");
+        /* execute stft */
+        aubio_mfft_do (fft,in,fftgrain);
+        //printf("computed forward\n");
+        /* execute inverse fourier transform */
+        aubio_mfft_rdo(fft,fftgrain,out);
+        //printf("computed backard\n");
+        del_aubio_mfft(fft);
+        del_fvec(in);
+        del_cvec(fftgrain);
+        del_fvec(out);
+        //printf("memory freed\n");
+        aubio_cleanup();
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-onset.c
@@ -1,0 +1,23 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s/4, channels); /* input buffer */
+        fvec_t * out      = new_fvec (2, channels);     /* input buffer */
+        aubio_onset_t * onset  = new_aubio_onset(aubio_onset_complex, win_s, win_s/4, channels);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_onset(onset,in,out);
+          i++;
+        };
+
+        del_aubio_onset(onset);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-onsetdetection.c
@@ -1,0 +1,54 @@
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        cvec_t * in       = new_cvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (1, channels);     /* input buffer */
+  
+        /* allocate fft and other memory space */
+        aubio_onsetdetection_t * o = 
+          new_aubio_onsetdetection(aubio_onset_energy, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_energy(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_specdiff, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_specdiff(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_hfc, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_hfc(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_complex, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_complex(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_phase, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_phase(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_kl, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_kl(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        o = new_aubio_onsetdetection(aubio_onset_mkl, win_s, channels);
+        aubio_onsetdetection(o,in,out);
+        aubio_onsetdetection_mkl(o,in,out);
+        del_aubio_onsetdetection(o);
+
+        del_cvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-peakpick.c
@@ -1,0 +1,19 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        aubio_pickpeak_t * o = new_aubio_peakpicker(0.3);
+
+        aubio_peakpick_pimrt(in,o);
+        aubio_peakpick_pimrt(in,o);
+        aubio_peakpick_pimrt(in,o);
+        aubio_peakpick_pimrt(in,o);
+
+        del_aubio_peakpicker(o);
+        del_fvec(in);
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-phasevoc-jack.c
@@ -1,0 +1,84 @@
+/* test sample for phase vocoder 
+ *
+ * this program should start correctly using JACK_START_SERVER=true and
+ * reconstruct each audio input frame perfectly on the corresponding input with
+ * a delay equal to the window size, hop_s.
+ */
+
+#include <unistd.h>  /* pause() or sleep() */
+#include <aubio.h>
+#include <aubioext.h>
+
+uint_t win_s    = 32; /* window size                       */
+uint_t hop_s    = 8;  /* hop size                          */
+uint_t channels = 4;  /* number of channels                */
+uint_t pos      = 0;  /* frames%dspblocksize for jack loop */
+
+fvec_t * in;
+cvec_t * fftgrain;
+fvec_t * out;
+
+aubio_pvoc_t * pv;
+
+#ifdef JACK_SUPPORT
+aubio_jack_t * jack_setup;
+#endif
+
+int aubio_process(float **input, float **output, int nframes);
+
+int main(){
+        /* allocate some memory */
+        in       = new_fvec (hop_s, channels); /* input buffer       */
+        fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
+        out      = new_fvec (hop_s, channels); /* output buffer      */
+        /* allocate fft and other memory space */
+        pv = new_aubio_pvoc(win_s,hop_s,channels);
+        /* fill input with some data */
+        printf("initialised\n");
+        /* execute stft */
+        aubio_pvoc_do (pv,in,fftgrain);
+        printf("computed forward\n");
+        /* execute inverse fourier transform */
+        aubio_pvoc_rdo(pv,fftgrain,out);
+        printf("computed backard\n");
+
+#ifdef JACK_SUPPORT
+        jack_setup  = new_aubio_jack(channels, channels,
+                        (aubio_process_func_t)aubio_process);
+        aubio_jack_activate(jack_setup);
+        sleep(10); //pause(); /* enter main jack loop */
+        aubio_jack_close(jack_setup);
+#endif
+        
+        del_aubio_pvoc(pv);
+        del_cvec(fftgrain);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+        printf("memory freed\n");
+        return 0;
+}
+
+int aubio_process(float **input, float **output, int nframes) {
+  uint_t i;       /*channels*/
+  uint_t j;       /*frames*/
+  for (j=0;j<(unsigned)nframes;j++) {
+    for (i=0;i<channels;i++) {
+      /* write input to datanew */
+      fvec_write_sample(in, input[i][j], i, pos);
+      /* put synthnew in output */
+      output[i][j] = fvec_read_sample(out, i, pos);
+    }
+    /*time for fft*/
+    if (pos == hop_s-1) {
+      /* block loop */
+      aubio_pvoc_do (pv,in, fftgrain);
+      //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] *= 2.; 
+      //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] = 0.; 
+      aubio_pvoc_rdo(pv,fftgrain,out);
+      pos = -1;
+    }
+    pos++;
+  }
+  return 0;
+}
--- /dev/null
+++ b/tests/src/test-phasevoc.c
@@ -1,0 +1,30 @@
+/* test sample for phase vocoder */
+
+#include <aubio.h>
+
+int main(){
+        uint_t win_s    = 1024; /* window size                       */
+        uint_t hop_s    = 256;  /* hop size                          */
+        uint_t channels = 4;  /* number of channels                */
+        /* allocate some memory */
+        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
+        fvec_t * out      = new_fvec (hop_s, channels); /* output buffer      */
+        /* allocate fft and other memory space */
+        aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s,channels);
+        /* fill input with some data */
+        printf("initialised\n");
+        /* execute stft */
+        aubio_pvoc_do (pv,in,fftgrain);
+        printf("computed forward\n");
+        /* execute inverse fourier transform */
+        aubio_pvoc_rdo(pv,fftgrain,out);
+        printf("computed backard\n");
+        del_aubio_pvoc(pv);
+        del_fvec(in);
+        del_cvec(fftgrain);
+        del_fvec(out);
+        aubio_cleanup();
+        printf("memory freed\n");
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-pitchdetection.c
@@ -1,0 +1,27 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t hop_s      = win_s/4;                    /* hop size */
+        uint_t samplerate = 44100;                      /* samplerate */
+        uint_t channels   = 1;                          /* number of channel */
+        aubio_pitchdetection_mode mode = aubio_pitchm_freq;
+        aubio_pitchdetection_type type = aubio_pitch_yinfft;
+        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer */
+        aubio_pitchdetection_t * o  = new_aubio_pitchdetection(
+          win_s, hop_s, channels, samplerate, type, mode
+          );
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchdetection(o,in);
+          i++;
+        };
+
+        del_aubio_pitchdetection(o);
+        del_fvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-pitchfcomb.c
@@ -1,0 +1,25 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t hop_s      = win_s/4;                    /* hop size */
+        uint_t samplerate = 44100;                      /* samplerate */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer */
+        aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb (
+          win_s, hop_s, samplerate
+          );
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchfcomb_detect(o,in);
+          i++;
+        };
+
+        del_aubio_pitchfcomb(o);
+        del_fvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-pitchmcomb.c
@@ -1,0 +1,24 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t hop_s      = win_s/4;                    /* hop size */
+        uint_t samplerate = 44100;
+        uint_t channels   = 1;                          /* number of channel */
+        cvec_t * in       = new_cvec (win_s, channels); /* input buffer */
+        aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(
+          win_s, hop_s, channels, samplerate );
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchmcomb_detect (o,in);
+          i++;
+        };
+
+        del_aubio_pitchmcomb(o);
+        del_cvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-pitchschmitt.c
@@ -1,0 +1,23 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t samplerate = 44100;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, 1); /* input buffer */
+        aubio_pitchschmitt_t * o  = new_aubio_pitchschmitt(
+          win_s, samplerate );
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchschmitt_detect (o,in);
+          i++;
+        };
+
+        del_aubio_pitchschmitt(o);
+        del_fvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-pitchyin.c
@@ -1,0 +1,24 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (win_s/2, channels); /* input buffer */
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_pitchyin_diff   (in,out);
+          aubio_pitchyin_getcum (out);
+          aubio_pitchyin_getpitch (out);
+          aubio_pitchyin_getpitchfast (in,out,0.2);
+          i++;
+        };
+
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-pitchyinfft.c
@@ -1,0 +1,22 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_pitchyinfft_detect (o,in,0.2);
+          i++;
+        };
+
+        del_aubio_pitchyinfft(o);
+        del_fvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-resample.c
@@ -1,0 +1,23 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        smpl_t ratio      = 0.5;
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec ((uint_t)(win_s*ratio), channels);     /* input buffer */
+        aubio_resampler_t * o  = new_aubio_resampler(0.5, 0);
+        uint_t i = 0;
+
+        while (i < 100) {
+          aubio_resampler_process(o,in,out);
+          i++;
+        };
+
+        del_aubio_resampler(o);
+        del_fvec(in);
+        del_fvec(out);
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-sample.c
@@ -1,0 +1,14 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        cvec_t * sp       = new_cvec (win_s, channels); /* input buffer */
+        del_fvec(in);
+        del_cvec(sp);
+
+        return 0;
+}
+
--- /dev/null
+++ b/tests/src/test-scale.c
@@ -1,0 +1,21 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        aubio_scale_t * o = new_aubio_scale(0,1,2,3);
+        aubio_scale_set(o,0,1,2,3);
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_scale_do(o,in);
+          i++;
+        };
+
+        del_aubio_scale(o);
+        del_fvec(in);
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-tempo.c
@@ -1,0 +1,35 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t channels   = 1;                          /* number of channel */
+        fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
+        fvec_t * out      = new_fvec (2, channels);     /* input buffer */
+        aubio_tempo_t * o  = new_aubio_tempo(aubio_onset_complex, win_s, win_s/4, channels);
+        uint_t i = 0;
+
+        smpl_t curtempo, curtempoconf;
+
+        while (i < 1000) {
+          aubio_tempo(o,in,out);
+          curtempo = aubio_tempo_get_bpm(o);
+          if (curtempo != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          curtempoconf = aubio_beattracking_get_confidence(o);
+          if (curtempoconf != 0.) {
+            fprintf(stdout,"%f\n",curtempo);
+            return 1;
+          }
+          i++;
+        };
+
+        del_aubio_tempo(o);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-tss.c
@@ -1,0 +1,47 @@
+/* test sample for phase vocoder 
+ *
+ * this program should start correctly using JACK_START_SERVER=true and
+ * reconstruct each audio input frame perfectly on the corresponding input with
+ * a delay equal to the window size, hop_s.
+ */
+
+#include <aubio.h>
+
+int main(){
+	int i;
+        uint_t win_s    = 1024; /* window size                       */
+        uint_t hop_s    = 256;  /* hop size                          */
+        uint_t channels = 4;  /* number of channels                */
+        /* allocate some memory */
+        fvec_t * in       = new_fvec (hop_s, channels); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s, channels); /* fft norm and phase */
+        cvec_t * cstead   = new_cvec (win_s, channels); /* fft norm and phase */
+        cvec_t * ctrans   = new_cvec (win_s, channels); /* fft norm and phase */
+        fvec_t * stead    = new_fvec (hop_s, channels); /* output buffer      */
+        fvec_t * trans    = new_fvec (hop_s, channels); /* output buffer      */
+        /* allocate fft and other memory space */
+        aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s,channels);
+        aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s,channels);
+        aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s,channels);
+
+	aubio_tss_t *  tss = new_aubio_tss(0.01,3.,4.,win_s,hop_s,channels);
+        /* fill input with some data */
+        printf("initialised\n");
+        /* execute stft */
+	for (i = 0; i < 10; i++) {
+		aubio_pvoc_do (pv,in,fftgrain);
+		aubio_tss_do  (tss,fftgrain,ctrans,cstead);
+		aubio_pvoc_rdo(pvt,cstead,stead);
+		aubio_pvoc_rdo(pvs,ctrans,trans);
+	}
+        del_aubio_pvoc(pv);
+        del_fvec(in);
+        del_cvec(fftgrain);
+        del_cvec(cstead);
+        del_cvec(ctrans);
+        del_fvec(stead);
+        del_fvec(trans);
+        aubio_cleanup();
+        printf("memory freed\n");
+        return 0;
+}
--- /dev/null
+++ b/tests/src/test-window.c
@@ -1,0 +1,37 @@
+#include <aubio.h>
+#include <stdlib.h>
+
+void print_array(fvec_t *f);
+void print_array(fvec_t *f){
+  uint i,j;
+  for (i=0;i<f->channels;i++)
+  {
+    for (j=0;j<f->length;j++)
+    {
+      printf("%1.3e, ", f->data[i][j]); 
+    }
+    printf(";\n"); 
+  }
+}
+
+int main( int argc, char** argv )
+{
+  uint_t length;
+  for (length = 2; length <= 5; length++)
+  {
+    fvec_t *t = new_fvec(length,9);
+    aubio_window(t->data[0],t->length,aubio_win_rectangle);
+    aubio_window(t->data[1],t->length,aubio_win_hamming);
+    aubio_window(t->data[2],t->length,aubio_win_hanning);
+    aubio_window(t->data[3],t->length,aubio_win_hanningz);
+    aubio_window(t->data[4],t->length,aubio_win_blackman);
+    aubio_window(t->data[5],t->length,aubio_win_blackman_harris);
+    aubio_window(t->data[6],t->length,aubio_win_gaussian);
+    aubio_window(t->data[7],t->length,aubio_win_welch);
+    aubio_window(t->data[8],t->length,aubio_win_parzen);
+    print_array(t);
+    del_fvec(t);
+  }
+  return 0;
+}
+