From: Paul Brossier Date: Fri, 13 Jul 2012 22:01:52 +0000 (-0600) Subject: tests/src/io/*.c: add simple tests X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=301b8079d382777047f8219ed4c966c710872e2f;p=aubio.git tests/src/io/*.c: add simple tests --- diff --git a/tests/src/io/test-source.c b/tests/src/io/test-source.c new file mode 100644 index 00000000..3e1b9f51 --- /dev/null +++ b/tests/src/io/test-source.c @@ -0,0 +1,25 @@ +#include +#include + +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 index 00000000..86b267a3 --- /dev/null +++ b/tests/src/io/test-source_apple_audio_file.c @@ -0,0 +1,25 @@ +#include +#include + +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; +} +