tests/: move file around to match src/
authorPaul Brossier <piem@piem.org>
Tue, 10 Jul 2012 22:26:12 +0000 (15:26 -0700)
committerPaul Brossier <piem@piem.org>
Tue, 10 Jul 2012 22:26:12 +0000 (15:26 -0700)
50 files changed:
tests/python/src/onset/peakpick.py [deleted file]
tests/python/src/onset/peakpicker.py [new file with mode: 0644]
tests/src/Makefile.am
tests/src/onset/test-onset.c [new file with mode: 0644]
tests/src/onset/test-peakpicker.c [new file with mode: 0644]
tests/src/pitch/test-pitch.c [new file with mode: 0644]
tests/src/pitch/test-pitchfcomb.c [new file with mode: 0644]
tests/src/pitch/test-pitchmcomb.c [new file with mode: 0644]
tests/src/pitch/test-pitchschmitt.c [new file with mode: 0644]
tests/src/pitch/test-pitchyin.c [new file with mode: 0644]
tests/src/pitch/test-pitchyinfft.c [new file with mode: 0644]
tests/src/spectral/test-filterbank.c [new file with mode: 0644]
tests/src/spectral/test-filterbank_mel.c [new file with mode: 0644]
tests/src/spectral/test-mfcc.c [new file with mode: 0644]
tests/src/spectral/test-phasevoc-jack.c [new file with mode: 0644]
tests/src/spectral/test-phasevoc.c [new file with mode: 0644]
tests/src/spectral/test-specdesc.c [new file with mode: 0644]
tests/src/spectral/test-tss.c [new file with mode: 0644]
tests/src/temporal/test-a_weighting.c [new file with mode: 0644]
tests/src/temporal/test-aweighting.c [deleted file]
tests/src/temporal/test-biquad.c [new file with mode: 0644]
tests/src/temporal/test-c_weighting.c [new file with mode: 0644]
tests/src/temporal/test-cweighting.c [deleted file]
tests/src/temporal/test-filter.c [new file with mode: 0644]
tests/src/temporal/test-resampler.c [new file with mode: 0644]
tests/src/test-biquad.c [deleted file]
tests/src/test-filter.c [deleted file]
tests/src/test-filterbank.c [deleted file]
tests/src/test-filterbank_mel.c [deleted file]
tests/src/test-hist.c [deleted file]
tests/src/test-mathutils-window.c [new file with mode: 0644]
tests/src/test-mfcc.c [deleted file]
tests/src/test-onset.c [deleted file]
tests/src/test-onsetdetection.c [deleted file]
tests/src/test-peakpick.c [deleted file]
tests/src/test-phasevoc-jack.c [deleted file]
tests/src/test-phasevoc.c [deleted file]
tests/src/test-pitch.c [deleted file]
tests/src/test-pitchdetection.c [deleted file]
tests/src/test-pitchfcomb.c [deleted file]
tests/src/test-pitchmcomb.c [deleted file]
tests/src/test-pitchschmitt.c [deleted file]
tests/src/test-pitchyin.c [deleted file]
tests/src/test-pitchyinfft.c [deleted file]
tests/src/test-resample.c [deleted file]
tests/src/test-scale.c [deleted file]
tests/src/test-tss.c [deleted file]
tests/src/test-window.c [deleted file]
tests/src/utils/test-hist.c [new file with mode: 0644]
tests/src/utils/test-scale.c [new file with mode: 0644]

