feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since 986131d was
986131d,
checked in by Eduard Müller <mueller.eduard@googlemail.com>, 7 years ago
|
Intel IPP support for aubio
See emuell/aubio/ intel_ipp2 for details please
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | #include <aubio.h> |
---|
2 | #include "utils_tests.h" |
---|
3 | |
---|
4 | int main (int argc, char **argv) |
---|
5 | { |
---|
6 | aubio_init(); |
---|
7 | |
---|
8 | sint_t err = 0; |
---|
9 | |
---|
10 | if (argc < 3) { |
---|
11 | err = 2; |
---|
12 | PRINT_ERR("not enough arguments\n"); |
---|
13 | PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); |
---|
14 | return err; |
---|
15 | } |
---|
16 | |
---|
17 | uint_t samplerate = 0; |
---|
18 | uint_t hop_size = 512; |
---|
19 | uint_t n_frames = 0, read = 0; |
---|
20 | |
---|
21 | char_t *source_path = argv[1]; |
---|
22 | char_t *sink_path = argv[2]; |
---|
23 | |
---|
24 | if ( argc >= 4 ) samplerate = atoi(argv[3]); |
---|
25 | if ( argc >= 5 ) hop_size = atoi(argv[4]); |
---|
26 | if ( argc >= 6 ) { |
---|
27 | err = 2; |
---|
28 | PRINT_ERR("too many arguments\n"); |
---|
29 | return err; |
---|
30 | } |
---|
31 | |
---|
32 | fvec_t *vec = new_fvec(hop_size); |
---|
33 | if (!vec) { err = 1; goto beach_fvec; } |
---|
34 | |
---|
35 | aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size); |
---|
36 | if (!i) { err = 1; goto beach_source; } |
---|
37 | |
---|
38 | if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i); |
---|
39 | |
---|
40 | aubio_sink_t *o = new_aubio_sink(sink_path, samplerate); |
---|
41 | if (!o) { err = 1; goto beach_sink; } |
---|
42 | |
---|
43 | do { |
---|
44 | aubio_source_do(i, vec, &read); |
---|
45 | aubio_sink_do(o, vec, read); |
---|
46 | n_frames += read; |
---|
47 | } while ( read == hop_size ); |
---|
48 | |
---|
49 | PRINT_MSG("read %d frames at %dHz (%d blocks) from %s written to %s\n", |
---|
50 | n_frames, samplerate, n_frames / hop_size, |
---|
51 | source_path, sink_path); |
---|
52 | |
---|
53 | del_aubio_sink(o); |
---|
54 | beach_sink: |
---|
55 | del_aubio_source(i); |
---|
56 | beach_source: |
---|
57 | del_fvec(vec); |
---|
58 | beach_fvec: |
---|
59 | |
---|
60 | aubio_cleanup(); |
---|
61 | |
---|
62 | return err; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.