shithub: aubio

Download patch

ref: 21234ee3fc5da2e92ac64d93a06cb71dd3aaeccd
parent: 1573b16c63e78056726d75f3d2f53d0b41b797be
parent: c3c6305987848593034cb34501a9d3bc7afd6e8c
author: Paul Brossier <piem@piem.org>
date: Tue Dec 17 21:07:27 EST 2013

Merge branch 'master' of aubio.org:/git/aubio/aubio into develop

--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,7 @@
 	* Memory management: allocation and freeing of memory has been optimized in
 	many ways. Several memory leaks and out of bound access have been fixed.
 
-	* Optimization: the FFT, central to most algorithm, can now be computed
+	* Optimization: the FFT, central to most algorithms, can now be computed
 	using different optimized algorithms, depending on what is available on your
 	platform (FFTW, Ooura, or vDSP). Other simple optimization tricks are
 	included. Most can be deactivated by configuring the build accordingly.
--- a/doc/web.cfg
+++ b/doc/web.cfg
@@ -769,8 +769,7 @@
 # run.
 
 EXCLUDE                = ../src/aubio_priv.h \
-                         ../src/mathutils \
-                         .h \
+                         ../src/mathutils.h \
                          ../src/io/audio_unit.h \
                          ../src/io/source_sndfile.h \
                          ../src/io/source_apple_audio.h \
@@ -777,7 +776,6 @@
                          ../src/io/source_avcodec.h \
                          ../src/io/sink_sndfile.h \
                          ../src/io/sink_apple_audio.h \
-                         ../src/io/sndfileio.h \
                          ../src/onset/peakpicker.h \
                          ../src/pitch/pitchmcomb.h \
                          ../src/pitch/pitchyin.h \
--- a/examples/aubionotes.c
+++ b/examples/aubionotes.c
@@ -51,7 +51,7 @@
   aubio_onset_do(o, ibuf, onset);
 
   aubio_pitch_do (pitch, ibuf, pitch_obuf);
-  smpl_t new_pitch = fvec_read_sample(pitch_obuf, 0);
+  smpl_t new_pitch = fvec_get_sample(pitch_obuf, 0);
   if(median){
     note_append(note_buffer, new_pitch);
   }
@@ -58,7 +58,7 @@
 
   /* curlevel is negatif or 1 if silence */
   smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
