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

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since aa15080 was a114fe0, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[tests] improve aubio_filter coverage

  • Property mode set to 100644
File size: 1.1 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 (new_aubio_filter(0))
13    return 1;
14
15  if (aubio_filter_get_samplerate(o) != 44100)
16    return 1;
17
18  if (aubio_filter_set_c_weighting (o, -1) == 0)
19    return 1;
20
21  if (aubio_filter_set_c_weighting (0, 32000) == 0)
22    return 1;
23
24  in->data[impulse_at] = 0.5;
25  fvec_print (in);
26  aubio_filter_do (o, in);
27  fvec_print (in);
28  del_aubio_filter (o);
29
30  o = new_aubio_filter_a_weighting (32000);
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
37  in->data[impulse_at] = 0.5;
38  fvec_print (in);
39  aubio_filter_do_outplace (o, in, out);
40  fvec_print (out);
41
42  aubio_filter_set_a_weighting (o, 32000);
43  in->data[impulse_at] = 0.5;
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);
50  del_aubio_filter (o);
51  aubio_cleanup ();
52
53  return 0;
54}
Note: See TracBrowser for help on using the repository browser.