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]\n", argv[0]);
16 uint_t samplerate = 44100;
17 uint_t hop_size = 512;
18 uint_t n_frames = 0, read = 0;
20 char_t *source_path = argv[1];
21 char_t *sink_path = argv[2];
22 if ( argc == 4 ) samplerate = atoi(argv[3]);
24 fvec_t *vec = new_fvec(hop_size);
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);
27 aubio_sink_sndfile_t * o = new_aubio_sink_sndfile(outpath, samplerate);
29 if (!i || !o) { err = 1; goto beach; }
32 aubio_source_sndfile_do(i, vec, &read);
33 aubio_sink_sndfile_do(o, vec, read);
35 } while ( read == hop_size );
37 PRINT_MSG("%d frames read from %s\n written to %s at %dHz\n",
38 n_frames, source_path, sink_path, samplerate);
41 del_aubio_source_sndfile(i);
42 del_aubio_sink_sndfile(o);
45 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n");
47 #endif /* HAVE_SNDFILE */