ref: 5f9df779ec5b48595e64ca66979a6fe670b321c5
parent: 42515ac48d362d119ea1eb1476d12673acab8fac
author: Paul Brossier <piem@piem.org>
date: Mon May 2 08:37:41 EDT 2011
tests/: move tests around
--- /dev/null
+++ b/tests/src/spectral/test-fft.c
@@ -1,0 +1,34 @@
+
+#include <aubio.h>
+
+int main(){
+ /* allocate some memory */
+ uint_t win_s = 8; /* window size */
+ fvec_t * in = new_fvec (win_s); /* input buffer */
+ cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
+ fvec_t * out = new_fvec (win_s); /* output buffer */
+ in->data[0] = 1;
+ in->data[1] = 2;
+ in->data[2] = 3;
+ in->data[3] = 4;
+ in->data[4] = 5;
+ in->data[5] = 6;
+ in->data[6] = 5;
+ in->data[7] = 6;
+ /* allocate fft and other memory space */
+ aubio_fft_t * fft = new_aubio_fft(win_s);
+ /* fill input with some data */
+ fvec_print(in);
+ /* execute stft */
+ aubio_fft_do (fft,in,fftgrain);
+ cvec_print(fftgrain);
+ /* execute inverse fourier transform */
+ aubio_fft_rdo(fft,fftgrain,out);
+ fvec_print(out);
+ del_aubio_fft(fft);
+ del_fvec(in);
+ del_cvec(fftgrain);
+ del_fvec(out);
+ aubio_cleanup();
+ return 0;
+}
--- /dev/null
+++ b/tests/src/tempo/test-beattracking.c
@@ -1,0 +1,41 @@
+#define AUBIO_UNSTABLE 1
+
+#include <stdio.h>
+#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/4); /* input buffer */
+
+ /* allocate fft and other memory space */
+ aubio_beattracking_t * tempo = new_aubio_beattracking(win_s);
+
+ uint_t i = 0;
+
+ smpl_t curtempo, curtempoconf;
+
+ while (i < 10) {
+ aubio_beattracking_do(tempo,in,out);
+ curtempo = aubio_beattracking_get_bpm(tempo);
+ if (curtempo != 0.) {
+ fprintf(stdout,"%f\n",curtempo);
+ return 1;
+ }
+ curtempoconf = aubio_beattracking_get_confidence(tempo);
+ if (curtempoconf != 0.) {
+ fprintf(stdout,"%f\n",curtempo);
+ return 1;
+ }
+ i++;
+ };
+
+ del_aubio_beattracking(tempo);
+ del_fvec(in);
+ del_fvec(out);
+ aubio_cleanup();
+
+ return 0;
+}
+
--- /dev/null
+++ b/tests/src/tempo/test-tempo.c
@@ -1,0 +1,35 @@
+#include <stdio.h>
+#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 (2); /* input buffer */
+ aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
+ uint_t i = 0;
+
+ smpl_t curtempo, curtempoconf;
+
+ while (i < 1000) {
+ aubio_tempo_do(o,in,out);
+ curtempo = aubio_tempo_get_bpm(o);
+ if (curtempo != 0.) {
+ fprintf(stdout,"%f\n",curtempo);
+ return 1;
+ }
+ curtempoconf = aubio_tempo_get_confidence(o);
+ if (curtempoconf != 0.) {
+ fprintf(stdout,"%f\n",curtempo);
+ return 1;
+ }
+ i++;
+ };
+
+ del_aubio_tempo(o);
+ del_fvec(in);
+ del_fvec(out);
+ aubio_cleanup();
+
+ return 0;
+}
--- a/tests/src/test-beattracking.c
+++ /dev/null
@@ -1,41 +1,0 @@
-#define AUBIO_UNSTABLE 1
-
-#include <stdio.h>
-#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/4); /* input buffer */
-
- /* allocate fft and other memory space */
- aubio_beattracking_t * tempo = new_aubio_beattracking(win_s);
-
- uint_t i = 0;
-
- smpl_t curtempo, curtempoconf;
-
- while (i < 10) {
- aubio_beattracking_do(tempo,in,out);
- curtempo = aubio_beattracking_get_bpm(tempo);
- if (curtempo != 0.) {
- fprintf(stdout,"%f\n",curtempo);
- return 1;
- }
- curtempoconf = aubio_beattracking_get_confidence(tempo);
- if (curtempoconf != 0.) {
- fprintf(stdout,"%f\n",curtempo);
- return 1;
- }
- i++;
- };
-
- del_aubio_beattracking(tempo);
- del_fvec(in);
- del_fvec(out);
- aubio_cleanup();
-
- return 0;
-}
-
--- a/tests/src/test-fft.c
+++ /dev/null
@@ -1,34 +1,0 @@
-
-#include <aubio.h>
-
-int main(){
- /* allocate some memory */
- uint_t win_s = 8; /* window size */
- fvec_t * in = new_fvec (win_s); /* input buffer */
- cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */
- fvec_t * out = new_fvec (win_s); /* output buffer */
- in->data[0] = 1;
- in->data[1] = 2;
- in->data[2] = 3;
- in->data[3] = 4;
- in->data[4] = 5;
- in->data[5] = 6;
- in->data[6] = 5;
- in->data[7] = 6;
- /* allocate fft and other memory space */
- aubio_fft_t * fft = new_aubio_fft(win_s);
- /* fill input with some data */
- fvec_print(in);
- /* execute stft */
- aubio_fft_do (fft,in,fftgrain);
- cvec_print(fftgrain);
- /* execute inverse fourier transform */
- aubio_fft_rdo(fft,fftgrain,out);
- fvec_print(out);
- del_aubio_fft(fft);
- del_fvec(in);
- del_cvec(fftgrain);
- del_fvec(out);
- aubio_cleanup();
- return 0;
-}
--- a/tests/src/test-tempo.c
+++ /dev/null
@@ -1,35 +1,0 @@
-#include <stdio.h>
-#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 (2); /* input buffer */
- aubio_tempo_t * o = new_aubio_tempo("complex", win_s, win_s/4, 44100.);
- uint_t i = 0;
-
- smpl_t curtempo, curtempoconf;
-
- while (i < 1000) {
- aubio_tempo_do(o,in,out);
- curtempo = aubio_tempo_get_bpm(o);
- if (curtempo != 0.) {
- fprintf(stdout,"%f\n",curtempo);
- return 1;
- }
- curtempoconf = aubio_tempo_get_confidence(o);
- if (curtempoconf != 0.) {
- fprintf(stdout,"%f\n",curtempo);
- return 1;
- }
- i++;
- };
-
- del_aubio_tempo(o);
- del_fvec(in);
- del_fvec(out);
- aubio_cleanup();
-
- return 0;
-}