diff --git a/tests/python/src/onset/peakpick.py b/tests/python/src/onset/peakpick.py
deleted file mode 100644 (file)
index b3d54a8..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-from template import aubio_unit_template
-from localaubio import *
-
-buf_size = 7 
-channels = 1
-
-class peakpick_unit(aubio_unit_template):
-
-  def setUp(self):
-    self.o = new_aubio_peakpicker(1)
-    aubio_peakpicker_set_threshold (0.1)
-    pass
-
-  def tearDown(self):
-    del_aubio_peakpicker(self.o)
-    pass
-
-  def test_peakpick(self):
-    """ create and delete peakpick """
-    pass
-
-  def test_peakpick_zeroes(self):
-    """ check peakpick run on a vector full of zero returns no peak. """
-    self.assertEqual(0., aubio_peakpicker_get_thresholded_input(self.o))
-
-  def test_peakpick_impulse(self):
-    """ check peakpick detects a single impulse as a peak. """
-    """ check two consecutive peaks are detected as one. """
-    #print 
-    for index in range(0,buf_size-1):
-      input = new_fvec(buf_size, channels)
-      fvec_write_sample(input, 1000., 0, index)
-      fvec_write_sample(input, 1000./2, 0, index+1)
-      #print "%2s" % index, aubio_peakpicker_do(self.o, input), "|",
-      #for i in range(buf_size): print fvec_read_sample(input, 0, i),
-      #print
-      del_fvec(input)
-
-  def test_peakpick_consecutive_peaks(self):
-    """ check two consecutive peaks are detected as one. """
-    #print 
-    for index in range(0,buf_size-4):
-      input = new_fvec(buf_size, channels)
-      fvec_write_sample(input, 1000./2, 0, index)
-      fvec_write_sample(input, 1000., 0, index+1)
-      fvec_write_sample(input, 1000., 0, index+3)
-      fvec_write_sample(input, 1000./2, 0, index+4)
-      peak_pick_result = aubio_peakpicker_do(self.o, input)
-      if index == 2:
-        # we are at the peak. check the result is after current sample,
-        # and not after next one
-        self.failIf( 1. >= peak_pick_result )
-        self.failIf( 2. < peak_pick_result )
-      else: self.assertEqual(0., peak_pick_result)
-      del_fvec(input)
-    for index in range(buf_size-4,buf_size-1):
-      input = new_fvec(buf_size, channels)
-      fvec_write_sample(input, 1000./2, 0, index)
-      fvec_write_sample(input, 1000., 0, index+1)
-      peak_pick_result = aubio_peakpicker_do(self.o, input)
-      self.assertEqual(0., peak_pick_result)
-      del_fvec(input)
-
-  def test_peakpick_set_threshold(self):
-    """ test aubio_peakpicker_set_threshold """
-    new_threshold = 0.1
-    aubio_peakpicker_set_threshold(self.o, new_threshold)
-    self.assertCloseEnough(new_threshold, aubio_peakpicker_get_threshold(self.o))
-
-  def test_peakpick_get_threshold(self):
-    """ test aubio_peakpicker_get_threshold """
-    new_threshold = aubio_peakpicker_get_threshold(self.o) 
-    aubio_peakpicker_set_threshold(self.o, new_threshold)
-    self.assertCloseEnough(new_threshold, aubio_peakpicker_get_threshold(self.o))
-
-if __name__ == '__main__':
-  unittest.main()
diff --git a/tests/python/src/onset/peakpicker.py b/tests/python/src/onset/peakpicker.py
new file mode 100644 (file)
index 0000000..b3d54a8
--- /dev/null
@@ -0,0 +1,77 @@
+from template import aubio_unit_template
+from localaubio import *
+
+buf_size = 7 
+channels = 1
+
+class peakpick_unit(aubio_unit_template):
+
+  def setUp(self):
+    self.o = new_aubio_peakpicker(1)
+    aubio_peakpicker_set_threshold (0.1)
+    pass
+
+  def tearDown(self):
+    del_aubio_peakpicker(self.o)
+    pass
+
+  def test_peakpick(self):
+    """ create and delete peakpick """
+    pass
+
+  def test_peakpick_zeroes(self):
+    """ check peakpick run on a vector full of zero returns no peak. """
+    self.assertEqual(0., aubio_peakpicker_get_thresholded_input(self.o))
+
+  def test_peakpick_impulse(self):
+    """ check peakpick detects a single impulse as a peak. """
+    """ check two consecutive peaks are detected as one. """
+    #print 
+    for index in range(0,buf_size-1):
+      input = new_fvec(buf_size, channels)
+      fvec_write_sample(input, 1000., 0, index)
+      fvec_write_sample(input, 1000./2, 0, index+1)
+      #print "%2s" % index, aubio_peakpicker_do(self.o, input), "|",
+      #for i in range(buf_size): print fvec_read_sample(input, 0, i),
+      #print
+      del_fvec(input)
+
+  def test_peakpick_consecutive_peaks(self):
+    """ check two consecutive peaks are detected as one. """
+    #print 
+    for index in range(0,buf_size-4):
+      input = new_fvec(buf_size, channels)
+      fvec_write_sample(input, 1000./2, 0, index)
+      fvec_write_sample(input, 1000., 0, index+1)
+      fvec_write_sample(input, 1000., 0, index+3)
+      fvec_write_sample(input, 1000./2, 0, index+4)
+      peak_pick_result = aubio_peakpicker_do(self.o, input)
+      if index == 2:
+        # we are at the peak. check the result is after current sample,
+        # and not after next one
+        self.failIf( 1. >= peak_pick_result )
+        self.failIf( 2. < peak_pick_result )
+      else: self.assertEqual(0., peak_pick_result)
+      del_fvec(input)
+    for index in range(buf_size-4,buf_size-1):
+      input = new_fvec(buf_size, channels)
+      fvec_write_sample(input, 1000./2, 0, index)
+      fvec_write_sample(input, 1000., 0, index+1)
+      peak_pick_result = aubio_peakpicker_do(self.o, input)
+      self.assertEqual(0., peak_pick_result)
+      del_fvec(input)
+
+  def test_peakpick_set_threshold(self):
+    """ test aubio_peakpicker_set_threshold """
+    new_threshold = 0.1
+    aubio_peakpicker_set_threshold(self.o, new_threshold)
+    self.assertCloseEnough(new_threshold, aubio_peakpicker_get_threshold(self.o))
+
+  def test_peakpick_get_threshold(self):
+    """ test aubio_peakpicker_get_threshold """
+    new_threshold = aubio_peakpicker_get_threshold(self.o) 
+    aubio_peakpicker_set_threshold(self.o, new_threshold)
+    self.assertCloseEnough(new_threshold, aubio_peakpicker_get_threshold(self.o))
+
+if __name__ == '__main__':
+  unittest.main()
index ad98446..9c143af 100644 (file)
@@ -1,37 +1,42 @@
 AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/examples
 AM_LDFLAGS = -L$(top_builddir)/src -laubio @FFTWLIB_LIBS@
 
-test_phasevoc_jack_CFLAGS = $(AM_CFLAGS) @JACK_CFLAGS@
-test_phasevoc_jack_LDADD  = $(AM_LDFLAGS) @JACK_LIBS@ 
+spectral_test_phasevoc_jack_CFLAGS = $(AM_CFLAGS) @JACK_CFLAGS@
+spectral_test_phasevoc_jack_LDADD  = $(AM_LDFLAGS) @JACK_LIBS@ 
 
-bin_PROGRAMS = \
-       test-hist \
-       test-scale \
-       test-cvec \
-       test-fvec \
-       test-window \
-       test-filter \
-       test-biquad \
-       test-resample \
-       test-peakpick \
-       test-phasevoc \
-       test-filterbank \
-       test-filterbank_mel \
-       test-mfcc \
-       test-phasevoc-jack \
-       test-onsetdetection \
-       test-pitchyin \
-       test-pitchyinfft \
-       test-pitchschmitt \
-       test-pitchfcomb \
-       test-pitchmcomb \
-       test-pitch \
-       test-onset \
-       test-mathutils \
-       test-tss
+noinst_PROGRAMS = \
+  test-fvec \
+  test-cvec \
+  test-mathutils \
+  test-mathutils-window \
+  pitch/test-pitchyin \
+  pitch/test-pitchyinfft \
+  pitch/test-pitch \
+  pitch/test-pitchmcomb \
+  pitch/test-pitchfcomb \
+  pitch/test-pitchschmitt \
+  temporal/test-cweighting \
+  temporal/test-resampler \
+  temporal/test-filter \
+  temporal/test-biquad \
+  temporal/test-aweighting \
+  onset/test-peakpicker \
+  onset/test-onset \
+  tempo/test-tempo \
+  tempo/test-beattracking \
+  spectral/test-fft \
+  spectral/test-specdesc \
+  spectral/test-phasevoc \
+  spectral/test-phasevoc-jack \
+  spectral/test-tss \
+  spectral/test-filterbank \
+  spectral/test-filterbank_mel \
+  spectral/test-mfcc \
+  utils/test-scale \
+  utils/test-hist
 
