2 #include "utils_tests.h"
4 int main (int argc, char **argv)
10 PRINT_ERR("not enough arguments\n");
11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]);
15 uint_t samplerate = 0;
16 uint_t hop_size = 512;
17 uint_t n_frames = 0, read = 0;
19 char_t *source_path = argv[1];
20 char_t *sink_path = argv[2];
22 if ( argc >= 4 ) samplerate = atoi(argv[3]);
23 if ( argc >= 5 ) hop_size = atoi(argv[4]);
26 PRINT_ERR("too many arguments\n");
30 fvec_t *vec = new_fvec(hop_size);
31 if (!vec) { err = 1; goto beach_fvec; }
33 aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
34 if (!i) { err = 1; goto beach_source; }
36 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
38 aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
39 if (!o) { err = 1; goto beach_sink; }
42 aubio_source_do(i, vec, &read);
43 aubio_sink_do(o, vec, read);
45 } while ( read == hop_size );
47 PRINT_MSG("read %d frames at %dHz (%d blocks) from %s written to %s\n",
48 n_frames, samplerate, n_frames / hop_size,
49 source_path, sink_path);