source: tests/src/temporal/test-filter.c @ f7af440

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretch
Last change on this file since f7af440 was f7af440, checked in by Paul Brossier <piem@piem.org>, 21 months ago

[test] improve coverage of filters

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include <aubio.h>
2
3int main (void)
4{
5  uint_t win_s = 16; // window size
6  uint_t impulse_at = win_s / 2;
7  fvec_t *in = new_fvec (win_s); // input buffer
8  fvec_t *out = new_fvec (win_s); // input buffer
9
10  aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
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
17  in->data[impulse_at] = 0.5;
18  fvec_print (in);
19  aubio_filter_do (o, in);
20  fvec_print (in);
21  del_aubio_filter (o);
22
23  o = new_aubio_filter_a_weighting (32000);
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
30  in->data[impulse_at] = 0.5;
31  fvec_print (in);
32  aubio_filter_do_outplace (o, in, out);
33  fvec_print (out);
34
35  aubio_filter_set_a_weighting (o, 32000);
36  in->data[impulse_at] = 0.5;
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);
43  del_aubio_filter (o);
44  aubio_cleanup ();
45
46  return 0;
47}
Note: See TracBrowser for help on using the repository browser.