feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since a114fe0 was
a114fe0,
checked in by Paul Brossier <piem@piem.org>, 5 years ago
|
[tests] improve aubio_filter coverage
|
-
Property mode set to
100644
|
File size:
1.1 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 | |
---|
[a114fe0] | 12 | if (new_aubio_filter(0)) |
---|
| 13 | return 1; |
---|
| 14 | |
---|
| 15 | if (aubio_filter_get_samplerate(o) != 44100) |
---|
| 16 | return 1; |
---|
| 17 | |
---|
[f7af440] | 18 | if (aubio_filter_set_c_weighting (o, -1) == 0) |
---|
| 19 | return 1; |
---|
[a114fe0] | 20 | |
---|
[f7af440] | 21 | if (aubio_filter_set_c_weighting (0, 32000) == 0) |
---|
| 22 | return 1; |
---|
| 23 | |
---|
[d770fd2] | 24 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 25 | fvec_print (in); |
---|
| 26 | aubio_filter_do (o, in); |
---|
| 27 | fvec_print (in); |
---|
| 28 | del_aubio_filter (o); |
---|
[4e9101e] | 29 | |
---|
[3684ab4] | 30 | o = new_aubio_filter_a_weighting (32000); |
---|
[f7af440] | 31 | |
---|
| 32 | if (aubio_filter_set_a_weighting (o, -1) == 0) |
---|
| 33 | return 1; |
---|
| 34 | if (aubio_filter_set_a_weighting (0, 32000) == 0) |
---|
| 35 | return 1; |
---|
| 36 | |
---|
[d770fd2] | 37 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 38 | fvec_print (in); |
---|
| 39 | aubio_filter_do_outplace (o, in, out); |
---|
| 40 | fvec_print (out); |
---|
| 41 | |
---|
[3684ab4] | 42 | aubio_filter_set_a_weighting (o, 32000); |
---|
[d770fd2] | 43 | in->data[impulse_at] = 0.5; |
---|
[bd1a630] | 44 | fvec_print (in); |
---|
| 45 | aubio_filter_do_filtfilt (o, in, out); |
---|
| 46 | fvec_print (out); |
---|
| 47 | |
---|
| 48 | del_fvec (in); |
---|
| 49 | del_fvec (out); |
---|
[3684ab4] | 50 | del_aubio_filter (o); |
---|
[bd1a630] | 51 | aubio_cleanup (); |
---|
| 52 | |
---|
| 53 | return 0; |
---|
[4e9101e] | 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.