-  if (fvec_read_sample(onset, 0)) {
+  if (fvec_get_sample(onset, 0)) {
     /* test for silence */
     if (curlevel == 1.) {
       if (median) isready = 0;
--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -28,16 +28,13 @@
 aubio_wavetable_t *wavetable;
 fvec_t *onset;
 smpl_t is_onset;
-uint_t is_silence = 0.;
 
 void
 process_block(fvec_t *ibuf, fvec_t *obuf) {
   fvec_zeros(obuf);
   aubio_onset_do (o, ibuf, onset);
-  if (silence_threshold != -90.)
-    is_silence = aubio_silence_detection(ibuf, silence_threshold);
-  is_onset = fvec_read_sample(onset, 0);
-  if ( is_onset && !is_silence ) {
+  is_onset = fvec_get_sample(onset, 0);
+  if ( is_onset ) {
     aubio_wavetable_play ( wavetable );
   } else {
     aubio_wavetable_stop ( wavetable );
@@ -51,7 +48,7 @@
 void
 process_print (void)
 {
-  if ( is_onset && !is_silence ) {
+  if ( is_onset ) {
     outmsg ("%f\n", aubio_onset_get_last_s (o) );
   }
 }
@@ -63,11 +60,15 @@
   verbmsg ("onset method: %s, ", onset_method);
   verbmsg ("buffer_size: %d, ", buffer_size);
   verbmsg ("hop_size: %d, ", hop_size);
-  verbmsg ("threshold: %f, ", silence_threshold);
+  verbmsg ("silence: %f, ", silence_threshold);
   verbmsg ("threshold: %f\n", onset_threshold);
 
   o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
-  if (onset_threshold != 0.) aubio_onset_set_threshold (o, onset_threshold);
+  if (onset_threshold != 0.)
+    aubio_onset_set_threshold (o, onset_threshold);
+  if (silence_threshold != -90.)
+    aubio_onset_set_silence (o, silence_threshold);
+
   onset = new_fvec (1);
 
   wavetable = new_aubio_wavetable (samplerate, hop_size);
--- a/examples/aubiopitch.c
+++ b/examples/aubiopitch.c
@@ -32,7 +32,7 @@
 process_block(fvec_t * ibuf, fvec_t * obuf) {
   fvec_zeros(obuf);
   aubio_pitch_do (o, ibuf, pitch);
-  smpl_t freq = fvec_read_sample(pitch, 0);
+  smpl_t freq = fvec_get_sample(pitch, 0);
   aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
   aubio_wavetable_set_freq ( wavetable, freq );
 
@@ -44,7 +44,7 @@
 
 void
 process_print (void) {
-  smpl_t pitch_found = fvec_read_sample(pitch, 0);
+  smpl_t pitch_found = fvec_get_sample(pitch, 0);
   outmsg("%f %f\n",(blocks)
       *hop_size/(float)samplerate, pitch_found);
 }
@@ -63,8 +63,13 @@
   verbmsg ("tolerance: %f\n", pitch_tolerance);
 
   o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
-  if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance);
-  if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit);
+  if (pitch_tolerance != 0.)
+    aubio_pitch_set_tolerance (o, pitch_tolerance);
+  if (silence_threshold != -90.)
+    aubio_pitch_set_silence (o, silence_threshold);
+  if (pitch_unit != NULL)
+    aubio_pitch_set_unit (o, pitch_unit);
+
   pitch = new_fvec (1);
 
   wavetable = new_aubio_wavetable (samplerate, hop_size);
--- a/examples/aubiotrack.c
+++ b/examples/aubiotrack.c
@@ -28,13 +28,11 @@
 aubio_wavetable_t *wavetable;
 fvec_t * tempo_out;
 smpl_t is_beat = 0;
-smpl_t is_onset = 0;
 uint_t is_silence = 0.;
 
 void process_block(fvec_t * ibuf, fvec_t *obuf) {
   aubio_tempo_do (tempo, ibuf, tempo_out);
-  is_beat = fvec_read_sample (tempo_out, 0);
-  is_onset = fvec_read_sample (tempo_out, 1);
+  is_beat = fvec_get_sample (tempo_out, 0);
   if (silence_threshold != -90.)
     is_silence = aubio_silence_detection(ibuf, silence_threshold);
   fvec_zeros (obuf);
@@ -53,8 +51,6 @@
   if ( is_beat && !is_silence ) {
     outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
   }
-  //if ( is_onset )
-  //  outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
 }
 
 int main(int argc, char **argv) {
--- a/examples/jackio.c
+++ b/examples/jackio.c
@@ -252,9 +252,9 @@
   unsigned int j;       /*frames*/
   for (j=0;j<(unsigned)nframes;j++) {
     /* put synthnew in output */
-    output[0][j] = fvec_read_sample(dev->obuf, dev->pos);
+    output[0][j] = fvec_get_sample(dev->obuf, dev->pos);
     /* write input to datanew */
-    fvec_write_sample(dev->ibuf, input[0][j], dev->pos);
+    fvec_set_sample(dev->ibuf, input[0][j], dev->pos);
     /*time for fft*/
     if (dev->pos == (int)(dev->hop_size) - 1) {
       /* block loop */
--- a/examples/parse_args.h
+++ b/examples/parse_args.h
@@ -61,9 +61,9 @@
 {
   fprintf (stream, "usage: %s [ options ] \n", prog_name);
   fprintf (stream,
-      "       -i      --input            input type\n"
+      "       -i      --input            input file\n"
 #ifdef PROG_HAS_OUTPUT
-      "       -o      --output           output type\n"
+      "       -o      --output           output file\n"
 #endif
       "       -r      --samplerate       select samplerate\n"
       "       -B      --bufsize          set buffer size\n"
@@ -172,7 +172,7 @@
       case 'H':
         hop_size = atoi (optarg);
         break;
-      case 'O':                /*onset type */
+      case 'O':                /*onset method */
         onset_method = optarg;
         break;
       case 't':                /* threshold value for onset */
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -83,7 +83,7 @@
     debug ("Opening files ...\n");
     this_source = new_aubio_source ((char_t*)source_uri, samplerate, hop_size);
     if (this_source == NULL) {
-      outmsg ("Could not open input file %s\n", source_uri);
+      errmsg ("Error: could not open input file %s\n", source_uri);
       exit (1);
     }
     if (samplerate == 0) {
@@ -92,13 +92,13 @@
     if (sink_uri != NULL) {
       uint_t sink_exists = (access(sink_uri, F_OK) == 0 );
       if (!force_overwrite && sink_exists) {
-        outmsg ("Output file %s already exists, use -f to overwrite.\n",
+        errmsg ("Error: output file %s already exists, use -f to overwrite.\n",
             sink_uri);
         exit (1);
       }
       this_sink = new_aubio_sink ((char_t*)sink_uri, samplerate);
       if (this_sink == NULL) {
-        outmsg ("Could not open output file %s\n", sink_uri);
+        errmsg ("Error: could not create output file %s\n", sink_uri);
         exit (1);
       }
     }
--- a/examples/wscript_build
+++ b/examples/wscript_build
@@ -1,5 +1,8 @@
 # vim:set syntax=python:
 
+uselib = []
+uselib += ['JACK']
+
 utils_source = ['utils.c', 'jackio.c']
 programs_source = ctx.path.ant_glob('*.c', excl = utils_source)
 
@@ -7,6 +10,7 @@
 bld(features = 'c',
       source = utils_source,
       includes = ['../src'],
+      uselib = uselib,
       target = 'utilsio')
 
 # loop over all *.c filenames in examples to build them all
--- a/python/demos/demo_mel-energy.py
+++ b/python/demos/demo_mel-energy.py
@@ -61,8 +61,9 @@
         ax.xaxis.set_visible(False)
         ax.yaxis.set_visible(False)
         ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
-        ax.annotate('band %d' % i, xy=(-10, 10),  xycoords='axes points',
+        ax.annotate('band %d' % i, xy=(-10, 0),  xycoords='axes points',
                 horizontalalignment='right', verticalalignment='bottom',
+                size = 'xx-small',
                 )
     set_xlabels_sample2time( ax, all_desc_times[-1], samplerate) 
     #plt.ylabel('spectral descriptor value')
--- a/python/demos/demo_pitch.py
+++ b/python/demos/demo_pitch.py
@@ -56,9 +56,11 @@
 times = [t * hop_s for t in range(len(pitches))]
 
 fig = plt.figure()
+
 ax1 = fig.add_subplot(311)
 ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1)
-ax1.set_xticklabels([])
+plt.setp(ax1.get_xticklabels(), visible = False)
+ax1.set_xlabel('')
 
 def array_from_text_file(filename, dtype = 'float'):
     import os.path
@@ -87,7 +89,8 @@
 ax2.plot(times, cleaned_pitches, '.-')
 #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
 #ax2.axis( ymin = 55, ymax = 70 )
-ax2.set_xticklabels([])
+plt.setp(ax2.get_xticklabels(), visible = False)
+ax2.set_ylabel('f0 (Hz)')
 
 # plot confidence
 ax3 = fig.add_subplot(313, sharex = ax1)
@@ -96,6 +99,7 @@
 # draw a line at tolerance
 ax3.plot(times, [tolerance]*len(confidences))
 ax3.axis( xmin = times[0], xmax = times[-1])
-plt.show()
+ax3.set_ylabel('condidence')
 set_xlabels_sample2time(ax3, times[-1], samplerate)
-#plt.savefig(os.path.basename(filename) + '.png', dpi=200)
+plt.show()
+#plt.savefig(os.path.basename(filename) + '.svg')
--- a/python/demos/demo_specdesc.py
+++ b/python/demos/demo_specdesc.py
@@ -71,7 +71,7 @@
         ax.xaxis.set_visible(False)
         ax.yaxis.set_visible(False)
         ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
-        ax.annotate(method, xy=(-10, 10),  xycoords='axes points',
+        ax.annotate(method, xy=(-10, 0),  xycoords='axes points',
                 horizontalalignment='right', verticalalignment='bottom',
                 )
     set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)
--- a/python/ext/aubio-types.h
+++ b/python/ext/aubio-types.h
@@ -68,3 +68,5 @@
 
 extern PyTypeObject Py_pvocType;
 
+extern PyTypeObject Py_sourceType;
+
--- a/python/ext/aubiomodule.c
+++ b/python/ext/aubiomodule.c
@@ -198,6 +198,7 @@
       || (PyType_Ready (&Py_filterbankType) < 0)
       || (PyType_Ready (&Py_fftType) < 0)
       || (PyType_Ready (&Py_pvocType) < 0)
+      || (PyType_Ready (&Py_sourceType) < 0)
       // generated objects
       || (generated_types_ready() < 0 )
   ) {
@@ -226,6 +227,8 @@
   PyModule_AddObject (m, "fft", (PyObject *) & Py_fftType);
   Py_INCREF (&Py_pvocType);
   PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType);
+  Py_INCREF (&Py_sourceType);
+  PyModule_AddObject (m, "source", (PyObject *) & Py_sourceType);
 
   // add generated objects
   add_generated_objects(m);
--- a/python/ext/aubioproxy.c
+++ b/python/ext/aubioproxy.c
@@ -35,7 +35,13 @@
     // vec = new_fvec (vec->length);
     // no need to really allocate fvec, just its struct member
     vec = (fvec_t *)malloc(sizeof(fvec_t));
-    vec->length = PyArray_SIZE ((PyArrayObject *)array);
+    long length = PyArray_SIZE ((PyArrayObject *)array);
+    if (length > 0) {
+      vec->length = (uint_t)length;
+    } else {
+      PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0");
+      goto fail;
+    }
     vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0);
 
   } else if (PyObject_TypeCheck (input, &PyList_Type)) {
@@ -130,8 +136,20 @@
 
     // no need to really allocate fvec, just its struct member
     mat = (fmat_t *)malloc(sizeof(fmat_t));
-    mat->length = PyArray_DIM ((PyArrayObject *)array, 1);
-    mat->height = PyArray_DIM ((PyArrayObject *)array, 0);
+    long length = PyArray_DIM ((PyArrayObject *)array, 1);
+    if (length > 0) {
+      mat->length = (uint_t)length;
+    } else {
+      PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0");
+      goto fail;
+    }
+    long height = PyArray_DIM ((PyArrayObject *)array, 0);
+    if (height > 0) {
+      mat->height = (uint_t)height;
+    } else {
+      PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0");
+      goto fail;
+    }
     mat->data = (smpl_t **)malloc(sizeof(smpl_t*) * mat->height);
     for (i=0; i< mat->height; i++) {
       mat->data[i] = (smpl_t*)PyArray_GETPTR1 ((PyArrayObject *)array, i);
--- a/python/ext/py-fft.c
+++ b/python/ext/py-fft.c
@@ -25,10 +25,6 @@
 
   self->win_s = Py_default_vector_length;
 
-  if (self == NULL) {
-    return NULL;
-  }
-
   if (win_s > 0) {
     self->win_s = win_s;
   } else if (win_s < 0) {
--- /dev/null
+++ b/python/ext/py-source.c
@@ -1,0 +1,137 @@
+// WARNING: this file is generated, DO NOT EDIT
+
+// WARNING: if you haven't read the first line yet, please do so
+#include "aubiowraphell.h"
+
+typedef struct
+{
+  PyObject_HEAD
+  aubio_source_t * o;
+  char_t* uri;
+  uint_t samplerate;
+  uint_t hop_size;
+} Py_source;
+
+static char Py_source_doc[] = "source object";
+
+static PyObject *
+Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds)
+{
+  Py_source *self;
+  char_t* uri = NULL;
+  uint_t samplerate = 0;
+  uint_t hop_size = 0;
+  static char *kwlist[] = { "uri", "samplerate", "hop_size", NULL };
+
+  if (!PyArg_ParseTupleAndKeywords (args, kwds, "|sII", kwlist,
+          &uri, &samplerate, &hop_size)) {
+    return NULL;
+  }
+
+  self = (Py_source *) pytype->tp_alloc (pytype, 0);
+
+  if (self == NULL) {
+    return NULL;
+  }
+
+  self->uri = "none";
+  if (uri != NULL) {
+    self->uri = uri;
+  }
+
+  self->samplerate = 0;
+  if ((sint_t)samplerate > 0) {
+    self->samplerate = samplerate;
+  } else if ((sint_t)samplerate < 0) {
+    PyErr_SetString (PyExc_ValueError,
+        "can not use negative value for samplerate");
+    return NULL;
+  }
+
+  self->hop_size = Py_default_vector_length / 2;
+  if ((sint_t)hop_size > 0) {
+    self->hop_size = hop_size;
+  } else if ((sint_t)hop_size < 0) {
+    PyErr_SetString (PyExc_ValueError,
+        "can not use negative value for hop_size");
+    return NULL;
+  }
+
+  return (PyObject *) self;
+}
+
+static int
+Py_source_init (Py_source * self, PyObject * args, PyObject * kwds)
+{
+  self->o = new_aubio_source ( self->uri, self->samplerate, self->hop_size );
+  if (self->o == NULL) {
+    PyErr_SetString (PyExc_StandardError, "error creating object");
+    return -1;
+  }
+  self->samplerate = aubio_source_get_samplerate ( self->o );
+
+  return 0;
+}
+
+AUBIO_DEL(source)
+
+/* function Py_source_do */
+static PyObject * 
+Py_source_do(Py_source * self, PyObject * args)
+{
+
+
+  /* output vectors prototypes */
+  fvec_t* read_to;
+  uint_t read;
+
+
+
+
+
+  
+  /* creating output read_to as a new_fvec of length self->hop_size */
+  read_to = new_fvec (self->hop_size);
+  read = 0;
+
+
+  /* compute _do function */
+  aubio_source_do (self->o, read_to, &read);
+
+  PyObject *outputs = PyList_New(0);
+  PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (read_to));
+  //del_fvec (read_to);
+  PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
+  return outputs;
+}
+
+AUBIO_MEMBERS_START(source)
+  {"uri", T_STRING, offsetof (Py_source, uri), READONLY, ""},
+  {"samplerate", T_INT, offsetof (Py_source, samplerate), READONLY, ""},
+  {"hop_size", T_INT, offsetof (Py_source, hop_size), READONLY, ""},
+AUBIO_MEMBERS_STOP(source)
+
+
+static PyObject *
+Pyaubio_source_get_samplerate (Py_source *self, PyObject *unused)
+{
+  uint_t tmp = aubio_source_get_samplerate (self->o);
+  return (PyObject *)PyInt_FromLong (tmp);
+}
+
+static PyObject *
+Pyaubio_source_get_channels (Py_source *self, PyObject *unused)
+{
+  uint_t tmp = aubio_source_get_channels (self->o);
+  return (PyObject *)PyInt_FromLong (tmp);
+}
+
+static PyMethodDef Py_source_methods[] = {
+  {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate,
+    METH_NOARGS, ""},
+  {"get_channels", (PyCFunction) Pyaubio_source_get_channels,
+    METH_NOARGS, ""},
+  {NULL} /* sentinel */
+};
+
+AUBIO_TYPEOBJECT(source, "aubio.source")
--- a/python/lib/gen_pyobject.py
+++ b/python/lib/gen_pyobject.py
@@ -239,9 +239,9 @@
             s += """\
 
   self->%(pname)s = %(defval)s;
-  if (%(pname)s > 0) {
+  if ((sint_t)%(pname)s > 0) {
     self->%(pname)s = %(pname)s;
-  } else if (%(pname)s < 0) {
+  } else if ((sint_t)%(pname)s < 0) {
     PyErr_SetString (PyExc_ValueError,
         "can not use negative value for %(pname)s");
     return NULL;
--- a/python/lib/generator.py
+++ b/python/lib/generator.py
@@ -56,6 +56,7 @@
       'pitchyinfft',
       'sink_apple_audio',
       'sink_sndfile',
+      'source',
       'source_apple_audio',
       'source_sndfile',
       'source_avcodec',
--- a/python/setup.py
+++ b/python/setup.py
@@ -53,6 +53,7 @@
     "ext/py-filterbank.c",
     "ext/py-fft.c",
     "ext/py-phasevoc.c",
+    "ext/py-source.c",
     # generated files
     ] + generated_object_files,
     include_dirs = include_dirs,
--- a/src/aubio.h
+++ b/src/aubio.h
@@ -184,7 +184,6 @@
 #include "tempo/tempo.h"
 #include "io/source.h"
 #include "io/sink.h"
-#include "io/audio_unit.h"
 #include "synth/sampler.h"
 #include "synth/wavetable.h"
 #include "utils/parameter.h"
@@ -196,7 +195,7 @@
 #include "io/source_avcodec.h"
 #include "io/sink_sndfile.h"
 #include "io/sink_apple_audio.h"
-#include "io/sndfileio.h"
+#include "io/audio_unit.h"
 #include "onset/peakpicker.h"
 #include "pitch/pitchmcomb.h"
 #include "pitch/pitchyin.h"
--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -24,8 +24,8 @@
  * This file is for inclusion from _within_ the library only.
  */
 
-#ifndef _AUBIO_PRIV_H
-#define _AUBIO_PRIV_H
+#ifndef _AUBIO__PRIV_H
+#define _AUBIO__PRIV_H
 
 /*********************
  *
@@ -217,4 +217,4 @@
 
 #define UNUSED __attribute__((unused))
 
-#endif/*_AUBIO_PRIV_H*/
+#endif /* _AUBIO__PRIV_H */
--- a/src/cvec.c
+++ b/src/cvec.c
@@ -38,22 +38,27 @@
   AUBIO_FREE(s);
 }
 
-void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position) {
+void cvec_norm_set_sample (cvec_t *s, smpl_t data, uint_t position) {
   s->norm[position] = data;
 }
-void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position) {
+
+void cvec_phas_set_sample (cvec_t *s, smpl_t data, uint_t position) {
   s->phas[position] = data;
 }
-smpl_t cvec_read_norm(cvec_t *s, uint_t position) {
+
+smpl_t cvec_norm_get_sample (cvec_t *s, uint_t position) {
   return s->norm[position];
 }
-smpl_t cvec_read_phas(cvec_t *s, uint_t position) {
+
+smpl_t cvec_phas_get_sample (cvec_t *s, uint_t position) {
   return s->phas[position];
 }
-smpl_t * cvec_get_norm(cvec_t *s) {
+
+smpl_t * cvec_norm_get_data (cvec_t *s) {
   return s->norm;
 }
-smpl_t * cvec_get_phas(cvec_t *s) {
+
+smpl_t * cvec_phas_get_data (cvec_t *s) {
   return s->phas;
 }
 
@@ -91,7 +96,7 @@
 #endif
 }
 
-void cvec_set_all_norm(cvec_t *s, smpl_t val) {
+void cvec_norm_set_all (cvec_t *s, smpl_t val) {
   uint_t j;
   for (j=0; j< s->length; j++) {
     s->norm[j] = val;
@@ -98,19 +103,19 @@
   }
 }
 
-void cvec_zeros_norm(cvec_t *s) {
+void cvec_norm_zeros(cvec_t *s) {
 #if HAVE_MEMCPY_HACKS
   memset(s->norm, 0, s->length * sizeof(smpl_t));
 #else
-  cvec_set_all_norm(s, 0.);
+  cvec_norm_set_all (s, 0.);
 #endif
 }
 
-void cvec_ones_norm(cvec_t *s) {
-  cvec_set_all_norm(s, 1.);
+void cvec_norm_ones(cvec_t *s) {
+  cvec_norm_set_all (s, 1.);
 }
 
-void cvec_set_all_phas(cvec_t *s, smpl_t val) {
+void cvec_phas_set_all (cvec_t *s, smpl_t val) {
   uint_t j;
   for (j=0; j< s->length; j++) {
     s->phas[j] = val;
@@ -117,19 +122,19 @@
   }
 }
 
-void cvec_zeros_phas(cvec_t *s) {
+void cvec_phas_zeros(cvec_t *s) {
 #if HAVE_MEMCPY_HACKS
   memset(s->phas, 0, s->length * sizeof(smpl_t));
 #else
-  cvec_set_all_phas(s, 0.);
+  cvec_phas_set_all (s, 0.);
 #endif
 }
 
-void cvec_ones_phas(cvec_t *s) {
-  cvec_set_all_phas(s, 1.);
+void cvec_phas_ones(cvec_t *s) {
+  cvec_phas_set_all (s, 1.);
 }
 
 void cvec_zeros(cvec_t *s) {
-  cvec_zeros_norm(s);
-  cvec_zeros_phas(s);
+  cvec_norm_zeros(s);
+  cvec_phas_zeros(s);
 }
--- a/src/cvec.h
+++ b/src/cvec.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _CVEC_H
-#define _CVEC_H
+#ifndef _AUBIO__CVEC_H
+#define _AUBIO__CVEC_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -27,17 +27,17 @@
 
 /** \file
 
-  Vector of complex-valued data
+  Vector of complex-valued data, stored in polar coordinates
 
   This file specifies the ::cvec_t buffer type, which is used throughout aubio
   to store complex data. Complex values are stored in terms of ::cvec_t.phas
-  and norm, within size/2+1 long vectors of ::smpl_t.
+  and norm, within 2 vectors of ::smpl_t of size (size/2+1) each.
 
   \example test-cvec.c
 
 */
 
-/** Buffer for complex data
+/** Vector of real-valued phase and spectrum data
 
   \code
 
@@ -78,6 +78,7 @@
 
 */
 cvec_t * new_cvec(uint_t length);
+
 /** cvec_t buffer deletion function
 
   \param s buffer to delete as returned by new_cvec()
@@ -84,72 +85,84 @@
 
 */
 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[position]. Its purpose
-  is to access these values from wrappers, as created by swig.
+  This is equivalent to:
+  \code
+  s->norm[position] = val;
+  \endcode
 
   \param s vector to write to
-  \param data norm value to write in s->norm[position]
+  \param val norm value to write in s->norm[position]
   \param position sample position to write to
 
 */
-void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position);
+void cvec_norm_set_sample (cvec_t *s, smpl_t val, 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[position]. Its purpose
-  is to access these values from wrappers, as created by swig.
+  This is equivalent to:
+  \code
+  s->phas[position] = val;
+  \endcode
 
   \param s vector to write to
-  \param data phase value to write in s->phas[position]
+  \param val phase value to write in s->phas[position]
   \param position sample position to write to
 
 */
-void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position);
+void cvec_phas_set_sample (cvec_t *s, smpl_t val, 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[position]. Its purpose is to
-  access these values from wrappers, as created by swig.
+  This is equivalent to:
+  \code
+  smpl_t foo = s->norm[position];
+  \endcode
 
   \param s vector to read from
   \param position sample position to read from
 
 */
-smpl_t cvec_read_norm(cvec_t *s, uint_t position);
+smpl_t cvec_norm_get_sample (cvec_t *s, 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[position]. Its purpose is to
-  access these values from wrappers, as created by swig.
+  This is equivalent to:
+  \code
+  smpl_t foo = s->phas[position];
+  \endcode
 
   \param s vector to read from
   \param position sample position to read from
+  \returns the value of the sample at position
 
 */
-smpl_t cvec_read_phas(cvec_t *s, uint_t position);
+smpl_t cvec_phas_get_sample (cvec_t *s, uint_t position);
+
 /** 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.
+  \code
+  smpl_t *data = s->norm;
+  \endcode
 
   \param s vector to read from
 
 */
-smpl_t * cvec_get_norm(cvec_t *s);
+smpl_t * cvec_norm_get_data (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.
+  This is equivalent to:
+  \code
+  smpl_t *data = s->phas;
+  \endcode
 
   \param s vector to read from
 
 */
-smpl_t * cvec_get_phas(cvec_t *s);
+smpl_t * cvec_phas_get_data (cvec_t *s);
 
 /** print out cvec data
 
@@ -172,7 +185,7 @@
   \param val value to set elements to
 
 */
-void cvec_set_all_norm(cvec_t *s, smpl_t val);
+void cvec_norm_set_all (cvec_t *s, smpl_t val);
 
 /** set all norm elements to zero
 
@@ -179,7 +192,7 @@
   \param s vector to modify
 
 */
-void cvec_zeros_norm(cvec_t *s);
+void cvec_norm_zeros(cvec_t *s);
 
 /** set all norm elements to one
 
@@ -186,7 +199,7 @@
   \param s vector to modify
 
 */
-void cvec_ones_norm(cvec_t *s);
+void cvec_norm_ones(cvec_t *s);
 
 /** set all phase elements to a given value
 
@@ -194,7 +207,7 @@
   \param val value to set elements to
 
 */
-void cvec_set_all_phas(cvec_t *s, smpl_t val);
+void cvec_phas_set_all (cvec_t *s, smpl_t val);
 
 /** set all phase elements to zero
 
@@ -201,7 +214,7 @@
   \param s vector to modify
 
 */
-void cvec_zeros_phas(cvec_t *s);
+void cvec_phas_zeros(cvec_t *s);
 
 /** set all phase elements to one
 
@@ -208,7 +221,7 @@
   \param s vector to modify
 
 */
-void cvec_ones_phas(cvec_t *s);
+void cvec_phas_ones(cvec_t *s);
 
 /** set all norm and phas elements to zero
 
@@ -221,5 +234,4 @@
 }
 #endif
 
-#endif /* _CVEC_H */
-
+#endif /* _AUBIO__CVEC_H */
--- a/src/fmat.c
+++ b/src/fmat.c
@@ -21,7 +21,7 @@
 #include "aubio_priv.h"
 #include "fmat.h"
 
-fmat_t * new_fmat (uint_t length, uint_t height) {
+fmat_t * new_fmat (uint_t height, uint_t length) {
   if ((sint_t)length <= 0 || (sint_t)height <= 0 ) {
     return NULL;
   }
@@ -48,19 +48,22 @@
   AUBIO_FREE(s);
 }
 
-void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) {
+void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) {
   s->data[channel][position] = data;
 }
-smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position) {
+
+smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position) {
   return s->data[channel][position];
 }
-void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel) {
-  s->data[channel] = data;
-}
+
 void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) {
   output->data = s->data[channel];
   output->length = s->length;
   return;
+}
+
+smpl_t * fmat_get_channel_data(fmat_t *s, uint_t channel) {
+  return s->data[channel];
 }
 
 smpl_t ** fmat_get_data(fmat_t *s) {
--- a/src/fmat.h
+++ b/src/fmat.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _FMAT_H
-#define _FMAT_H
+#ifndef _AUBIO__FMAT_H
+#define _AUBIO__FMAT_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -49,7 +49,8 @@
   \param height the height of the matrix to create
 
 */
-fmat_t * new_fmat(uint_t length, uint_t height);
+fmat_t * new_fmat(uint_t height, uint_t length);
+
 /** fmat_t buffer deletion function
 
   \param s buffer to delete as returned by new_fmat()
@@ -56,24 +57,18 @@
 
 */
 void del_fmat(fmat_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 fmat_read_sample(fmat_t *s, uint_t channel, uint_t position);
+smpl_t fmat_get_sample(fmat_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 
@@ -80,13 +75,10 @@
   \param position sample position to write to 
 
 */
-void  fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position);
+void  fmat_set_sample(fmat_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
   \param output ::fvec_t to output to
@@ -93,24 +85,17 @@
 
 */
 void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output);
-/** 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.
+/** get vector buffer from an fmat data
 
-  \param s vector to write to 
-  \param data vector of [length] values to write
-  \param channel channel to write to 
+  \param s vector to read from
+  \param channel channel to read from
 
 */
-void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel);
+smpl_t * fmat_get_channel_data (fmat_t *s, 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
 
 */
@@ -175,4 +160,4 @@
 }
 #endif
 
-#endif /* _FMAT_H */
+#endif /* _AUBIO__FMAT_H */
--- a/src/fvec.c
+++ b/src/fvec.c
@@ -36,11 +36,11 @@
   AUBIO_FREE(s);
 }
 
-void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position) {
+void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position) {
   s->data[position] = data;
 }
 
-smpl_t fvec_read_sample(fvec_t *s, uint_t position) {
+smpl_t fvec_get_sample(fvec_t *s, uint_t position) {
   return s->data[position];
 }
 
@@ -58,7 +58,7 @@
   AUBIO_MSG("\n");
 }
 
-void fvec_set(fvec_t *s, smpl_t val) {
+void fvec_set_all (fvec_t *s, smpl_t val) {
   uint_t j;
   for (j=0; j< s->length; j++) {
     s->data[j] = val;
@@ -69,12 +69,12 @@
 #if HAVE_MEMCPY_HACKS
   memset(s->data, 0, s->length * sizeof(smpl_t));
 #else
-  fvec_set(s, 0.);
+  fvec_set_all (s, 0.);
 #endif
 }
 
 void fvec_ones(fvec_t *s) {
-  fvec_set(s, 1.);
+  fvec_set_all (s, 1.);
 }
 
 void fvec_rev(fvec_t *s) {
--- a/src/fvec.h
+++ b/src/fvec.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _FVEC_H
-#define _FVEC_H
+#ifndef _AUBIO__FVEC_H
+#define _AUBIO__FVEC_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -75,6 +75,7 @@
 
 */
 fvec_t * new_fvec(uint_t length);
+
 /** fvec_t buffer deletion function
 
   \param s buffer to delete as returned by new_fvec()
@@ -81,36 +82,26 @@
 
 */
 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[position]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
   \param s vector to read from
   \param position sample position to read from 
 
 */
-smpl_t fvec_read_sample(fvec_t *s, uint_t position);
+smpl_t fvec_get_sample(fvec_t *s, 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[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[position]
   \param position sample position to write to 
 
 */
-void  fvec_write_sample(fvec_t *s, smpl_t data, uint_t position);
+void  fvec_set_sample(fvec_t *s, smpl_t data, uint_t position);
 
 /** 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
 
 */
@@ -129,7 +120,7 @@
   \param val value to set elements to
 
 */
-void fvec_set(fvec_t *s, smpl_t val);
+void fvec_set_all (fvec_t *s, smpl_t val);
 
 /** set all elements to zero 
 
@@ -175,4 +166,4 @@
 }
 #endif
 
-#endif /* _FVEC_H */
+#endif /* _AUBIO__FVEC_H */
--- a/src/io/audio_unit.c
+++ b/src/io/audio_unit.c
@@ -104,8 +104,8 @@
   o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels);
 
   /* the floats coming from and to the device callback */
-  o->output_frames = new_fmat(blocksize, sw_output_channels);
-  o->input_frames = new_fmat(blocksize, sw_input_channels);
+  o->output_frames = new_fmat(sw_output_channels, blocksize);
+  o->input_frames = new_fmat(sw_input_channels, blocksize);
 
   /* check for some sizes */
   if ( o->hw_output_channels != o->output_frames->height ) {
--- a/src/io/sndfileio.c
+++ /dev/null
@@ -1,254 +1,0 @@
-/*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
-
-  This file is part of aubio.
-
-  aubio 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 3 of the License, or
-  (at your option) any later version.
-
-  aubio 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 aubio.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "config.h"
-
-#ifdef HAVE_SNDFILE
-
-#include <string.h>
-
-#include <sndfile.h>
-
-#include "aubio_priv.h"
-#include "fvec.h"
-#include "sndfileio.h"
-#include "mathutils.h"
-
-#define MAX_CHANNELS 6
-#define MAX_SIZE 4096
-
-struct _aubio_sndfile_t {
-        SNDFILE *handle;
-        int samplerate;
-        int channels;
-        int format;
-        float *tmpdata; /** scratch pad for interleaving/deinterleaving. */
-        int size;       /** store the size to check if realloc needed */
-};
-
-aubio_sndfile_t * new_aubio_sndfile_ro(const char* outputname) {
-        aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t);
-        SF_INFO sfinfo;
-        AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
-
-        f->handle = sf_open (outputname, SFM_READ, &sfinfo);
-
-        if (f->handle == NULL) {
-                AUBIO_ERR("Failed opening %s: %s\n", outputname,
-                        sf_strerror (NULL)); /* libsndfile err msg */
-                return NULL;
-        }	
-
-        if (sfinfo.channels > MAX_CHANNELS) { 
-                AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS);
-                return NULL;
-        }
-
-        f->size       = MAX_SIZE*sfinfo.channels;
-        f->tmpdata    = AUBIO_ARRAY(float,f->size);
-        /* get input specs */
-        f->samplerate = sfinfo.samplerate;
-        f->channels   = sfinfo.channels;
-        f->format     = sfinfo.format;
-
-        return f;
-}
-
-int aubio_sndfile_open_wo(aubio_sndfile_t * f, const char* inputname) {
-        SF_INFO sfinfo;
-        AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
-
-        /* define file output spec */
-        sfinfo.samplerate = f->samplerate;
-        sfinfo.channels   = f->channels;
-        sfinfo.format     = f->format;
-
-        if (! (f->handle = sf_open (inputname, SFM_WRITE, &sfinfo))) {
-                AUBIO_ERR("Not able to open output file %s.\n", inputname);
-                AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */
-                AUBIO_QUIT(AUBIO_FAIL);
-        }	
-
-        if (sfinfo.channels > MAX_CHANNELS) { 
-                AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS);
-                AUBIO_QUIT(AUBIO_FAIL);
-        }
-        f->size       = MAX_SIZE*sfinfo.channels;
-        f->tmpdata    = AUBIO_ARRAY(float,f->size);
-        return AUBIO_OK;
-}
-
-/* setup file struct from existing one */
-aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * fmodel, const char *outputname) {
-        aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t);
-        f->samplerate    = fmodel->samplerate;
-        f->channels      = 1; //fmodel->channels;
-        f->format        = fmodel->format;
-        aubio_sndfile_open_wo(f, outputname);
-        return f;
-}
-
-
-/* return 0 if properly closed, 1 otherwise */
-int del_aubio_sndfile(aubio_sndfile_t * f) {
-        if (sf_close(f->handle)) {
-                AUBIO_ERR("Error closing file.");
-                puts (sf_strerror (NULL));
-                return 1;
-        }
-        AUBIO_FREE(f->tmpdata);
-        AUBIO_FREE(f);
-        //AUBIO_DBG("File closed.\n");
-        return 0;
-}
-
-/**************************************************************
- *
- * Read write methods 
- *
- */
-
-
-/* read frames from file in data 
- *  return the number of frames actually read */
-int aubio_sndfile_read(aubio_sndfile_t * f, int frames, fvec_t ** read) {
-        sf_count_t read_frames;
-        int i,j, channels = f->channels;
-        int nsamples = frames*channels;
-        int aread;
-        smpl_t *pread;	
-
-        /* allocate data for de/interleaving reallocated when needed. */
-        if (nsamples >= f->size) {
-                AUBIO_ERR("Maximum aubio_sndfile_read buffer size exceeded.");
-                return -1;
-                /*
-                AUBIO_FREE(f->tmpdata);
-                f->tmpdata = AUBIO_ARRAY(float,nsamples);
-                */
-        }
-        //f->size = nsamples;
-
-        /* do actual reading */
-        read_frames = sf_read_float (f->handle, f->tmpdata, nsamples);
-
-        aread = (int)FLOOR(read_frames/(float)channels);
-
-        /* de-interleaving data  */
-        for (i=0; i<channels; i++) {
-                pread = (smpl_t *)fvec_get_data(read[i]);
-                for (j=0; j<aread; j++) {
-                        pread[j] = (smpl_t)f->tmpdata[channels*j+i];
-                }
-        }
-        return aread;
-}
-
-int
-aubio_sndfile_read_mono (aubio_sndfile_t * f, int frames, fvec_t * read)
-{
-  sf_count_t read_frames;
-  int i, j, channels = f->channels;
-  int nsamples = frames * channels;
-  int aread;
-  smpl_t *pread;
-
-  /* allocate data for de/interleaving reallocated when needed. */
-  if (nsamples >= f->size) {
-    AUBIO_ERR ("Maximum aubio_sndfile_read buffer size exceeded.");
-    return -1;
-    /*
-    AUBIO_FREE(f->tmpdata);
-    f->tmpdata = AUBIO_ARRAY(float,nsamples);
-    */
-  }
-  //f->size = nsamples;
-
-  /* do actual reading */
-  read_frames = sf_read_float (f->handle, f->tmpdata, nsamples);
-
-  aread = (int) FLOOR (read_frames / (float) channels);
-
-  /* de-interleaving data  */
-  pread = (smpl_t *) fvec_get_data (read);
-  for (i = 0; i < channels; i++) {
-    for (j = 0; j < aread; j++) {
-      pread[j] += (smpl_t) f->tmpdata[channels * j + i];
-    }
-  }
-  for (j = 0; j < aread; j++) {
-    pread[j] /= (smpl_t)channels;
-  }
-
-  return aread;
-}
-
-/* write 'frames' samples to file from data 
- *   return the number of frames actually written 
- */
-int aubio_sndfile_write(aubio_sndfile_t * f, int frames, fvec_t ** write) {
-        sf_count_t written_frames = 0;
-        int i, j,	channels = f->channels;
-        int nsamples = channels*frames;
-        smpl_t *pwrite;
-
-        /* allocate data for de/interleaving reallocated when needed. */
-        if (nsamples >= f->size) {
-                AUBIO_ERR("Maximum aubio_sndfile_write buffer size exceeded.");
-                return -1;
-                /*
-                AUBIO_FREE(f->tmpdata);
-                f->tmpdata = AUBIO_ARRAY(float,nsamples);
-                */
-        }
-        //f->size = nsamples;
-
-        /* interleaving data  */
-        for (i=0; i<channels; i++) {
-                pwrite = (smpl_t *)fvec_get_data(write[i]);
-                for (j=0; j<frames; j++) {
-                        f->tmpdata[channels*j+i] = (float)pwrite[j];
-                }
-        }
-        written_frames = sf_write_float (f->handle, f->tmpdata, nsamples);
-        return written_frames/channels;
-}
-
-/*******************************************************************
- *
- * Get object info 
- *
- */
-
-uint_t aubio_sndfile_channels(aubio_sndfile_t * f) {
-        return f->channels;
-}
-
-uint_t aubio_sndfile_samplerate(aubio_sndfile_t * f) {
-        return f->samplerate;
-}
-
-void aubio_sndfile_info(aubio_sndfile_t * f) {
-        AUBIO_DBG("srate    : %d\n", f->samplerate);
-        AUBIO_DBG("channels : %d\n", f->channels);
-        AUBIO_DBG("format   : %d\n", f->format);
-}
-
-#endif /* HAVE_SNDFILE */
--- a/src/io/sndfileio.h
+++ /dev/null
@@ -1,84 +1,0 @@
-/*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
-
-  This file is part of aubio.
-
-  aubio 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 3 of the License, or
-  (at your option) any later version.
-
-  aubio 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 aubio.  If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef SNDFILEIO_H
-#define SNDFILEIO_H
-
-/** \file
-
-  sndfile functions
-
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * sndfile object
- */
-typedef struct _aubio_sndfile_t aubio_sndfile_t;
-/** 
- * Open a sound file for reading
- */
-aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile);
-/**
- * Copy file model from previously opened sound file.
- */
-aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname);
-/** 
- * Open a sound file for writing
- */
-int aubio_sndfile_open_wo (aubio_sndfile_t * file, const char * outputname);
-/** 
- * Read frames data from file into an array of buffers
- */
-int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t ** read);
-/** 
- * Read frames data from file into a single buffer
- */
-int aubio_sndfile_read_mono (aubio_sndfile_t * f, int frames, fvec_t * read);
-/** 
- * Write data of length frames to file
- */
-int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t ** write);
-/**
- * Close file and delete file object
- */
-int del_aubio_sndfile(aubio_sndfile_t * file);
-/**
- * Return some files facts
- */
-void aubio_sndfile_info(aubio_sndfile_t * file);
-/**
- * Return number of channel in file
- */
-uint_t aubio_sndfile_channels(aubio_sndfile_t * file);
-/**
- * Return samplerate of a file (Hz)
- */
-uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
--- a/src/io/source.c
+++ b/src/io/source.c
@@ -23,9 +23,9 @@
 #include "fvec.h"
 #include "fmat.h"
 #include "io/source.h"
-#ifdef HAVE_AVCODEC
+#ifdef HAVE_LIBAV
 #include "io/source_avcodec.h"
-#endif /* HAVE_AVCODEC */
+#endif /* HAVE_LIBAV */
 #ifdef __APPLE__
 #include "io/source_apple_audio.h"
 #endif /* __APPLE__ */
@@ -52,7 +52,7 @@
 
 aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) {
   aubio_source_t * s = AUBIO_NEW(aubio_source_t);
-#if HAVE_AVCODEC
+#if HAVE_LIBAV
   s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);
   if (s->source) {
     s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do);
@@ -63,7 +63,7 @@
     s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);
     return s;
   }
-#endif /* HAVE_AVCODEC */
+#endif /* HAVE_LIBAV */
 #ifdef __APPLE__
   s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size);
   if (s->source) {
--- a/src/io/source.h
+++ b/src/io/source.h
@@ -40,7 +40,7 @@
   
   On Mac and iOS platforms, aubio should be compiled with CoreAudio [Extended
   Audio File Services]
-  (https://developer.apple.com/library/mac/documentation/musicaudio/CAAudioTooboxRef/_index.html).
+  (https://developer.apple.com/library/mac/documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html).
   This provides access to most common audio file formats, including compressed
   ones.
 
--- a/src/io/source_avcodec.c
+++ b/src/io/source_avcodec.c
@@ -21,9 +21,8 @@
 
 #include "config.h"
 
-#ifdef HAVE_AVCODEC
+#ifdef HAVE_LIBAV
 
-#include <sndfile.h>
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
 #include <libavresample/avresample.h>
@@ -402,4 +401,4 @@
   AUBIO_FREE(s);
 }
 
-#endif /* HAVE_SNDFILE */
+#endif /* HAVE_LIBAV */
--- a/src/lvec.c
+++ b/src/lvec.c
@@ -39,7 +39,7 @@
 void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position) {
   s->data[position] = data;
 }
-lsmp_t lvec_read_sample(lvec_t *s, uint_t position) {
+lsmp_t lvec_get_sample(lvec_t *s, uint_t position) {
   return s->data[position];
 }
 
@@ -57,7 +57,7 @@
   AUBIO_MSG("\n");
 }
 
-void lvec_set(lvec_t *s, smpl_t val) {
+void lvec_set_all (lvec_t *s, smpl_t val) {
   uint_t j;
   for (j=0; j< s->length; j++) {
     s->data[j] = val;
@@ -68,11 +68,11 @@
 #if HAVE_MEMCPY_HACKS
   memset(s->data, 0, s->length * sizeof(lsmp_t));
 #else
-  lvec_set(s, 0.);
+  lvec_set_all (s, 0.);
 #endif
 }
 
 void lvec_ones(lvec_t *s) {
-  lvec_set(s, 1.);
+  lvec_set_all (s, 1.);
 }
 
--- a/src/lvec.h
+++ b/src/lvec.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _LVEC_H
-#define _LVEC_H
+#ifndef _AUBIO__LVEC_H
+#define _AUBIO__LVEC_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,36 +57,26 @@
 
 */
 void del_lvec(lvec_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[position]. Its purpose is to
-  access these values from wrappers, as created by swig.
-
   \param s vector to read from
   \param position sample position to read from 
 
 */
-lsmp_t lvec_read_sample(lvec_t *s, uint_t position);
+lsmp_t lvec_get_sample(lvec_t *s, 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[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[position]
   \param position sample position to write to 
 
 */
-void  lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position);
+void  lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position);
 
 /** 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
 
 */
@@ -105,7 +95,7 @@
   \param val value to set elements to
 
 */
-void lvec_set(lvec_t *s, smpl_t val);
+void lvec_set_all(lvec_t *s, smpl_t val);
 
 /** set all elements to zero 
 
@@ -125,4 +115,4 @@
 }
 #endif
 
-#endif /* _LVEC_H */
+#endif /* _AUBIO__LVEC_H */
--- a/src/mathutils.h
+++ b/src/mathutils.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -27,8 +27,8 @@
 
  */
 
-#ifndef MATHUTILS_H
-#define MATHUTILS_H
+#ifndef _AUBIO_MATHUTILS_H
+#define _AUBIO_MATHUTILS_H
 
 #include "fvec.h"
 #include "musicutils.h"
@@ -282,5 +282,4 @@
 }
 #endif
 
-#endif
-
+#endif /* _AUBIO_MATHUTILS_H */
--- a/src/musicutils.h
+++ b/src/musicutils.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -22,8 +22,8 @@
  *  various functions useful in audio signal processing
  */
 
-#ifndef MUSICUTILS_H
-#define MUSICUTILS_H
+#ifndef _AUBIO__MUSICUTILS_H
+#define _AUBIO__MUSICUTILS_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -30,7 +30,24 @@
 #endif
 
 /** create window 
+
+  \param window_type type of the window to create
+  \param size length of the window to create (see fvec_set_window())
  
+*/
+fvec_t *new_aubio_window (char_t * window_type, uint_t size);
+
+/** set elements of a vector to window coefficients
+
+  \param window exsting ::fvec_t to use
+  \param window_type type of the window to create
+
+  List of available window types: "rectangle", "hamming", "hanning",
+  "hanningz", "blackman", "blackman_harris", "gaussian", "welch", "parzen",
+  "default".
+
+  "default" is equivalent to "hanningz".
+
   References:
     
     - <a href="http://en.wikipedia.org/wiki/Window_function">Window
@@ -42,11 +59,6 @@
   (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz">
   ps.gz</a>)
 
-*/
-fvec_t *new_aubio_window (char_t * window_type, uint_t size);
-
-/** set elements of a vector to window coefficients
-
  */
 uint_t fvec_set_window (fvec_t * window, char_t * window_type);
 
@@ -148,5 +160,4 @@
 }
 #endif
 
-#endif
-
+#endif /* _AUBIO__MUSICUTILS_H */
--- a/src/onset/onset.h
+++ b/src/onset/onset.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -39,8 +39,8 @@
 */
 
 
-#ifndef ONSET_H
-#define ONSET_H
+#ifndef _AUBIO_ONSET_H
+#define _AUBIO_ONSET_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -268,4 +268,4 @@
 }
 #endif
 
-#endif /* ONSET_H */
+#endif /* _AUBIO_ONSET_H */
--- a/src/onset/peakpicker.h
+++ b/src/onset/peakpicker.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -26,8 +26,8 @@
   
 */
 
-#ifndef PEAKPICK_H
-#define PEAKPICK_H
+#ifndef _AUBIO_PEAKPICK_H
+#define _AUBIO_PEAKPICK_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -54,4 +54,4 @@
 }
 #endif
 
-#endif /* PEAKPICK_H */
+#endif /* _AUBIO_PEAKPICK_H */
--- a/src/pitch/pitch.h
+++ b/src/pitch/pitch.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef PITCH_H
-#define PITCH_H
+#ifndef _AUBIO_PITCH_H
+#define _AUBIO_PITCH_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -179,4 +179,4 @@
 }
 #endif
 
-#endif /*PITCH_H*/
+#endif /* _AUBIO_PITCH_H */
--- a/src/pitch/pitchfcomb.h
+++ b/src/pitch/pitchfcomb.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -34,8 +34,8 @@
 
 */
 
-#ifndef _PITCHFCOMB_H
-#define _PITCHFCOMB_H
+#ifndef _AUBIO_PITCHFCOMB_H
+#define _AUBIO_PITCHFCOMB_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -73,6 +73,4 @@
 }
 #endif
 
-#endif /* _PITCHFCOMB_H */
-
-
+#endif /* _AUBIO_PITCHFCOMB_H */
--- a/src/pitch/pitchmcomb.h
+++ b/src/pitch/pitchmcomb.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -35,8 +35,8 @@
 
 */
 
-#ifndef PITCHMCOMB_H
-#define PITCHMCOMB_H
+#ifndef _AUBIO_PITCHMCOMB_H
+#define _AUBIO_PITCHMCOMB_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -74,4 +74,4 @@
 }
 #endif
 
-#endif /* PITCHMCOMB_H */
+#endif /* _AUBIO_PITCHMCOMB_H */
--- a/src/pitch/pitchschmitt.h
+++ b/src/pitch/pitchschmitt.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -34,8 +34,8 @@
 
 */
 
-#ifndef _PITCHSCHMITT_H
-#define _PITCHSCHMITT_H
+#ifndef _AUBIO_PITCHSCHMITT_H
+#define _AUBIO_PITCHSCHMITT_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -72,5 +72,5 @@
 }
 #endif
 
-#endif /* _PITCHSCHMITT_H */
+#endif /* _AUBIO_PITCHSCHMITT_H */
 
--- a/src/pitch/pitchspecacf.h
+++ b/src/pitch/pitchspecacf.h
@@ -38,8 +38,8 @@
 
 */
 
-#ifndef AUBIO_PITCHSPECACF_H
-#define AUBIO_PITCHSPECACF_H
+#ifndef _AUBIO_PITCHSPECACF_H
+#define _AUBIO_PITCHSPECACF_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -100,4 +100,4 @@
 }
 #endif
 
-#endif /*AUBIO_PITCHSPECACF_H*/
+#endif /* _AUBIO_PITCHSPECACF_H */
--- a/src/pitch/pitchyin.h
+++ b/src/pitch/pitchyin.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -34,8 +34,8 @@
 
 */
 
-#ifndef PITCHYIN_H
-#define PITCHYIN_H
+#ifndef _AUBIO_PITCHYIN_H
+#define _AUBIO_PITCHYIN_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -96,4 +96,4 @@
 }
 #endif
 
-#endif /*PITCHYIN_H*/
+#endif /* _AUBIO_PITCHYIN_H */
--- a/src/pitch/pitchyinfft.h
+++ b/src/pitch/pitchyinfft.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -35,8 +35,8 @@
 
 */
 
-#ifndef PITCHYINFFT_H
-#define PITCHYINFFT_H
+#ifndef _AUBIO_PITCHYINFFT_H
+#define _AUBIO_PITCHYINFFT_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -96,4 +96,4 @@
 }
 #endif
 
-#endif /*PITCHYINFFT_H*/ 
+#endif /* _AUBIO_PITCHYINFFT_H */
--- a/src/spectral/fft.h
+++ b/src/spectral/fft.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -22,12 +22,17 @@
 
   Fast Fourier Transform
 
+  Depending on how aubio was compiled, FFT are computed using one of:
+    - [Ooura](http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html)
+    - [FFTW3](http://www.fftw.org)
+    - [vDSP](https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html)
+
   \example src/spectral/test-fft.c
 
 */
 
-#ifndef FFT_H_
-#define FFT_H_
+#ifndef _AUBIO_FFT_H
+#define _AUBIO_FFT_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -35,10 +40,7 @@
 
 /** FFT object
  
-  This object computes forward and backward FFTs, using the complex type to
-  store the results. The phase vocoder or aubio_mfft_t objects should be
-  preferred to using directly aubio_fft_t. The FFT are computed using FFTW3
-  (although support for another library could be added).
+  This object computes forward and backward FFTs.
 
 */
 typedef struct _aubio_fft_t aubio_fft_t;
@@ -139,4 +141,4 @@
 }
 #endif
 
-#endif // FFT_H_
+#endif /* _AUBIO_FFT_H */
--- a/src/spectral/filterbank.c
+++ b/src/spectral/filterbank.c
@@ -43,7 +43,7 @@
   fb->n_filters = n_filters;
 
   /* allocate filter tables, a matrix of length win_s and of height n_filters */
-  fb->filters = new_fmat (win_s / 2 + 1, n_filters);
+  fb->filters = new_fmat (n_filters, win_s / 2 + 1);
 
   return fb;
 }
--- a/src/spectral/filterbank.h
+++ b/src/spectral/filterbank.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
                       and Amaury Hazan <ahazan@iua.upf.edu>
 
   This file is part of aubio.
@@ -29,8 +29,8 @@
 
 */
 
-#ifndef FILTERBANK_H
-#define FILTERBANK_H
+#ifndef _AUBIO_FILTERBANK_H
+#define _AUBIO_FILTERBANK_H
 
 #ifdef __cplusplus
 extern "C"
@@ -87,4 +87,4 @@
 }
 #endif
 
-#endif                          // FILTERBANK_H
+#endif /* _AUBIO_FILTERBANK_H */
--- a/src/spectral/filterbank_mel.h
+++ b/src/spectral/filterbank_mel.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
                       and Amaury Hazan <ahazan@iua.upf.edu>
 
   This file is part of aubio.
@@ -31,8 +31,8 @@
 
 */
 
-#ifndef FILTERBANK_MEL_H
-#define FILTERBANK_MEL_H
+#ifndef _AUBIO_FILTERBANK_MEL_H
+#define _AUBIO_FILTERBANK_MEL_H
 
 #ifdef __cplusplus
 extern "C"
@@ -69,4 +69,4 @@
 }
 #endif
 
-#endif // FILTERBANK_MEL_H
+#endif /* _AUBIO_FILTERBANK_MEL_H */
--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -66,7 +66,7 @@
   /* allocating buffers */
   mfcc->in_dct = new_fvec (n_filters);
 
-  mfcc->dct_coeffs = new_fmat (n_coefs, n_filters);
+  mfcc->dct_coeffs = new_fmat (n_filters, n_coefs);
 
   /* compute DCT transform dct_coeffs[i][j] as
      cos ( j * (i+.5) * PI / n_filters ) */
--- a/src/spectral/mfcc.h
+++ b/src/spectral/mfcc.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
                       and Amaury Hazan <ahazan@iua.upf.edu>
 
   This file is part of aubio.
@@ -27,8 +27,8 @@
 
 */
 
-#ifndef MFCC_H
-#define MFCC_H
+#ifndef _AUBIO_MFCC_H
+#define _AUBIO_MFCC_H
 
 #ifdef __cplusplus
 extern "C"
@@ -69,4 +69,4 @@
 }
 #endif
 
-#endif                          // MFCC_H
+#endif /* _AUBIO_MFCC_H */
--- a/src/spectral/phasevoc.h
+++ b/src/spectral/phasevoc.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -31,8 +31,8 @@
 
 */
 
-#ifndef _PHASEVOC_H
-#define _PHASEVOC_H
+#ifndef _AUBIO_PHASEVOC_H
+#define _AUBIO_PHASEVOC_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -99,4 +99,4 @@
 }
 #endif 
 
-#endif
+#endif /* _AUBIO_PHASEVOC_H */
--- a/src/spectral/specdesc.h
+++ b/src/spectral/specdesc.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -19,13 +19,13 @@
 */
 
 /** \file
- 
+
   Spectral description functions
- 
+
   All of the following spectral description functions take as arguments the FFT
   of a windowed signal (as created with aubio_pvoc). They output one smpl_t per
   buffer (stored in a vector of size [1]).
- 
+
   \section specdesc Spectral description functions
 
   A list of the spectral description methods currently available follows.
@@ -34,12 +34,12 @@
 
   These functions are designed to raise at notes attacks in music signals.
 
-  \b \p energy : Energy based onset detection function 
- 
+  \b \p energy : Energy based onset detection function
+
   This function calculates the local energy of the input spectral frame.
-  
+
   \b \p hfc : High Frequency Content onset detection function
- 
+
   This method computes the High Frequency Content (HFC) of the input spectral
   frame. The resulting function is efficient at detecting percussive onsets.
 
@@ -46,13 +46,13 @@
   Paul Masri. Computer modeling of Sound for Transformation and Synthesis of
   Musical Signal. PhD dissertation, University of Bristol, UK, 1996.
 
-  \b \p complex : Complex Domain Method onset detection function 
- 
+  \b \p complex : Complex Domain Method onset detection function
+
   Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain
   onset detection for musical signals. In Proceedings of the Digital Audio
   Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.
 
-  \b \p phase : Phase Based Method onset detection function 
+  \b \p phase : Phase Based Method onset detection function
 
   Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset
   detection for music signals. In Proceedings of the IEEE International
@@ -59,29 +59,29 @@
   Conference on Acoustics Speech and Signal Processing, pages 441­444,
   Hong-Kong, 2003.
 
-  \b \p specdiff : Spectral difference method onset detection function 
+  \b \p specdiff : Spectral difference method onset detection function
 
   Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to
   rhythm analysis. In IEEE International Conference on Multimedia and Expo
   (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.
 
-  \b \p kl : Kullback-Liebler onset detection function 
-  
+  \b \p kl : Kullback-Liebler onset detection function
+
   Stephen Hainsworth and Malcom Macleod. Onset detection in music audio
   signals. In Proceedings of the International Computer Music Conference
   (ICMC), Singapore, 2003.
 
-  \b \p mkl : Modified Kullback-Liebler onset detection function 
+  \b \p mkl : Modified Kullback-Liebler onset detection function
 
   Paul Brossier, ``Automatic annotation of musical audio for interactive
   systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital
   music, Queen Mary University of London, London, UK, 2006.
 
-  \b \p specflux : Spectral Flux 
+  \b \p specflux : Spectral Flux
 
   Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th
   International Conference on Digital Audio Effects'' (DAFx-06), Montreal,
-  Canada, 2006. 
+  Canada, 2006.
 
   \subsection shapedesc Spectral shape descriptors
 
@@ -92,14 +92,14 @@
   Project Report 2004 (<a
   href="http://www.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf">pdf</a>)
 
-  \b \p centroid : Spectral centroid 
+  \b \p centroid : Spectral centroid
 
   The spectral centroid represents the barycenter of the spectrum.
 
   \e Note: This function returns the result in bin. To get the spectral
-  centroid in Hz, aubio_bintofreq() should be used. 
+  centroid in Hz, aubio_bintofreq() should be used.
 
-  \b \p spread : Spectral spread 
+  \b \p spread : Spectral spread
 
   The spectral spread is the variance of the spectral distribution around its
   centroid.
@@ -125,7 +125,7 @@
   See also <a href="http://en.wikipedia.org/wiki/Kurtosis">Kurtosis</a> on
   Wikipedia.
 
-  \b \p slope : Spectral slope 
+  \b \p slope : Spectral slope
 
   The spectral slope represents decreasing rate of the spectral amplitude,
   computed using a linear regression.
@@ -132,7 +132,7 @@
 
   \b \p decrease : Spectral decrease
 
-  The spectral decrease is another representation of the decreasing rate,  
+  The spectral decrease is another representation of the decreasing rate,
   based on perceptual criteria.
 
   \b \p rolloff : Spectral roll-off
@@ -145,8 +145,8 @@
 */
 
 
-#ifndef ONSETDETECTION_H
-#define ONSETDETECTION_H
+#ifndef _AUBIO_SPECDESC_H
+#define _AUBIO_SPECDESC_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -155,10 +155,10 @@
 /** spectral description structure */
 typedef struct _aubio_specdesc_t aubio_specdesc_t;
 
-/** execute spectral description function on a spectral frame 
+/** execute spectral description function on a spectral frame
 
   Generic function to compute spectral detescription.
- 
+
   \param o spectral description object as returned by new_aubio_specdesc()
   \param fftgrain input signal spectrum as computed by aubio_pvoc_do
   \param desc output vector (one sample long, to send to the peak picking)
@@ -167,7 +167,7 @@
 void aubio_specdesc_do (aubio_specdesc_t * o, cvec_t * fftgrain,
     fvec_t * desc);
 
-/** creation of a spectral description object 
+/** creation of a spectral description object
 
   \param method spectral description method
   \param buf_size length of the input spectrum frame
@@ -180,7 +180,7 @@
 */
 aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size);
 
-/** deletion of a spectral descriptor 
+/** deletion of a spectral descriptor
 
   \param o spectral descriptor object as returned by new_aubio_specdesc()
 
@@ -191,4 +191,4 @@
 }
 #endif
 
-#endif /* ONSETDETECTION_H */
+#endif /* _AUBIO_SPECDESC_H */
--- a/src/spectral/tss.h
+++ b/src/spectral/tss.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -36,8 +36,8 @@
 
 */
 
-#ifndef TSS_H
-#define TSS_H
+#ifndef _AUBIO_TSS_H
+#define _AUBIO_TSS_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -100,4 +100,4 @@
 }
 #endif
 
-#endif /*TSS_H*/
+#endif /* _AUBIO_TSS_H */
--- a/src/synth/sampler.c
+++ b/src/synth/sampler.c
@@ -42,7 +42,7 @@
   s->samplerate = samplerate;
   s->blocksize = blocksize;
   s->source_output = new_fvec(blocksize);
-  s->source_output_multi = new_fmat(blocksize, 4);
+  s->source_output_multi = new_fmat(4, blocksize);
   s->source = NULL;
   s->playing = 0;
   return s;
--- a/src/synth/sampler.h
+++ b/src/synth/sampler.h
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _AUBIO_SYNTH_SAMPLER_H
-#define _AUBIO_SYNTH_SAMPLER_H
+#ifndef _AUBIO_SAMPLER_H
+#define _AUBIO_SAMPLER_H
 
 /** \file
 
@@ -137,4 +137,4 @@
 }
 #endif
 
-#endif /* _AUBIO_SYNTH_SAMPLER_H */
+#endif /* _AUBIO_SAMPLER_H */
--- a/src/synth/wavetable.c
+++ b/src/synth/wavetable.c
@@ -97,7 +97,7 @@
       aubio_parameter_get_next_value ( s->freq );
       aubio_parameter_get_next_value ( s->amp );
     }
-    fvec_set(output, 0.);
+    fvec_zeros (output);
   }
   // add input to output if needed
   if (input && input != output) {
@@ -130,7 +130,7 @@
       aubio_parameter_get_next_value ( s->freq );
       aubio_parameter_get_next_value ( s->amp );
     }
-    fmat_set(output, 0.);
+    fmat_zeros (output);
   }
   // add output to input if needed
   if (input && input != output) {
--- a/src/synth/wavetable.h
+++ b/src/synth/wavetable.h
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _AUBIO_SYNTH_WAVETABLE_H
-#define _AUBIO_SYNTH_WAVETABLE_H
+#ifndef _AUBIO_WAVETABLE_H
+#define _AUBIO_WAVETABLE_H
 
 /** \file
 
@@ -175,4 +175,4 @@
 }
 #endif
 
-#endif /* _AUBIO_SYNTH_WAVETABLE_H */
+#endif /* _AUBIO_WAVETABLE_H */
--- a/src/tempo/beattracking.h
+++ b/src/tempo/beattracking.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Matthew Davies and Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Matthew Davies and Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -36,8 +36,8 @@
   \example tempo/test-beattracking.c
   
 */
-#ifndef BEATTRACKING_H
-#define BEATTRACKING_H
+#ifndef _AUBIO_BEATTRACKING_H
+#define _AUBIO_BEATTRACKING_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -98,4 +98,4 @@
 }
 #endif
 
-#endif /* BEATTRACKING_H */
+#endif /* _AUBIO_BEATTRACKING_H */
--- a/src/tempo/tempo.h
+++ b/src/tempo/tempo.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -30,8 +30,8 @@
 
 */
 
-#ifndef TEMPO_H
-#define TEMPO_H
+#ifndef _AUBIO_TEMPO_H
+#define _AUBIO_TEMPO_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -133,4 +133,4 @@
 }
 #endif
 
-#endif /* TEMPO_H */
+#endif /* _AUBIO_TEMPO_H */
--- a/src/temporal/a_weighting.h
+++ b/src/temporal/a_weighting.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _ADESIGN_H
-#define _ADESIGN_H
+#ifndef _AUBIO_FILTER_A_DESIGN_H
+#define _AUBIO_FILTER_A_DESIGN_H
 
 /** \file
 
@@ -85,4 +85,4 @@
 }
 #endif
 
-#endif /* _ADESIGN_H */
+#endif /* _AUBIO_FILTER_A_DESIGN_H */
--- a/src/temporal/biquad.h
+++ b/src/temporal/biquad.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef BIQUAD_H
-#define BIQUAD_H
+#ifndef _AUBIO_FILTER_BIQUAD_H
+#define _AUBIO_FILTER_BIQUAD_H
 
 /** \file 
 
@@ -72,4 +72,4 @@
 }
 #endif
 
-#endif /*BIQUAD_H*/
+#endif /* _AUBIO_FILTER_BIQUAD_H */
--- a/src/temporal/c_weighting.h
+++ b/src/temporal/c_weighting.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _CDESIGN_H
-#define _CDESIGN_H
+#ifndef _AUBIO_FILTER_C_DESIGN_H
+#define _AUBIO_FILTER_C_DESIGN_H
 
 /** \file
 
@@ -85,4 +85,4 @@
 }
 #endif
 
-#endif /* _CDESIGN_H */
+#endif /* _AUBIO_FILTER_C_DESIGN_H */
--- a/src/temporal/filter.h
+++ b/src/temporal/filter.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef FILTER_H
-#define FILTER_H
+#ifndef _AUBIO_FILTER_H
+#define _AUBIO_FILTER_H
 
 /** \file 
 
@@ -173,4 +173,4 @@
 }
 #endif
 
-#endif /*FILTER_H*/
+#endif /* _AUBIO_FILTER_H */
--- a/src/temporal/resampler.h
+++ b/src/temporal/resampler.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef _RESAMPLE_H
-#define _RESAMPLE_H
+#ifndef _AUBIO_RESAMPLER_H
+#define _AUBIO_RESAMPLER_H
 
 /** \file
  
@@ -62,4 +62,4 @@
 }
 #endif
 
-#endif /* _RESAMPLE_H */
+#endif /* _AUBIO_RESAMPLER_H */
--- a/src/types.h
+++ b/src/types.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -18,8 +18,8 @@
 
 */
 
-#ifndef AUBIO_TYPES_H
-#define AUBIO_TYPES_H
+#ifndef _AUBIO__TYPES_H
+#define _AUBIO__TYPES_H
 
 /** \file
  
@@ -67,4 +67,4 @@
 }
 #endif
 
-#endif/*AUBIO_TYPES_H*/
+#endif /* _AUBIO__TYPES_H */
--- a/src/utils/hist.h
+++ b/src/utils/hist.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -25,8 +25,8 @@
  * Big hacks to implement an histogram
  */
 
-#ifndef HIST_H
-#define HIST_H
+#ifndef _AUBIO_HIST_H
+#define _AUBIO_HIST_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -60,4 +60,4 @@
 }
 #endif
 
-#endif
+#endif /* _AUBIO_HIST_H */
--- a/src/utils/parameter.h
+++ b/src/utils/parameter.h
@@ -157,4 +157,3 @@
 #endif
 
 #endif /* _AUBIO_PARAMETER_H */
-
--- a/src/utils/scale.h
+++ b/src/utils/scale.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -28,8 +28,8 @@
  \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ 
  
 */
-#ifndef SCALE_H
-#define SCALE_H
+#ifndef _AUBIO_SCALE_H
+#define _AUBIO_SCALE_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -77,4 +77,4 @@
 }
 #endif 
 
-#endif
+#endif /* _AUBIO_SCALE_H */
--- a/src/vecutils.c
+++ b/src/vecutils.c
@@ -14,22 +14,20 @@
   } \
 }
 
-#define AUBIO_OP_C_AND_F(OPNAME, OP) \
-  AUBIO_OP(OPNAME, OP, fvec, data) \
-  AUBIO_OP(OPNAME, OP, cvec, norm)
+#define AUBIO_OP_C(OPNAME, OP) \
+  AUBIO_OP(OPNAME, OP, fvec, data)
 
-AUBIO_OP_C_AND_F(exp, EXP)
-AUBIO_OP_C_AND_F(cos, COS)
-AUBIO_OP_C_AND_F(sin, SIN)
-AUBIO_OP_C_AND_F(abs, ABS)
-AUBIO_OP_C_AND_F(sqrt, SQRT)
-AUBIO_OP_C_AND_F(log10, SAFE_LOG10)
-AUBIO_OP_C_AND_F(log, SAFE_LOG)
-AUBIO_OP_C_AND_F(floor, FLOOR)
-AUBIO_OP_C_AND_F(ceil, CEIL)
-AUBIO_OP_C_AND_F(round, ROUND)
+AUBIO_OP_C(exp, EXP)
+AUBIO_OP_C(cos, COS)
+AUBIO_OP_C(sin, SIN)
+AUBIO_OP_C(abs, ABS)
+AUBIO_OP_C(sqrt, SQRT)
+AUBIO_OP_C(log10, SAFE_LOG10)
+AUBIO_OP_C(log, SAFE_LOG)
+AUBIO_OP_C(floor, FLOOR)
+AUBIO_OP_C(ceil, CEIL)
+AUBIO_OP_C(round, ROUND)
 
-//AUBIO_OP_C_AND_F(pow, POW)
 void fvec_pow (fvec_t *s, smpl_t power)
 {
   uint_t j;
@@ -37,12 +35,3 @@
     s->data[j] = POW(s->data[j], power);
   }
 }
-
-void cvec_pow (cvec_t *s, smpl_t power)
-{
-  uint_t j;
-  for (j = 0; j < s->length; j++) {
-    s->norm[j] = POW(s->norm[j], power);
-  }
-}
-
--- a/src/vecutils.h
+++ b/src/vecutils.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2009 Paul Brossier <piem@aubio.org>
+  Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
 
   This file is part of aubio.
 
@@ -20,12 +20,12 @@
 
 /** \file
 
-  Utility functions for ::fvec_t and ::cvec_t objects
+  Utility functions for ::fvec_t
 
  */
 
-#ifndef _VECUTILS_H
-#define _VECUTILS_H
+#ifndef _AUBIO__VECUTILS_H
+#define _AUBIO__VECUTILS_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -109,86 +109,8 @@
 */
 void fvec_pow (fvec_t *s, smpl_t pow);
 
-/** compute \f$e^x\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_exp (cvec_t *s);
-
-/** compute \f$cos(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_cos (cvec_t *s);
-
-/** compute \f$sin(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_sin (cvec_t *s);
-
-/** compute the \f$abs(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_abs (cvec_t *s);
-
-/** compute the \f$sqrt(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_sqrt (cvec_t *s);
-
-/** compute the \f$log10(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_log10 (cvec_t *s);
-
-/** compute the \f$log(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_log (cvec_t *s);
-
-/** compute the \f$floor(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_floor (cvec_t *s);
-
-/** compute the \f$ceil(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_ceil (cvec_t *s);
-
-/** compute the \f$round(x)\f$ of each vector norm elements
-
-  \param s vector to modify
-
-*/
-void cvec_round (cvec_t *s);
-
-/** raise each vector norm elements to the power pow
-
-  \param s vector to modify
-  \param pow power to raise to
-
-*/
-void cvec_pow (cvec_t *s, smpl_t pow);
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif /*_VECUTILS_H*/
+#endif /* _AUBIO__VECUTILS_H */
--- a/src/wscript_build
+++ b/src/wscript_build
@@ -9,7 +9,6 @@
 uselib += ['AVFORMAT']
 uselib += ['AVRESAMPLE']
 uselib += ['AVUTIL']
-uselib += ['JACK']
 
 ctx(features = 'c',
       source = source,
@@ -21,6 +20,8 @@
 # build libaubio.so (cshlib) and/or libaubio.a (cstlib)
 if ctx.env['DEST_OS'] in ['ios', 'iosimulator']:
     build_features = ['cstlib']
+elif ctx.env['DEST_OS'] in ['win32', 'win64']:
+    build_features = ['cshlib']
 else: #linux, darwin, android, mingw, ...
     build_features = ['cshlib', 'cstlib']
 
@@ -27,6 +28,7 @@
 for target in build_features:
   ctx(features = 'c ' + target,
       use = ['lib_objects'], #source = source,
+      lib = 'm',
       target = 'aubio',
       install_path = '${PREFIX}/lib',
       vnum = ctx.env['LIB_VERSION'])
--- a/tests/src/io/test-source_multi.c
+++ b/tests/src/io/test-source_multi.c
@@ -38,7 +38,7 @@
 
   if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s);
 
-  fmat_t *mat = new_fmat(hop_size, n_channels);
+  fmat_t *mat = new_fmat(n_channels, hop_size);
 
   do {
     aubio_source_do_multi (s, mat, &read);
--- a/tests/src/spectral/test-mfcc.c
+++ b/tests/src/spectral/test-mfcc.c
@@ -12,11 +12,11 @@
   // create mfcc object
   aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
 
-  cvec_set_all_norm (in, 1.);
+  cvec_norm_set_all (in, 1.);
   aubio_mfcc_do (o, in, out);
   fvec_print (out);
 
-  cvec_set_all_norm (in, .5);
+  cvec_norm_set_all (in, .5);
   aubio_mfcc_do (o, in, out);
   fvec_print (out);
 
--- a/tests/src/spectral/test-phasevoc-jack.c
+++ /dev/null
@@ -1,101 +1,0 @@
-/** Test for phase vocoder in jack
- *
- * This program should start correctly, when jackd is started or when
- * using JACK_START_SERVER=true and reconstruct each audio input channel
- * on the corresponding output channel with some strange effects and a
- * delay equal to the hop size (hop_s).
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>  /* sleep() */
-#include <aubio.h>
-#ifdef HAVE_JACK
-#include "jackio.h"
-#endif /* HAVE_JACK */
-
-uint_t testing  = 0;  // change this to 1 to listen
-
-uint_t win_s    = 512; // window size
-uint_t hop_s    = 128; // hop size
-uint_t channels = 2; // number of audio channels
-uint_t midiin   = 4; // number of midi input channels
-uint_t midiout  = 2; // number of midi output channels
-uint_t pos      = 0; // frames%dspblocksize for jack loop
-
-fvec_t * in[2];
-cvec_t * fftgrain[2];
-fvec_t * out[2];
-
-aubio_pvoc_t * pv[2];
-
-int aubio_process(float **input, float **output, int nframes);
-
-int main ()
-{
-  /* allocate some memory */
-  uint_t i;
-  for (i=0;i<channels;i++) {
-    in[i]       = new_fvec (hop_s); /* input buffer       */
-    fftgrain[i] = new_cvec (win_s); /* fft norm and phase */
-    out[i]      = new_fvec (hop_s); /* output buffer      */
-    /* allocate fft and other memory space */
-    pv[i] = new_aubio_pvoc(win_s,hop_s);
-  }
-
-#ifdef HAVE_JACK
-  aubio_jack_t * jack_setup;
-  jack_setup  = new_aubio_jack(channels, channels, 
-      midiin, midiout,
-      (aubio_process_func_t)aubio_process);
-  aubio_jack_activate(jack_setup);
-  /* stay in main jack loop for 1 seconds only */
-  do {
-    sleep(1);
-  } while(testing);
-  aubio_jack_close(jack_setup);
-#else
-  fprintf(stderr, "WARNING: no jack support\n");
-#endif
-
-  for (i=0;i<channels;i++) {
-    del_aubio_pvoc(pv[i]);
-    del_cvec(fftgrain[i]);
-    del_fvec(in[i]);
-    del_fvec(out[i]);
-  }
-  aubio_cleanup();
-  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[i], input[i][j], pos);
-      /* put synthnew in output */
-      output[i][j] = fvec_read_sample(out[i], pos);
-    }
-    /*time for fft*/
-    if (pos == hop_s-1) {
-      /* block loop */
-      for (i=0;i<channels;i++) {
-        aubio_pvoc_do (pv[i], in[i], fftgrain[i]);
-        // zero phases of first channel
-        for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.; 
-        // double phases of second channel
-        for (i=0;i<fftgrain[i]->length;i++) {
-          fftgrain[1]->phas[i] = 
-            aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.); 
-        }
-        // copy second channel to third one
-        aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]);
-        pos = -1;
-      }
-    }
-    pos++;
-  }
-  return 0;
-}
--- a/tests/src/spectral/test-phasevoc.c
+++ b/tests/src/spectral/test-phasevoc.c
@@ -14,7 +14,7 @@
   aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
 
   // fill input with some data
-  fvec_set (in, 1.);
+  fvec_set_all (in, 1.);
   fvec_print (in);
 
   while ( n-- ) {
--- a/tests/src/test-cvec.c
+++ b/tests/src/test-cvec.c
@@ -19,7 +19,7 @@
   }
 
   // set all vector elements to `0`
-  cvec_zeros_norm(complex_vector);
+  cvec_norm_zeros(complex_vector);
   for ( i = 0; i < complex_vector->length; i++ ) {
     assert( complex_vector->norm[i] == 0. );
     // assert( complex_vector->phas[i] == 0 );
@@ -27,7 +27,7 @@
   cvec_print(complex_vector);
 
   // set all vector elements to `1`
-  cvec_ones_norm(complex_vector);
+  cvec_norm_ones(complex_vector);
   for ( i = 0; i < complex_vector->length; i++ ) {
     assert( complex_vector->norm[i] == 1. );
     // assert( complex_vector->phas[i] == 0 );
@@ -35,10 +35,10 @@
   cvec_print(complex_vector);
 
   cvec_zeros(complex_vector);
-  cvec_zeros_phas(complex_vector);
-  cvec_zeros_norm(complex_vector);
-  cvec_ones_norm(complex_vector);
-  cvec_ones_phas(complex_vector);
+  cvec_phas_zeros(complex_vector);
+  cvec_norm_zeros(complex_vector);
+  cvec_norm_ones(complex_vector);
+  cvec_phas_ones(complex_vector);
   cvec_copy(complex_vector, complex_vector);
 
   // destroy it
--- a/tests/src/test-fmat.c
+++ b/tests/src/test-fmat.c
@@ -8,7 +8,7 @@
 {
   uint_t height = 3, length = 9, i, j;
   // create fmat_t object
-  fmat_t * mat = new_fmat (length, height);
+  fmat_t * mat = new_fmat (height, length);
   for ( i = 0; i < mat->height; i++ ) {
     for ( j = 0; j < mat->length; j++ ) {
       // all elements are already initialized to 0.
--- a/tests/utils_tests.h
+++ b/tests/utils_tests.h
@@ -3,11 +3,28 @@
 #include <stdio.h>
 #include <math.h>
 #include <assert.h>
+#include "config.h"
 
 #define PRINT_ERR(format, args...)   fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args)
 #define PRINT_MSG(format, args...)   fprintf(stdout, format , ##args)
 #define PRINT_DBG(format, args...)   fprintf(stderr, format , ##args)
 #define PRINT_WRN(format, args...)   fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args)
+
+#ifdef HAVE_WIN_HACKS
+// http://en.wikipedia.org/wiki/Linear_congruential_generator
+// no srandom/random on win32
+
+uint_t srandom_seed = 1029;
+
+void srandom(uint_t new_seed) {
+    srandom_seed = new_seed;
+}
+
+uint_t random(void) {
+    srandom_seed = 1664525 * srandom_seed + 1013904223;
+    return srandom_seed;
+}
+#endif
 
 void utils_init_random () {
   time_t now = time(0);
--- a/tests/wscript_build
+++ b/tests/wscript_build
@@ -4,10 +4,6 @@
   uselib = []
   includes = ['../src', '.']
   extra_source = []
-  if str(target_name).endswith('-jack.c') and ctx.env['JACK']:
-    uselib += ['JACK']
-    includes += ['../examples']
-    extra_source += ['../examples/jackio.c']
 
   bld(features = 'c cprogram test',
       lib = 'm',
--- a/wscript
+++ b/wscript
@@ -84,15 +84,19 @@
     ctx.load('compiler_c')
     ctx.load('waf_unit_test')
     ctx.load('gnu_dirs')
-    ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC']
 
+    ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
+
     target_platform = Options.platform
     if ctx.options.target_platform:
         target_platform = ctx.options.target_platform
     ctx.env['DEST_OS'] = target_platform
 
-    if target_platform == 'win32':
-        ctx.env['shlib_PATTERN'] = 'lib%s.dll'
+    if target_platform not in ['win32', 'win64']:
+        ctx.env.CFLAGS += ['-fPIC']
+    else:
+        ctx.define('HAVE_WIN_HACKS', 1)
+        ctx.env['cshlib_PATTERN'] = 'lib%s.dll'
 
     if target_platform == 'darwin':
         ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
@@ -200,7 +204,7 @@
 
     # check for jack
     if (ctx.options.enable_jack != False):
-        ctx.check_cfg(package = 'jack', atleast_version = '0.15.0',
+        ctx.check_cfg(package = 'jack',
                 args = '--cflags --libs', mandatory = False)
 
     # check for libav
@@ -213,6 +217,12 @@
                 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
         ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
                 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
+        if all ( 'HAVE_' + i in ctx.env.define_key
+                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
+            ctx.define('HAVE_LIBAV', 1)
+            ctx.msg('Checking for all libav libraries', 'yes')
+        else:
+            ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
 
     # use memcpy hacks
     if (ctx.options.enable_memcpy == True):
@@ -233,6 +243,12 @@
     except ctx.errors.ConfigurationError:
       ctx.to_log('txt2man was not found (ignoring)')
 
+    # check if doxygen is installed, optional
+    try:
+      ctx.find_program('doxygen', var='DOXYGEN')
+    except ctx.errors.ConfigurationError:
+      ctx.to_log('doxygen was not found (ignoring)')
+
 def build(bld):
     bld.env['VERSION'] = VERSION
     bld.env['LIB_VERSION'] = LIB_VERSION
@@ -247,7 +263,7 @@
 
     bld( source = 'aubio.pc.in' )
 
-    # build manpages from sgml files
+    # build manpages from txt files using txt2man
     if bld.env['TXT2MAN']:
         from waflib import TaskGen
         if 'MANDIR' not in bld.env:
@@ -266,11 +282,16 @@
                 )
         bld( source = bld.path.ant_glob('doc/*.txt') )
 
-    """
-    bld(rule = 'doxygen ${SRC}', source = 'web.cfg') #, target = 'doc/web/index.html')
-    """
+    # build documentation from source files using doxygen
+    if bld.env['DOXYGEN']:
+        bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
+                source = 'doc/web.cfg',
+                cwd = 'doc')
+        bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc',
+                bld.path.ant_glob('doc/web/html/**'),
+                cwd = bld.path.find_dir ('doc/web'),
+                relative_trick = True)
 
-
 def shutdown(bld):
     from waflib import Logs
     if bld.options.target_platform in ['ios', 'iosimulator']:
@@ -287,3 +308,4 @@
     ctx.excl += ' **/doc/full/* **/doc/web/*'
     ctx.excl += ' **/python/*.db'
     ctx.excl += ' **/python.old/*'
+    ctx.excl += ' **/python/tests/sounds'
--