ref: 301b8079d382777047f8219ed4c966c710872e2f
parent: 2b4080ea3f8e1d7f38ef64bf0c8a8de46ee201e7
author: Paul Brossier <piem@piem.org>
date: Fri Jul 13 12:01:52 EDT 2012
tests/src/io/*.c: add simple tests
--- /dev/null
+++ b/tests/src/io/test-source.c
@@ -1,0 +1,25 @@
+#include <stdio.h>
+#include <aubio.h>
+
+char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
+//char_t *path = "/Users/piem/Downloads/Keziah Jones - Where's Life.mp3";
+
+int main(){
+ uint_t samplerate = 32000;
+ uint_t hop_size = 1024;
+ uint_t read = hop_size;
+ fvec_t *vec = new_fvec(hop_size);
+ aubio_source_t* s = new_aubio_source(path, samplerate, hop_size);
+
+ if (!s) return -1;
+
+ while ( read == hop_size ) {
+ aubio_source_do(s, vec, &read);
+ fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
+ }
+
+ del_aubio_source(s);
+
+ return 0;
+}
+
--- /dev/null
+++ b/tests/src/io/test-source_apple_audio_file.c
@@ -1,0 +1,25 @@
+#include <stdio.h>
+#include <aubio.h>
+
+char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
+//char_t *path = "/Volumes/moving/moving/photos/gopro2/100GOPRO/GOPR4515.MP4";
+
+int main(){
+ uint_t samplerate = 32000;
+ uint_t hop_size = 1024;
+ uint_t read = hop_size;
+ fvec_t *vec = new_fvec(hop_size);
+ aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(path, samplerate, hop_size);
+
+ if (!s) return -1;
+
+ while ( read == hop_size ) {
+ aubio_source_apple_audio_do(s, vec, &read);
+ fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
+ }
+
+ del_aubio_source_apple_audio(s);
+
+ return 0;
+}
+