From: Paul Brossier Date: Tue, 10 Jul 2012 22:26:12 +0000 (-0700) Subject: tests/: move file around to match src/ X-Git-Tag: 0.4.0-beta1~420 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=02418f6a5f935cfe38de8c5ed40ede2afb4a1a17;p=aubio.git tests/: move file around to match src/ --- diff --git a/tests/python/src/onset/peakpick.py b/tests/python/src/onset/peakpick.py deleted file mode 100644 index b3d54a86..00000000 --- a/tests/python/src/onset/peakpick.py +++ /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 index 00000000..b3d54a86 --- /dev/null +++ b/tests/python/src/onset/peakpicker.py @@ -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() diff --git a/tests/src/Makefile.am b/tests/src/Makefile.am index ad98446e..9c143af7 100644 --- a/tests/src/Makefile.am +++ b/tests/src/Makefile.am @@ -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 index 00000000..fd2ab2e4 --- /dev/null +++ b/tests/src/onset/test-onset.c @@ -0,0 +1,22 @@ +#include + +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 index 00000000..1ce6bb45 --- /dev/null +++ b/tests/src/onset/test-peakpicker.c @@ -0,0 +1,22 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..ac884c69 --- /dev/null +++ b/tests/src/pitch/test-pitch.c @@ -0,0 +1,26 @@ +#include + +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 index 00000000..dda60995 --- /dev/null +++ b/tests/src/pitch/test-pitchfcomb.c @@ -0,0 +1,25 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..7d3cb16b --- /dev/null +++ b/tests/src/pitch/test-pitchmcomb.c @@ -0,0 +1,26 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..745feca8 --- /dev/null +++ b/tests/src/pitch/test-pitchschmitt.c @@ -0,0 +1,25 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..5d359501 --- /dev/null +++ b/tests/src/pitch/test-pitchyin.c @@ -0,0 +1,24 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..32e144d6 --- /dev/null +++ b/tests/src/pitch/test-pitchyinfft.c @@ -0,0 +1,26 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..4ab3fcf7 --- /dev/null +++ b/tests/src/spectral/test-filterbank.c @@ -0,0 +1,44 @@ +#define AUBIO_UNSTABLE 1 + +#include +#include + +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 index 00000000..79001dfd --- /dev/null +++ b/tests/src/spectral/test-filterbank_mel.c @@ -0,0 +1,40 @@ +#define AUBIO_UNSTABLE 1 + +#include +#include + +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 index 00000000..c724d104 --- /dev/null +++ b/tests/src/spectral/test-mfcc.c @@ -0,0 +1,30 @@ +#include + +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 index 00000000..d42bdd3c --- /dev/null +++ b/tests/src/spectral/test-phasevoc-jack.c @@ -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 +#include /* sleep() */ +#include +#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;ilength;i++) fftgrain[0]->phas[i] = 0.; + // double phases of second channel + for (i=0;ilength;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 index 00000000..6bea4c39 --- /dev/null +++ b/tests/src/spectral/test-phasevoc.c @@ -0,0 +1,30 @@ +/* test sample for phase vocoder */ + +#include +#include + +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 index 00000000..fe1b71b7 --- /dev/null +++ b/tests/src/spectral/test-specdesc.c @@ -0,0 +1,48 @@ + +#define AUBIO_UNSTABLE 1 + +#include + +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 index 00000000..00401687 --- /dev/null +++ b/tests/src/spectral/test-tss.c @@ -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 +#define AUBIO_UNSTABLE 1 +#include + +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 index 00000000..64915b25 --- /dev/null +++ b/tests/src/temporal/test-a_weighting.c @@ -0,0 +1,36 @@ +#include + +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 index 64915b25..00000000 --- a/tests/src/temporal/test-aweighting.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -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 index 00000000..6555cae3 --- /dev/null +++ b/tests/src/temporal/test-biquad.c @@ -0,0 +1,15 @@ +#include + +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 index 00000000..d5283fc3 --- /dev/null +++ b/tests/src/temporal/test-c_weighting.c @@ -0,0 +1,36 @@ +#include + +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 index d5283fc3..00000000 --- a/tests/src/temporal/test-cweighting.c +++ /dev/null @@ -1,36 +0,0 @@ -#include - -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 index 00000000..84409d05 --- /dev/null +++ b/tests/src/temporal/test-filter.c @@ -0,0 +1,38 @@ +#include + +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 index 00000000..b28bf9a9 --- /dev/null +++ b/tests/src/temporal/test-resampler.c @@ -0,0 +1,25 @@ +#include +#include + +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 index 6555cae3..00000000 --- a/tests/src/test-biquad.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -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 index 84409d05..00000000 --- a/tests/src/test-filter.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -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 index 4ab3fcf7..00000000 --- a/tests/src/test-filterbank.c +++ /dev/null @@ -1,44 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include -#include - -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 index 79001dfd..00000000 --- a/tests/src/test-filterbank_mel.c +++ /dev/null @@ -1,40 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include -#include - -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 index 9cd39e58..00000000 --- a/tests/src/test-hist.c +++ /dev/null @@ -1,31 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include -#include - -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 index 00000000..a7d087cf --- /dev/null +++ b/tests/src/test-mathutils-window.c @@ -0,0 +1,41 @@ +#include +#include + +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 index c724d104..00000000 --- a/tests/src/test-mfcc.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -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 index fd2ab2e4..00000000 --- a/tests/src/test-onset.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -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 index fe1b71b7..00000000 --- a/tests/src/test-onsetdetection.c +++ /dev/null @@ -1,48 +0,0 @@ - -#define AUBIO_UNSTABLE 1 - -#include - -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 index 1ce6bb45..00000000 --- a/tests/src/test-peakpick.c +++ /dev/null @@ -1,22 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index d42bdd3c..00000000 --- a/tests/src/test-phasevoc-jack.c +++ /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 -#include /* sleep() */ -#include -#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;ilength;i++) fftgrain[0]->phas[i] = 0.; - // double phases of second channel - for (i=0;ilength;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 index 6bea4c39..00000000 --- a/tests/src/test-phasevoc.c +++ /dev/null @@ -1,30 +0,0 @@ -/* test sample for phase vocoder */ - -#include -#include - -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 index e4e209e8..00000000 --- a/tests/src/test-pitch.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -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 index ac884c69..00000000 --- a/tests/src/test-pitchdetection.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -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 index dda60995..00000000 --- a/tests/src/test-pitchfcomb.c +++ /dev/null @@ -1,25 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index 7d3cb16b..00000000 --- a/tests/src/test-pitchmcomb.c +++ /dev/null @@ -1,26 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index 745feca8..00000000 --- a/tests/src/test-pitchschmitt.c +++ /dev/null @@ -1,25 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index 5d359501..00000000 --- a/tests/src/test-pitchyin.c +++ /dev/null @@ -1,24 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index 32e144d6..00000000 --- a/tests/src/test-pitchyinfft.c +++ /dev/null @@ -1,26 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index b28bf9a9..00000000 --- a/tests/src/test-resample.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -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 index 3f94eb2b..00000000 --- a/tests/src/test-scale.c +++ /dev/null @@ -1,22 +0,0 @@ -#define AUBIO_UNSTABLE 1 - -#include - -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 index 00401687..00000000 --- a/tests/src/test-tss.c +++ /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 -#define AUBIO_UNSTABLE 1 -#include - -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 index a7d087cf..00000000 --- a/tests/src/test-window.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -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 index 00000000..9cd39e58 --- /dev/null +++ b/tests/src/utils/test-hist.c @@ -0,0 +1,31 @@ +#define AUBIO_UNSTABLE 1 + +#include +#include + +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 index 00000000..3f94eb2b --- /dev/null +++ b/tests/src/utils/test-scale.c @@ -0,0 +1,22 @@ +#define AUBIO_UNSTABLE 1 + +#include + +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; +}