1 #define AUBIO_UNSTABLE 1
3 #include "utils_tests.h"
5 // this file uses the unstable aubio api, please use aubio_sink instead
6 // see src/io/sink.h and tests/src/sink/test-sink.c
8 int main (int argc, char **argv)
14 PRINT_ERR("not enough arguments\n");
15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
20 uint_t samplerate = 0;
21 uint_t hop_size = 512;
22 uint_t n_frames = 0, read = 0;
24 char_t *source_path = argv[1];
25 char_t *sink_path = argv[2];
26 if ( argc == 4 ) samplerate = atoi(argv[3]);
28 fvec_t *vec = new_fvec(hop_size);
29 aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
30 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
31 aubio_sink_wavwrite_t *o = new_aubio_sink_wavwrite(sink_path, samplerate);
33 if (!i || !o) { err = 1; goto beach; }
36 aubio_source_do(i, vec, &read);
37 aubio_sink_wavwrite_do(o, vec, read);
39 } while ( read == hop_size );
41 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
42 n_frames, source_path, sink_path, samplerate);
46 del_aubio_sink_wavwrite(o);
50 PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n");
51 #endif /* HAVE_WAVWRITE */