tests/src/io/*.c: add simple tests
authorPaul Brossier <piem@piem.org>
Fri, 13 Jul 2012 22:01:52 +0000 (16:01 -0600)
committerPaul Brossier <piem@piem.org>
Fri, 13 Jul 2012 22:01:52 +0000 (16:01 -0600)
tests/src/io/test-source.c [new file with mode: 0644]
tests/src/io/test-source_apple_audio_file.c [new file with mode: 0644]

diff --git a/tests/src/io/test-source.c b/tests/src/io/test-source.c
new file mode 100644 (file)
index 0000000..3e1b9f5
--- /dev/null
@@ -0,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;
+}
+
diff --git a/tests/src/io/test-source_apple_audio_file.c b/tests/src/io/test-source_apple_audio_file.c
new file mode 100644 (file)
index 0000000..86b267a
--- /dev/null
@@ -0,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;
+}
+