source: tests/src/temporal/test-biquad.c @ 074b41b

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 074b41b was 3684ab4, checked in by Paul Brossier <piem@piem.org>, 12 years ago

tests/src/temporal/: improve examples

  • Property mode set to 100644
File size: 804 bytes
Line 
1#include <aubio.h>
2
3int main ()
4{
5  uint_t win_s = 64; // window size
6
7  // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2`
8  aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
9
10  fvec_t * in_vec  = new_fvec (win_s); // input buffer
11  fvec_t * tmp_vec = new_fvec (win_s); // temporary buffer
12  fvec_t * out_vec = new_fvec (win_s); // output buffer
13
14  uint_t times = 100;
15  while ( times-- ) {
16    // copy to out, then filter out
17    aubio_filter_do_outplace(o, in_vec, out_vec);
18    // in-place filtering
19    aubio_filter_do(o, in_vec);
20    // in-place filtering
21    aubio_filter_do_filtfilt(o, in_vec, out_vec);
22    fvec_print(in_vec);
23  }
24
25  // memory clean-up, one for each new
26  del_aubio_filter(o);
27  del_fvec(in_vec);
28  del_fvec(tmp_vec);
29  del_fvec(out_vec);
30
31  return 0;
32}
Note: See TracBrowser for help on using the repository browser.