-run-tests: $(bin_PROGRAMS)
-       @for i in $(bin_PROGRAMS); do echo -n $$i\ ; ./$$i > /dev/null && echo OK || echo FAILED: $$?; done
+run-tests: $(noinst_PROGRAMS)
+       @for i in $(noinst_PROGRAMS); do echo -n $$i\ ; ./$$i > /dev/null && echo OK || echo FAILED: $$?; 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
+run-valgrind-tests: $(noinst_PROGRAMS)
+       @for i in $(noinst_PROGRAMS); do echo $$i; valgrind .libs/lt-$$i 2>&1 | grep ERROR\ SUMMARY -A4; echo $$?; done
diff --git a/tests/src/onset/test-onset.c b/tests/src/onset/test-onset.c
new file mode 100644 (file)
index 0000000..fd2ab2e
--- /dev/null
@@ -0,0 +1,22 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s/4); /* input buffer */
+        fvec_t * out      = new_fvec (2);     /* input buffer */
+        aubio_onset_t * onset  = new_aubio_onset("complex", win_s, win_s/4, 44100.);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_onset_do (onset,in,out);
+          i++;
+        };
+
+        del_aubio_onset(onset);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
diff --git a/tests/src/onset/test-peakpicker.c b/tests/src/onset/test-peakpicker.c
new file mode 100644 (file)
index 0000000..1ce6bb4
--- /dev/null
@@ -0,0 +1,22 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (1); /* input buffer */
+        aubio_peakpicker_t * o = new_aubio_peakpicker();
+        aubio_peakpicker_set_threshold (o, 0.3);
+
+        aubio_peakpicker_do(o, in, out);
+        aubio_peakpicker_do(o, in, out);
+        aubio_peakpicker_do(o, in, out);
+        aubio_peakpicker_do(o, in, out);
+
+        del_aubio_peakpicker(o);
+        del_fvec(in);
+        return 0;
+}
+
diff --git a/tests/src/pitch/test-pitch.c b/tests/src/pitch/test-pitch.c
new file mode 100644 (file)
index 0000000..ac884c6
--- /dev/null
@@ -0,0 +1,26 @@
+#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 */
+  fvec_t *in = new_fvec (hop_s);      /* input buffer */
+  fvec_t *out = new_fvec (1); /* input buffer */
+  aubio_pitch_t *o =
+      new_aubio_pitch ("default", win_s, hop_s, samplerate);
+  uint_t i = 0;
+
+  while (i < 100) {
+    aubio_pitch_do (o, in, out);
+    i++;
+  };
+
+  del_aubio_pitch (o);
+  del_fvec (in);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/pitch/test-pitchfcomb.c b/tests/src/pitch/test-pitchfcomb.c
new file mode 100644 (file)
index 0000000..dda6099
--- /dev/null
@@ -0,0 +1,25 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t hop_s      = win_s/4;                    /* hop size */
+        fvec_t * in       = new_fvec (hop_s); /* input buffer */
+        fvec_t * out      = new_fvec (1);
+        aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb (
+          win_s, hop_s);
+        uint_t i = 0;
+
+        while (i < 2) {
+          aubio_pitchfcomb_do (o,in, out);
+          i++;
+        };
+
+        del_aubio_pitchfcomb(o);
+        del_fvec(in);
+        aubio_cleanup();
+
+        return 0;
+}
diff --git a/tests/src/pitch/test-pitchmcomb.c b/tests/src/pitch/test-pitchmcomb.c
new file mode 100644 (file)
index 0000000..7d3cb16
--- /dev/null
@@ -0,0 +1,26 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        uint_t hop_s      = win_s/4;                    /* hop size */
+        cvec_t * in       = new_cvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (1); /* input buffer */
+
+        aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(win_s, hop_s);
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchmcomb_do (o,in, out);
+          i++;
+        };
+
+        del_aubio_pitchmcomb(o);
+        del_cvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
diff --git a/tests/src/pitch/test-pitchschmitt.c b/tests/src/pitch/test-pitchschmitt.c
new file mode 100644 (file)
index 0000000..745feca
--- /dev/null
@@ -0,0 +1,25 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out = new_fvec (1); /* input buffer */
+        aubio_pitchschmitt_t * o  = new_aubio_pitchschmitt(win_s);
+        uint_t i = 0;
+
+        while (i < 1000) {
+          aubio_pitchschmitt_do (o,in, out);
+          i++;
+        };
+
+        del_aubio_pitchschmitt(o);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+
diff --git a/tests/src/pitch/test-pitchyin.c b/tests/src/pitch/test-pitchyin.c
new file mode 100644 (file)
index 0000000..5d35950
--- /dev/null
@@ -0,0 +1,24 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (win_s/2); /* input buffer */
+        aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_pitchyin_do (p, in,out);
+          i++;
+        };
+
+        del_fvec(in);
+        del_fvec(out);
+        del_aubio_pitchyin(p);
+        aubio_cleanup();
+
+        return 0;
+}
diff --git a/tests/src/pitch/test-pitchyinfft.c b/tests/src/pitch/test-pitchyinfft.c
new file mode 100644 (file)
index 0000000..32e144d
--- /dev/null
@@ -0,0 +1,26 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        fvec_t * out      = new_fvec (1); /* output pitch periods */
+        aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
+        aubio_pitchyinfft_set_tolerance (o, 0.2);
+        uint_t i = 0;
+
+        while (i < 10) {
+          aubio_pitchyinfft_do (o,in,out);
+          i++;
+        };
+
+        del_aubio_pitchyinfft(o);
+        del_fvec(in);
+        del_fvec(out);
+        aubio_cleanup();
+
+        return 0;
+}
+
diff --git a/tests/src/spectral/test-filterbank.c b/tests/src/spectral/test-filterbank.c
new file mode 100644 (file)
index 0000000..4ab3fcf
--- /dev/null
@@ -0,0 +1,44 @@
+#define AUBIO_UNSTABLE 1
+
+#include <stdio.h>
+#include <aubio.h>
+
+int
+main (void)
+{
+  /* allocate some memory */
+  uint_t win_s = 1024;          /* window size */
+  uint_t n_filters = 13;        /* number of filters */
+  cvec_t *in = new_cvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec (win_s);     /* input buffer */
+  fmat_t *coeffs = NULL;
+
+  /* allocate fft and other memory space */
+  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
+
+  coeffs = aubio_filterbank_get_coeffs (o);
+  if (coeffs == NULL) {
+    return -1;
+  }
+
+  /*
+  if (fvec_max (coeffs) != 0.) {
+    return -1;
+  }
+
+  if (fvec_min (coeffs) != 0.) {
+    return -1;
+  }
+  */
+
+  fmat_print (coeffs);
+
+  aubio_filterbank_do (o, in, out);
+
+  del_aubio_filterbank (o);
+  del_cvec (in);
+  del_fvec (out);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/spectral/test-filterbank_mel.c b/tests/src/spectral/test-filterbank_mel.c
new file mode 100644 (file)
index 0000000..79001df
--- /dev/null
@@ -0,0 +1,40 @@
+#define AUBIO_UNSTABLE 1
+
+#include <stdio.h>
+#include <aubio.h>
+
+int
+main (void)
+{
+  /* allocate some memory */
+  uint_t win_s = 512;           /* fft size */
+  uint_t n_filters = 40;        /* number of filters */
+  cvec_t *in = new_cvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec (win_s);     /* input buffer */
+  fmat_t *coeffs = NULL;
+  smpl_t samplerate = 16000.;
+
+  /* allocate fft and other memory space */
+  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
+
+  /* assign Mel-frequency coefficients */
+  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
+
+  coeffs = aubio_filterbank_get_coeffs (o);
+  if (coeffs == NULL) {
+    return -1;
+  }
+
+  //fmat_print (coeffs);
+
+  //fprintf(stderr, "%f\n", fvec_sum(coeffs));
+
+  aubio_filterbank_do (o, in, out);
+
+  del_aubio_filterbank (o);
+  del_cvec (in);
+  del_fvec (out);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/spectral/test-mfcc.c b/tests/src/spectral/test-mfcc.c
new file mode 100644 (file)
index 0000000..c724d10
--- /dev/null
@@ -0,0 +1,30 @@
+#include <aubio.h>
+
+int
+main (void)
+{
+  /* allocate some memory */
+  uint_t win_s = 512;           /* fft size */
+  uint_t n_filters = 40;        /* number of filters */
+  uint_t n_coefs = 13;          /* number of coefficients */
+  cvec_t *in = new_cvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec (n_coefs);     /* input buffer */
+  smpl_t samplerate = 16000.;
+
+  /* allocate fft and other memory space */
+  aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
+
+  cvec_set (in, 1.);
+
+  aubio_mfcc_do (o, in, out);
+  fvec_print (out);
+  aubio_mfcc_do (o, in, out);
+  fvec_print (out);
+
+  del_aubio_mfcc (o);
+  del_cvec (in);
+  del_fvec (out);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/spectral/test-phasevoc-jack.c b/tests/src/spectral/test-phasevoc-jack.c
new file mode 100644 (file)
index 0000000..d42bdd3
--- /dev/null
@@ -0,0 +1,98 @@
+/** 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>
+#include "jackio.h"
+
+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;
+}
diff --git a/tests/src/spectral/test-phasevoc.c b/tests/src/spectral/test-phasevoc.c
new file mode 100644 (file)
index 0000000..6bea4c3
--- /dev/null
@@ -0,0 +1,30 @@
+/* test sample for phase vocoder */
+
+#include <stdio.h>
+#include <aubio.h>
+
+int main(){
+        uint_t win_s    = 1024; /* window size                       */
+        uint_t hop_s    = 256;  /* hop size                          */
+        /* allocate some memory */
+        fvec_t * in       = new_fvec (hop_s); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
+        fvec_t * out      = new_fvec (hop_s); /* output buffer      */
+        /* allocate fft and other memory space */
+        aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
+        /* 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;
+}
diff --git a/tests/src/spectral/test-specdesc.c b/tests/src/spectral/test-specdesc.c
new file mode 100644 (file)
index 0000000..fe1b71b
--- /dev/null
@@ -0,0 +1,48 @@
+
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int
+main ()
+{
+  uint_t win_s = 1024;          /* window size */
+  cvec_t *in = new_cvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec (1); /* input buffer */
+
+  aubio_specdesc_t *o;
+  
+  o = new_aubio_specdesc ("energy", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("energy", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("hfc", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("complex", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("phase", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("kl", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  o = new_aubio_specdesc ("mkl", win_s);
+  aubio_specdesc_do (o, in, out);
+  del_aubio_specdesc (o);
+
+  del_cvec (in);
+  del_fvec (out);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/spectral/test-tss.c b/tests/src/spectral/test-tss.c
new file mode 100644 (file)
index 0000000..0040168
--- /dev/null
@@ -0,0 +1,48 @@
+/* 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 <stdio.h>
+#define AUBIO_UNSTABLE 1
+#include <aubio.h>
+
+int main(){
+       int i;
+        uint_t win_s    = 1024; /* window size                       */
+        uint_t hop_s    = 256;  /* hop size                          */
+        /* allocate some memory */
+        fvec_t * in       = new_fvec (hop_s); /* input buffer       */
+        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
+        cvec_t * cstead   = new_cvec (win_s); /* fft norm and phase */
+        cvec_t * ctrans   = new_cvec (win_s); /* fft norm and phase */
+        fvec_t * stead    = new_fvec (hop_s); /* output buffer      */
+        fvec_t * trans    = new_fvec (hop_s); /* output buffer      */
+        /* allocate fft and other memory space */
+        aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s);
+        aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s);
+        aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s);
+
+       aubio_tss_t *  tss = new_aubio_tss(win_s,hop_s);
+        /* 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;
+}
diff --git a/tests/src/temporal/test-a_weighting.c b/tests/src/temporal/test-a_weighting.c
new file mode 100644 (file)
index 0000000..64915b2
--- /dev/null
@@ -0,0 +1,36 @@
+#include <aubio.h>
+
+int main(){
+  
+  aubio_filter_t * f;
+
+  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
+  uint_t nrates = 6;
+  uint_t samplerate, i = 0;
+
+  for ( samplerate = rates[i]; i < nrates ; i++ ) {
+    f = new_aubio_filter_a_weighting (samplerate);
+    del_aubio_filter (f);
+
+    f = new_aubio_filter (7);
+    aubio_filter_set_a_weighting (f, samplerate);
+    del_aubio_filter (f);
+  }
+
+  // samplerate unknown
+  f = new_aubio_filter_a_weighting (4200);
+  del_aubio_filter (f);
+
+  // order to small
+  f = new_aubio_filter (2);
+  aubio_filter_set_a_weighting (f, samplerate);
+  del_aubio_filter (f);
+
+  // order to big
+  f = new_aubio_filter (12);
+  aubio_filter_set_a_weighting (f, samplerate);
+  del_aubio_filter (f);
+
+  return 0;
+}
+
diff --git a/tests/src/temporal/test-aweighting.c b/tests/src/temporal/test-aweighting.c
deleted file mode 100644 (file)
index 64915b2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <aubio.h>
-
-int main(){
-  
-  aubio_filter_t * f;
-
-  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
-  uint_t nrates = 6;
-  uint_t samplerate, i = 0;
-
-  for ( samplerate = rates[i]; i < nrates ; i++ ) {
-    f = new_aubio_filter_a_weighting (samplerate);
-    del_aubio_filter (f);
-
-    f = new_aubio_filter (7);
-    aubio_filter_set_a_weighting (f, samplerate);
-    del_aubio_filter (f);
-  }
-
-  // samplerate unknown
-  f = new_aubio_filter_a_weighting (4200);
-  del_aubio_filter (f);
-
-  // order to small
-  f = new_aubio_filter (2);
-  aubio_filter_set_a_weighting (f, samplerate);
-  del_aubio_filter (f);
-
-  // order to big
-  f = new_aubio_filter (12);
-  aubio_filter_set_a_weighting (f, samplerate);
-  del_aubio_filter (f);
-
-  return 0;
-}
-
diff --git a/tests/src/temporal/test-biquad.c b/tests/src/temporal/test-biquad.c
new file mode 100644 (file)
index 0000000..6555cae
--- /dev/null
@@ -0,0 +1,15 @@
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
+
+        aubio_filter_do_filtfilt(o,in,in);
+        aubio_filter_do(o,in);
+
+        del_aubio_filter(o);
+        del_fvec(in);
+        return 0;
+}
diff --git a/tests/src/temporal/test-c_weighting.c b/tests/src/temporal/test-c_weighting.c
new file mode 100644 (file)
index 0000000..d5283fc
--- /dev/null
@@ -0,0 +1,36 @@
+#include <aubio.h>
+
+int main(){
+  
+  aubio_filter_t * f;
+
+  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
+  uint_t nrates = 6;
+  uint_t samplerate, i = 0;
+
+  for ( samplerate = rates[i]; i < nrates ; i++ ) {
+    f = new_aubio_filter_c_weighting (samplerate);
+    del_aubio_filter (f);
+
+    f = new_aubio_filter (5);
+    aubio_filter_set_c_weighting (f, samplerate);
+    del_aubio_filter (f);
+  }
+
+  // samplerate unknown
+  f = new_aubio_filter_c_weighting (4200);
+  del_aubio_filter (f);
+
+  // order to small
+  f = new_aubio_filter (2);
+  aubio_filter_set_c_weighting (f, samplerate);
+  del_aubio_filter (f);
+
+  // order to big
+  f = new_aubio_filter (12);
+  aubio_filter_set_c_weighting (f, samplerate);
+  del_aubio_filter (f);
+
+  return 0;
+}
+
diff --git a/tests/src/temporal/test-cweighting.c b/tests/src/temporal/test-cweighting.c
deleted file mode 100644 (file)
index d5283fc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <aubio.h>
-
-int main(){
-  
-  aubio_filter_t * f;
-
-  uint_t rates[] = { 8000, 16000, 22050, 44100, 96000, 192000};
-  uint_t nrates = 6;
-  uint_t samplerate, i = 0;
-
-  for ( samplerate = rates[i]; i < nrates ; i++ ) {
-    f = new_aubio_filter_c_weighting (samplerate);
-    del_aubio_filter (f);
-
-    f = new_aubio_filter (5);
-    aubio_filter_set_c_weighting (f, samplerate);
-    del_aubio_filter (f);
-  }
-
-  // samplerate unknown
-  f = new_aubio_filter_c_weighting (4200);
-  del_aubio_filter (f);
-
-  // order to small
-  f = new_aubio_filter (2);
-  aubio_filter_set_c_weighting (f, samplerate);
-  del_aubio_filter (f);
-
-  // order to big
-  f = new_aubio_filter (12);
-  aubio_filter_set_c_weighting (f, samplerate);
-  del_aubio_filter (f);
-
-  return 0;
-}
-
diff --git a/tests/src/temporal/test-filter.c b/tests/src/temporal/test-filter.c
new file mode 100644 (file)
index 0000000..84409d0
--- /dev/null
@@ -0,0 +1,38 @@
+#include <aubio.h>
+
+int
+main (void)
+{
+  /* allocate some memory */
+  uint_t win_s = 32;            /* window size */
+  fvec_t *in = new_fvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec (win_s);     /* input buffer */
+
+
+  aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
+  in->data[12] = 0.5;
+  fvec_print (in);
+  aubio_filter_do (o, in);
+  fvec_print (in);
+  del_aubio_filter (o);
+
+  o = new_aubio_filter_c_weighting (44100);
+  in->data[12] = 0.5;
+  fvec_print (in);
+  aubio_filter_do_outplace (o, in, out);
+  fvec_print (out);
+  del_aubio_filter (o);
+
+  o = new_aubio_filter_c_weighting (44100);
+  in->data[12] = 0.5;
+  fvec_print (in);
+  aubio_filter_do_filtfilt (o, in, out);
+  fvec_print (out);
+  del_aubio_filter (o);
+
+  del_fvec (in);
+  del_fvec (out);
+  aubio_cleanup ();
+
+  return 0;
+}
diff --git a/tests/src/temporal/test-resampler.c b/tests/src/temporal/test-resampler.c
new file mode 100644 (file)
index 0000000..b28bf9a
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <aubio.h>
+
+int
+main ()
+{
+  /* allocate some memory */
+  uint_t win_s = 1024;          /* window size */
+  smpl_t ratio = 0.5;
+  fvec_t *in = new_fvec (win_s);      /* input buffer */
+  fvec_t *out = new_fvec ((uint_t) (win_s * ratio));  /* input buffer */
+  aubio_resampler_t *o = new_aubio_resampler (0.5, 0);
+  uint_t i = 0;
+
+  while (i < 10) {
+    aubio_resampler_do (o, in, out);
+    i++;
+  };
+
+  del_aubio_resampler (o);
+  del_fvec (in);
+  del_fvec (out);
+
+  return 0;
+}
diff --git a/tests/src/test-biquad.c b/tests/src/test-biquad.c
deleted file mode 100644 (file)
index 6555cae..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
-
-        aubio_filter_do_filtfilt(o,in,in);
-        aubio_filter_do(o,in);
-
-        del_aubio_filter(o);
-        del_fvec(in);
-        return 0;
-}
diff --git a/tests/src/test-filter.c b/tests/src/test-filter.c
deleted file mode 100644 (file)
index 84409d0..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <aubio.h>
-
-int
-main (void)
-{
-  /* allocate some memory */
-  uint_t win_s = 32;            /* window size */
-  fvec_t *in = new_fvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (win_s);     /* input buffer */
-
-
-  aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
-  in->data[12] = 0.5;
-  fvec_print (in);
-  aubio_filter_do (o, in);
-  fvec_print (in);
-  del_aubio_filter (o);
-
-  o = new_aubio_filter_c_weighting (44100);
-  in->data[12] = 0.5;
-  fvec_print (in);
-  aubio_filter_do_outplace (o, in, out);
-  fvec_print (out);
-  del_aubio_filter (o);
-
-  o = new_aubio_filter_c_weighting (44100);
-  in->data[12] = 0.5;
-  fvec_print (in);
-  aubio_filter_do_filtfilt (o, in, out);
-  fvec_print (out);
-  del_aubio_filter (o);
-
-  del_fvec (in);
-  del_fvec (out);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-filterbank.c b/tests/src/test-filterbank.c
deleted file mode 100644 (file)
index 4ab3fcf..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <stdio.h>
-#include <aubio.h>
-
-int
-main (void)
-{
-  /* allocate some memory */
-  uint_t win_s = 1024;          /* window size */
-  uint_t n_filters = 13;        /* number of filters */
-  cvec_t *in = new_cvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (win_s);     /* input buffer */
-  fmat_t *coeffs = NULL;
-
-  /* allocate fft and other memory space */
-  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
-
-  coeffs = aubio_filterbank_get_coeffs (o);
-  if (coeffs == NULL) {
-    return -1;
-  }
-
-  /*
-  if (fvec_max (coeffs) != 0.) {
-    return -1;
-  }
-
-  if (fvec_min (coeffs) != 0.) {
-    return -1;
-  }
-  */
-
-  fmat_print (coeffs);
-
-  aubio_filterbank_do (o, in, out);
-
-  del_aubio_filterbank (o);
-  del_cvec (in);
-  del_fvec (out);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-filterbank_mel.c b/tests/src/test-filterbank_mel.c
deleted file mode 100644 (file)
index 79001df..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <stdio.h>
-#include <aubio.h>
-
-int
-main (void)
-{
-  /* allocate some memory */
-  uint_t win_s = 512;           /* fft size */
-  uint_t n_filters = 40;        /* number of filters */
-  cvec_t *in = new_cvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (win_s);     /* input buffer */
-  fmat_t *coeffs = NULL;
-  smpl_t samplerate = 16000.;
-
-  /* allocate fft and other memory space */
-  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
-
-  /* assign Mel-frequency coefficients */
-  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
-
-  coeffs = aubio_filterbank_get_coeffs (o);
-  if (coeffs == NULL) {
-    return -1;
-  }
-
-  //fmat_print (coeffs);
-
-  //fprintf(stderr, "%f\n", fvec_sum(coeffs));
-
-  aubio_filterbank_do (o, in, out);
-
-  del_aubio_filterbank (o);
-  del_cvec (in);
-  del_fvec (out);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-hist.c b/tests/src/test-hist.c
deleted file mode 100644 (file)
index 9cd39e5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-#include <stdlib.h>
-
-int main( )
-{
-  uint_t length;
-  for (length = 1; length < 10; length ++ ) {
-    aubio_hist_t *o = new_aubio_hist(0, 1, length);
-    fvec_t *t = new_aubio_window("hanning", length);
-    aubio_hist_do(o,t);
-    fvec_print(t);
-    aubio_hist_do_notnull(o,t);
-    fvec_print(t);
-    aubio_hist_dyn_notnull(o,t);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("hanningz", length);
-    aubio_hist_do(o,t);
-    fvec_print(t);
-    aubio_hist_do_notnull(o,t);
-    fvec_print(t);
-    aubio_hist_dyn_notnull(o,t);
-    fvec_print(t);
-    del_aubio_hist(o);
-    del_fvec(t);
-  }
-  return 0;
-}
-
diff --git a/tests/src/test-mathutils-window.c b/tests/src/test-mathutils-window.c
new file mode 100644 (file)
index 0000000..a7d087c
--- /dev/null
@@ -0,0 +1,41 @@
+#include <aubio.h>
+#include <stdlib.h>
+
+int main( )
+{
+  uint_t length;
+  for (length = 2; length <= 5; length++)
+  {
+    fvec_t *t = new_aubio_window("rectangle", length);
+    del_fvec(t);
+    t = new_aubio_window("hamming", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("hanning", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("hanningz", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("blackman", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("blackman_harris", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("gaussian", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("welch", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("parzen", length);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("default", length);
+    fvec_print(t);
+    del_fvec(t);
+  }
+  return 0;
+}
+
diff --git a/tests/src/test-mfcc.c b/tests/src/test-mfcc.c
deleted file mode 100644 (file)
index c724d10..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <aubio.h>
-
-int
-main (void)
-{
-  /* allocate some memory */
-  uint_t win_s = 512;           /* fft size */
-  uint_t n_filters = 40;        /* number of filters */
-  uint_t n_coefs = 13;          /* number of coefficients */
-  cvec_t *in = new_cvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (n_coefs);     /* input buffer */
-  smpl_t samplerate = 16000.;
-
-  /* allocate fft and other memory space */
-  aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
-
-  cvec_set (in, 1.);
-
-  aubio_mfcc_do (o, in, out);
-  fvec_print (out);
-  aubio_mfcc_do (o, in, out);
-  fvec_print (out);
-
-  del_aubio_mfcc (o);
-  del_cvec (in);
-  del_fvec (out);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-onset.c b/tests/src/test-onset.c
deleted file mode 100644 (file)
index fd2ab2e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s/4); /* input buffer */
-        fvec_t * out      = new_fvec (2);     /* input buffer */
-        aubio_onset_t * onset  = new_aubio_onset("complex", win_s, win_s/4, 44100.);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_onset_do (onset,in,out);
-          i++;
-        };
-
-        del_aubio_onset(onset);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
diff --git a/tests/src/test-onsetdetection.c b/tests/src/test-onsetdetection.c
deleted file mode 100644 (file)
index fe1b71b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int
-main ()
-{
-  uint_t win_s = 1024;          /* window size */
-  cvec_t *in = new_cvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec (1); /* input buffer */
-
-  aubio_specdesc_t *o;
-  
-  o = new_aubio_specdesc ("energy", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("energy", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("hfc", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("complex", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("phase", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("kl", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  o = new_aubio_specdesc ("mkl", win_s);
-  aubio_specdesc_do (o, in, out);
-  del_aubio_specdesc (o);
-
-  del_cvec (in);
-  del_fvec (out);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-peakpick.c b/tests/src/test-peakpick.c
deleted file mode 100644 (file)
index 1ce6bb4..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (1); /* input buffer */
-        aubio_peakpicker_t * o = new_aubio_peakpicker();
-        aubio_peakpicker_set_threshold (o, 0.3);
-
-        aubio_peakpicker_do(o, in, out);
-        aubio_peakpicker_do(o, in, out);
-        aubio_peakpicker_do(o, in, out);
-        aubio_peakpicker_do(o, in, out);
-
-        del_aubio_peakpicker(o);
-        del_fvec(in);
-        return 0;
-}
-
diff --git a/tests/src/test-phasevoc-jack.c b/tests/src/test-phasevoc-jack.c
deleted file mode 100644 (file)
index d42bdd3..0000000
+++ /dev/null
@@ -1,98 +0,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>
-#include "jackio.h"
-
-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;
-}
diff --git a/tests/src/test-phasevoc.c b/tests/src/test-phasevoc.c
deleted file mode 100644 (file)
index 6bea4c3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* test sample for phase vocoder */
-
-#include <stdio.h>
-#include <aubio.h>
-
-int main(){
-        uint_t win_s    = 1024; /* window size                       */
-        uint_t hop_s    = 256;  /* hop size                          */
-        /* allocate some memory */
-        fvec_t * in       = new_fvec (hop_s); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
-        fvec_t * out      = new_fvec (hop_s); /* output buffer      */
-        /* allocate fft and other memory space */
-        aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
-        /* 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;
-}
diff --git a/tests/src/test-pitch.c b/tests/src/test-pitch.c
deleted file mode 100644 (file)
index e4e209e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024; /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (1); /* input buffer */
-        aubio_pitch_t *p = new_aubio_pitch ("default", win_s, win_s / 2, 44100);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_pitch_do (p, in, out);
-          i++;
-        };
-
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
diff --git a/tests/src/test-pitchdetection.c b/tests/src/test-pitchdetection.c
deleted file mode 100644 (file)
index ac884c6..0000000
+++ /dev/null
@@ -1,26 +0,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 */
-  fvec_t *in = new_fvec (hop_s);      /* input buffer */
-  fvec_t *out = new_fvec (1); /* input buffer */
-  aubio_pitch_t *o =
-      new_aubio_pitch ("default", win_s, hop_s, samplerate);
-  uint_t i = 0;
-
-  while (i < 100) {
-    aubio_pitch_do (o, in, out);
-    i++;
-  };
-
-  del_aubio_pitch (o);
-  del_fvec (in);
-  aubio_cleanup ();
-
-  return 0;
-}
diff --git a/tests/src/test-pitchfcomb.c b/tests/src/test-pitchfcomb.c
deleted file mode 100644 (file)
index dda6099..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        fvec_t * in       = new_fvec (hop_s); /* input buffer */
-        fvec_t * out      = new_fvec (1);
-        aubio_pitchfcomb_t * o  = new_aubio_pitchfcomb (
-          win_s, hop_s);
-        uint_t i = 0;
-
-        while (i < 2) {
-          aubio_pitchfcomb_do (o,in, out);
-          i++;
-        };
-
-        del_aubio_pitchfcomb(o);
-        del_fvec(in);
-        aubio_cleanup();
-
-        return 0;
-}
diff --git a/tests/src/test-pitchmcomb.c b/tests/src/test-pitchmcomb.c
deleted file mode 100644 (file)
index 7d3cb16..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        uint_t hop_s      = win_s/4;                    /* hop size */
-        cvec_t * in       = new_cvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (1); /* input buffer */
-
-        aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(win_s, hop_s);
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchmcomb_do (o,in, out);
-          i++;
-        };
-
-        del_aubio_pitchmcomb(o);
-        del_cvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
diff --git a/tests/src/test-pitchschmitt.c b/tests/src/test-pitchschmitt.c
deleted file mode 100644 (file)
index 745feca..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out = new_fvec (1); /* input buffer */
-        aubio_pitchschmitt_t * o  = new_aubio_pitchschmitt(win_s);
-        uint_t i = 0;
-
-        while (i < 1000) {
-          aubio_pitchschmitt_do (o,in, out);
-          i++;
-        };
-
-        del_aubio_pitchschmitt(o);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
diff --git a/tests/src/test-pitchyin.c b/tests/src/test-pitchyin.c
deleted file mode 100644 (file)
index 5d35950..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (win_s/2); /* input buffer */
-        aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_pitchyin_do (p, in,out);
-          i++;
-        };
-
-        del_fvec(in);
-        del_fvec(out);
-        del_aubio_pitchyin(p);
-        aubio_cleanup();
-
-        return 0;
-}
diff --git a/tests/src/test-pitchyinfft.c b/tests/src/test-pitchyinfft.c
deleted file mode 100644 (file)
index 32e144d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        fvec_t * out      = new_fvec (1); /* output pitch periods */
-        aubio_pitchyinfft_t * o  = new_aubio_pitchyinfft(win_s);
-        aubio_pitchyinfft_set_tolerance (o, 0.2);
-        uint_t i = 0;
-
-        while (i < 10) {
-          aubio_pitchyinfft_do (o,in,out);
-          i++;
-        };
-
-        del_aubio_pitchyinfft(o);
-        del_fvec(in);
-        del_fvec(out);
-        aubio_cleanup();
-
-        return 0;
-}
-
diff --git a/tests/src/test-resample.c b/tests/src/test-resample.c
deleted file mode 100644 (file)
index b28bf9a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdio.h>
-#include <aubio.h>
-
-int
-main ()
-{
-  /* allocate some memory */
-  uint_t win_s = 1024;          /* window size */
-  smpl_t ratio = 0.5;
-  fvec_t *in = new_fvec (win_s);      /* input buffer */
-  fvec_t *out = new_fvec ((uint_t) (win_s * ratio));  /* input buffer */
-  aubio_resampler_t *o = new_aubio_resampler (0.5, 0);
-  uint_t i = 0;
-
-  while (i < 10) {
-    aubio_resampler_do (o, in, out);
-    i++;
-  };
-
-  del_aubio_resampler (o);
-  del_fvec (in);
-  del_fvec (out);
-
-  return 0;
-}
diff --git a/tests/src/test-scale.c b/tests/src/test-scale.c
deleted file mode 100644 (file)
index 3f94eb2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <aubio.h>
-
-int main(){
-        /* allocate some memory */
-        uint_t win_s      = 1024;                       /* window size */
-        fvec_t * in       = new_fvec (win_s); /* input buffer */
-        aubio_scale_t * o = new_aubio_scale(0,1,2,3);
-        aubio_scale_set_limits (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;
-}
diff --git a/tests/src/test-tss.c b/tests/src/test-tss.c
deleted file mode 100644 (file)
index 0040168..0000000
+++ /dev/null
@@ -1,48 +0,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 <stdio.h>
-#define AUBIO_UNSTABLE 1
-#include <aubio.h>
-
-int main(){
-       int i;
-        uint_t win_s    = 1024; /* window size                       */
-        uint_t hop_s    = 256;  /* hop size                          */
-        /* allocate some memory */
-        fvec_t * in       = new_fvec (hop_s); /* input buffer       */
-        cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
-        cvec_t * cstead   = new_cvec (win_s); /* fft norm and phase */
-        cvec_t * ctrans   = new_cvec (win_s); /* fft norm and phase */
-        fvec_t * stead    = new_fvec (hop_s); /* output buffer      */
-        fvec_t * trans    = new_fvec (hop_s); /* output buffer      */
-        /* allocate fft and other memory space */
-        aubio_pvoc_t * pv = new_aubio_pvoc (win_s,hop_s);
-        aubio_pvoc_t * pvt = new_aubio_pvoc(win_s,hop_s);
-        aubio_pvoc_t * pvs = new_aubio_pvoc(win_s,hop_s);
-
-       aubio_tss_t *  tss = new_aubio_tss(win_s,hop_s);
-        /* 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;
-}
diff --git a/tests/src/test-window.c b/tests/src/test-window.c
deleted file mode 100644 (file)
index a7d087c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <aubio.h>
-#include <stdlib.h>
-
-int main( )
-{
-  uint_t length;
-  for (length = 2; length <= 5; length++)
-  {
-    fvec_t *t = new_aubio_window("rectangle", length);
-    del_fvec(t);
-    t = new_aubio_window("hamming", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("hanning", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("hanningz", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("blackman", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("blackman_harris", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("gaussian", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("welch", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("parzen", length);
-    fvec_print(t);
-    del_fvec(t);
-    t = new_aubio_window("default", length);
-    fvec_print(t);
-    del_fvec(t);
-  }
-  return 0;
-}
-
diff --git a/tests/src/utils/test-hist.c b/tests/src/utils/test-hist.c
new file mode 100644 (file)
index 0000000..9cd39e5
--- /dev/null
@@ -0,0 +1,31 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+#include <stdlib.h>
+
+int main( )
+{
+  uint_t length;
+  for (length = 1; length < 10; length ++ ) {
+    aubio_hist_t *o = new_aubio_hist(0, 1, length);
+    fvec_t *t = new_aubio_window("hanning", length);
+    aubio_hist_do(o,t);
+    fvec_print(t);
+    aubio_hist_do_notnull(o,t);
+    fvec_print(t);
+    aubio_hist_dyn_notnull(o,t);
+    fvec_print(t);
+    del_fvec(t);
+    t = new_aubio_window("hanningz", length);
+    aubio_hist_do(o,t);
+    fvec_print(t);
+    aubio_hist_do_notnull(o,t);
+    fvec_print(t);
+    aubio_hist_dyn_notnull(o,t);
+    fvec_print(t);
+    del_aubio_hist(o);
+    del_fvec(t);
+  }
+  return 0;
+}
+
diff --git a/tests/src/utils/test-scale.c b/tests/src/utils/test-scale.c
new file mode 100644 (file)
index 0000000..3f94eb2
--- /dev/null
@@ -0,0 +1,22 @@
+#define AUBIO_UNSTABLE 1
+
+#include <aubio.h>
+
+int main(){
+        /* allocate some memory */
+        uint_t win_s      = 1024;                       /* window size */
+        fvec_t * in       = new_fvec (win_s); /* input buffer */
+        aubio_scale_t * o = new_aubio_scale(0,1,2,3);
+        aubio_scale_set_limits (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;
+}