2 #include "utils_tests.h"
4 int main (int argc, char **argv)
12 PRINT_ERR("not enough arguments\n");
13 PRINT_MSG("usage: %s <input_path> <output_path> <sample_path> [samplerate]\n", argv[0]);
17 uint_t samplerate = 0; // default is the samplerate of input_path
18 uint_t hop_size = 256;
19 uint_t n_frames = 0, read = 0;
21 char_t *source_path = argv[1];
22 char_t *sink_path = argv[2];
23 char_t *sample_path = argv[3];
24 if ( argc == 5 ) samplerate = atoi(argv[4]);
26 fvec_t *vec = new_fvec(hop_size);
27 aubio_source_t *source = new_aubio_source(source_path, samplerate, hop_size);
28 if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(source);
29 aubio_sink_t *sink = new_aubio_sink(sink_path, samplerate);
31 aubio_sampler_t * sampler = new_aubio_sampler (samplerate, hop_size);
33 aubio_sampler_load (sampler, sample_path);
36 aubio_source_do(source, vec, &read);
37 if (n_frames / hop_size == 10) {
38 aubio_sampler_play ( sampler );
40 if (n_frames / hop_size == 40) {
41 aubio_sampler_play ( sampler );
43 if (n_frames / hop_size == 70) {
44 aubio_sampler_play ( sampler );
46 if (n_frames > 10.0 * samplerate) {
47 aubio_sampler_stop ( sampler );
49 aubio_sampler_do (sampler, vec, vec);
50 aubio_sink_do(sink, vec, read);
52 } while ( read == hop_size );
54 del_aubio_sampler(sampler);
55 del_aubio_source(source);