1 #define AUBIO_UNSTABLE 1
4 #include "utils_tests.h"
6 // this file uses the unstable aubio api, please use aubio_sink instead
7 // see src/io/sink.h and tests/src/sink/test-sink.c
9 int main (int argc, char **argv)
15 PRINT_ERR("not enough arguments\n");
16 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
21 uint_t samplerate = 0;
22 uint_t hop_size = 512;
23 uint_t n_frames = 0, read = 0;
25 char_t *source_path = argv[1];
26 char_t *sink_path = argv[2];
27 if ( argc == 4 ) samplerate = atoi(argv[3]);
29 fvec_t *vec = new_fvec(hop_size);
30 aubio_source_sndfile_t * i = new_aubio_source_sndfile(source_path, samplerate, hop_size);
31 if (samplerate == 0 ) samplerate = aubio_source_sndfile_get_samplerate(i);
32 aubio_sink_sndfile_t * o = new_aubio_sink_sndfile(sink_path, samplerate);
34 if (!i || !o) { err = 1; goto beach; }
37 aubio_source_sndfile_do(i, vec, &read);
38 aubio_sink_sndfile_do(o, vec, read);
40 } while ( read == hop_size );
42 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
43 n_frames, source_path, sink_path, samplerate);
46 del_aubio_source_sndfile(i);
47 del_aubio_sink_sndfile(o);
51 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
52 #endif /* HAVE_SNDFILE */