feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since f7af440 was
f7af440,
checked in by Paul Brossier <piem@piem.org>, 5 years ago
|
[test] improve coverage of filters
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[4e9101e] | 1 | #include <aubio.h> |
---|
| 2 | |
---|
[158e031] | 3 | int main (void) |
---|
[bd1a630] | 4 | { |
---|
[d770fd2] | 5 | uint_t win_s = 16; // window size |
---|
| 6 | uint_t impulse_at = win_s / 2; |
---|
[3684ab4] | 7 | fvec_t *in = new_fvec (win_s); // input buffer |
---|
| 8 | fvec_t *out = new_fvec (win_s); // input buffer |
---|
[4e9101e] | 9 | |
---|
[aea235c] | 10 | aubio_filter_t *o = new_aubio_filter_c_weighting (44100); |
---|
[f7af440] | 11 | |
---|
| 12 | if (aubio_filter_set_c_weighting (o, -1) == 0) |
---|
| 13 | return 1; |
---|
| 14 | if (aubio_filter_set_c_weighting (0, 32000) == 0) |
---|
| 15 | return 1; |
---|
| 16 | |
---|
[d770fd2] | 17 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 18 | fvec_print (in); |
---|
| 19 | aubio_filter_do (o, in); |
---|
| 20 | fvec_print (in); |
---|
| 21 | del_aubio_filter (o); |
---|
[4e9101e] | 22 | |
---|
[3684ab4] | 23 | o = new_aubio_filter_a_weighting (32000); |
---|
[f7af440] | 24 | |
---|
| 25 | if (aubio_filter_set_a_weighting (o, -1) == 0) |
---|
| 26 | return 1; |
---|
| 27 | if (aubio_filter_set_a_weighting (0, 32000) == 0) |
---|
| 28 | return 1; |
---|
| 29 | |
---|
[d770fd2] | 30 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 31 | fvec_print (in); |
---|
| 32 | aubio_filter_do_outplace (o, in, out); |
---|
| 33 | fvec_print (out); |
---|
| 34 | |
---|
[3684ab4] | 35 | aubio_filter_set_a_weighting (o, 32000); |
---|
[d770fd2] | 36 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 37 | fvec_print (in); |
---|
| 38 | aubio_filter_do_filtfilt (o, in, out); |
---|
| 39 | fvec_print (out); |
---|
| 40 | |
---|
| 41 | del_fvec (in); |
---|
| 42 | del_fvec (out); |
---|
[3684ab4] | 43 | del_aubio_filter (o); |
---|
[bd1a630] | 44 | aubio_cleanup (); |
---|
| 45 | |
---|
| 46 | return 0; |
---|
[4e9101e] | 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.