Changeset 248da64 for tests/src/io
- Timestamp:
- Mar 3, 2013, 7:30:40 PM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 26775a3
- Parents:
- c71aa44
- Location:
- tests/src/io
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/io/test-sink.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 3 #include " config.h"2 #include "utils_tests.h" 4 3 5 char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 4 int main (int argc, char **argv) 5 { 6 sint_t err = 0; 7 7 8 int main(){ 9 int err = 0; 8 if (argc < 3) { 9 err = 2; 10 PRINT_ERR("not enough arguments\n"); 11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]); 12 return err; 13 } 14 10 15 uint_t samplerate = 44100; 11 16 uint_t hop_size = 512; 12 uint_t read = hop_size; 17 uint_t n_frames = 0, read = 0; 18 19 char_t *source_path = argv[1]; 20 char_t *sink_path = argv[2]; 21 if ( argc == 4 ) samplerate = atoi(argv[3]); 22 13 23 fvec_t *vec = new_fvec(hop_size); 14 aubio_source_t * i = new_aubio_source(path, samplerate, hop_size); 15 aubio_sink_t * o = new_aubio_sink(outpath, samplerate); 24 aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); 25 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); 26 aubio_sink_t *o = new_aubio_sink(sink_path, samplerate); 16 27 17 if (!i || !o) { err = -1; goto beach; }28 if (!i || !o) { err = 1; goto beach; } 18 29 19 while ( read == hop_size ){30 do { 20 31 aubio_source_do(i, vec, &read); 21 32 aubio_sink_do(o, vec, read); 22 } 33 n_frames += read; 34 } while ( read == hop_size ); 35 36 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n", 37 n_frames, source_path, sink_path, samplerate); 23 38 24 39 beach: … … 28 43 return err; 29 44 } 30 -
tests/src/io/test-sink_apple_audio_file.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 3 #include " config.h"2 #include "utils_tests.h" 4 3 5 char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 4 int main (int argc, char **argv) 5 { 6 sint_t err = 0; 7 7 8 int main(){ 9 int err = 0; 8 if (argc < 3) { 9 err = 2; 10 PRINT_ERR("not enough arguments\n"); 11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]); 12 return err; 13 } 14 10 15 #ifdef __APPLE__ 11 16 uint_t samplerate = 44100; 12 17 uint_t hop_size = 512; 13 uint_t read = hop_size; 18 uint_t n_frames = 0, read = 0; 19 20 char_t *source_path = argv[1]; 21 char_t *sink_path = argv[2]; 22 if ( argc == 4 ) samplerate = atoi(argv[3]); 23 14 24 fvec_t *vec = new_fvec(hop_size); 15 aubio_source_apple_audio_t * i = new_aubio_source_apple_audio(path, samplerate, hop_size); 16 aubio_sink_apple_audio_t * o = new_aubio_sink_apple_audio(outpath, samplerate); 25 aubio_source_apple_audio_t *i = new_aubio_source_apple_audio(source_path, samplerate, hop_size); 26 if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(i); 27 aubio_sink_apple_audio_t *o = new_aubio_sink_apple_audio(sink_path, samplerate); 17 28 18 if (!i || !o) { err = -1; goto beach; }29 if (!i || !o) { err = 1; goto beach; } 19 30 20 while ( read == hop_size ){31 do { 21 32 aubio_source_apple_audio_do(i, vec, &read); 22 33 aubio_sink_apple_audio_do(o, vec, read); 23 } 34 n_frames += read; 35 } while ( read == hop_size ); 36 37 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n", 38 n_frames, source_path, sink_path, samplerate); 24 39 25 40 beach: … … 28 43 del_fvec(vec); 29 44 #else 30 fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n"); 45 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 46 err = 3; 31 47 #endif /* __APPLE__ */ 32 48 return err; 33 49 } 34 -
tests/src/io/test-sink_sndfile.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 3 #include " config.h"2 #include "utils_tests.h" 4 3 5 char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 6 char_t *outpath = "/var/tmp/test.wav"; 4 int main (int argc, char **argv) 5 { 6 sint_t err = 0; 7 7 8 int main(){ 9 int err = 0; 8 if (argc < 3) { 9 err = 2; 10 PRINT_ERR("not enough arguments\n"); 11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]); 12 return err; 13 } 14 10 15 #ifdef HAVE_SNDFILE 11 16 uint_t samplerate = 44100; 12 17 uint_t hop_size = 512; 13 uint_t read = hop_size; 18 uint_t n_frames = 0, read = 0; 19 20 char_t *source_path = argv[1]; 21 char_t *sink_path = argv[2]; 22 if ( argc == 4 ) samplerate = atoi(argv[3]); 23 14 24 fvec_t *vec = new_fvec(hop_size); 15 25 aubio_source_sndfile_t * i = new_aubio_source_sndfile(path, samplerate, hop_size); 26 if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(i); 16 27 aubio_sink_sndfile_t * o = new_aubio_sink_sndfile(outpath, samplerate); 17 28 18 if (!i || !o) { err = -1; goto beach; }29 if (!i || !o) { err = 1; goto beach; } 19 30 20 while ( read == hop_size ){31 do { 21 32 aubio_source_sndfile_do(i, vec, &read); 22 33 aubio_sink_sndfile_do(o, vec, read); 23 } 34 n_frames += read; 35 } while ( read == hop_size ); 36 37 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n", 38 n_frames, source_path, sink_path, samplerate); 24 39 25 40 beach: … … 28 43 del_fvec(vec); 29 44 #else 30 fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n"); 45 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 46 err = 3; 31 47 #endif /* HAVE_SNDFILE */ 32 48 return err; 33 49 } 34 -
tests/src/io/test-source.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 2 #include "utils_tests.h" 3 3 4 char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 5 //char_t *path = "/Users/piem/Downloads/Keziah Jones - Where's Life.mp3"; 6 7 int main(){ 8 uint_t samplerate = 32000; 9 uint_t hop_size = 1024; 10 uint_t read = hop_size; 11 fvec_t *vec = new_fvec(hop_size); 12 aubio_source_t* s = new_aubio_source(path, samplerate, hop_size); 13 14 if (!s) return -1; 15 16 while ( read == hop_size ) { 17 aubio_source_do(s, vec, &read); 18 fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]); 4 int main (int argc, char **argv) 5 { 6 uint_t err = 0; 7 if (argc < 2) { 8 err = 2; 9 PRINT_ERR("not enough arguments\n"); 10 PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]); 11 return err; 19 12 } 20 13 21 del_aubio_source(s); 14 uint_t samplerate = 32000; 15 uint_t hop_size = 256; 16 uint_t n_frames = 0, read = 0; 17 if ( argc == 3 ) samplerate = atoi(argv[2]); 22 18 23 return 0; 19 char_t *source_path = argv[1]; 20 21 fvec_t *vec = new_fvec(hop_size); 22 aubio_source_t* s = new_aubio_source(source_path, samplerate, hop_size); 23 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(s); 24 25 if (!s) { err = 1; goto beach; } 26 27 do { 28 aubio_source_do(s, vec, &read); 29 // fvec_print (vec); 30 n_frames += read; 31 } while ( read == hop_size ); 32 33 beach: 34 del_aubio_source (s); 35 del_fvec (vec); 36 37 return err; 24 38 } 25 -
tests/src/io/test-source_apple_audio_file.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 2 #include "utils_tests.h" 3 3 4 char_t *path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 5 //char_t *path = "/Volumes/moving/moving/photos/gopro2/100GOPRO/GOPR4515.MP4"; 6 7 int main(){ 8 #ifdef __APPLE__ 9 uint_t samplerate = 32000; 10 uint_t hop_size = 1024; 11 uint_t read = hop_size; 12 fvec_t *vec = new_fvec(hop_size); 13 aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(path, samplerate, hop_size); 14 15 if (!s) return -1; 16 17 while ( read == hop_size ) { 18 aubio_source_apple_audio_do(s, vec, &read); 19 fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]); 4 int main (int argc, char **argv) 5 { 6 uint_t err = 0; 7 if (argc < 2) { 8 err = 2; 9 PRINT_ERR("not enough arguments\n"); 10 PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]); 11 return err; 20 12 } 21 13 22 del_aubio_source_apple_audio(s); 14 #if __APPLE__ 15 uint_t samplerate = 32000; 16 uint_t hop_size = 256; 17 uint_t n_frames = 0, read = 0; 18 if ( argc == 3 ) samplerate = atoi(argv[2]); 19 20 char_t *source_path = argv[1]; 21 22 fvec_t *vec = new_fvec(hop_size); 23 aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(source_path, samplerate, hop_size); 24 if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(s); 25 26 if (!s) { err = 1; goto beach; } 27 28 do { 29 aubio_source_apple_audio_do(s, vec, &read); 30 // fvec_print (vec); 31 n_frames += read; 32 } while ( read == hop_size ); 33 34 beach: 35 del_aubio_source_apple_audio (s); 36 del_fvec (vec); 23 37 #else 24 fprintf(stderr, "ERR: aubio was not compiled with aubio_source_apple_audio\n"); 38 err = 3; 39 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 25 40 #endif /* __APPLE__ */ 26 41 return 0; 27 42 } 28 -
tests/src/io/test-source_sndfile.c
rc71aa44 r248da64 1 #include <stdio.h>2 1 #include <aubio.h> 3 #include " config.h"2 #include "utils_tests.h" 4 3 5 char_t *path = "/home/piem/archives/samples/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav"; 4 int main (int argc, char **argv) 5 { 6 uint_t err = 0; 7 if (argc < 2) { 8 err = 2; 9 PRINT_ERR("not enough arguments\n"); 10 PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]); 11 return err; 12 } 6 13 7 int main(){8 int err = 0;9 14 #ifdef HAVE_SNDFILE 10 uint_t samplerate = 8000; 11 uint_t hop_size = 512; 12 uint_t read = hop_size; 15 uint_t samplerate = 32000; 16 uint_t hop_size = 256; 17 uint_t n_frames = 0, read = 0; 18 if ( argc == 3 ) samplerate = atoi(argv[2]); 19 20 char_t *source_path = argv[1]; 21 13 22 fvec_t *vec = new_fvec(hop_size); 14 aubio_source_sndfile_t * s = new_aubio_source_sndfile(path, samplerate, hop_size); 23 aubio_source_sndfile_t * s = new_aubio_source_sndfile(source_path, samplerate, hop_size); 24 if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(s); 15 25 16 26 if (!s) { err = 1; goto beach; } 17 27 18 while ( read == hop_size ){28 do { 19 29 aubio_source_sndfile_do(s, vec, &read); 20 if (read == 0) break;21 fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);22 } 30 // fvec_print (vec); 31 n_frames += read; 32 } while ( read == hop_size ); 23 33 24 34 beach: 25 del_aubio_source_sndfile (s);26 del_fvec (vec);35 del_aubio_source_sndfile (s); 36 del_fvec (vec); 27 37 #else 28 fprintf(stderr, "ERR:aubio was not compiled with aubio_source_sndfile\n");38 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 29 39 err = 2; 30 40 #endif /* HAVE_SNDFILE */ 31 41 return err; 32 42 } 33
Note: See TracChangeset
for help on using the changeset viewer.