Changeset ed1deac for tests


Ignore:
Timestamp:
Mar 3, 2013, 4:54:28 AM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
e230bb4
Parents:
8f68dfb
Message:

tests/src/temporal/: improve test examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/temporal/test-biquad.c

    r8f68dfb red1deac  
    11#include <aubio.h>
    22
    3 int main(){
    4         /* allocate some memory */
    5         uint_t win_s      = 1024;                       /* window size */
    6         fvec_t * in       = new_fvec (win_s); /* input buffer */
    7         aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
     3int main () {
     4  uint_t win_s = 64; // window size
    85
    9         aubio_filter_do_filtfilt(o,in,in);
    10         aubio_filter_do(o,in);
     6  // create biquad filter with `b0`, `b1`, `b2`, `a1`, `a2`
     7  aubio_filter_t * o = new_aubio_filter_biquad(0.3,0.2,0.1,0.2,0.3);
    118
    12         del_aubio_filter(o);
    13         del_fvec(in);
    14         return 0;
     9  fvec_t * in_vec  = new_fvec (win_s); // input buffer
     10  fvec_t * tmp_vec = new_fvec (win_s); // temporary buffer
     11  fvec_t * out_vec = new_fvec (win_s); // output buffer
     12
     13  uint_t times = 100;
     14  while ( times-- ) {
     15    // copy to out, then filter out
     16    aubio_filter_do_outplace(o, in_vec, out_vec);
     17    // in-place filtering
     18    aubio_filter_do(o, in_vec);
     19    // in-place filtering
     20    aubio_filter_do_filtfilt(o, in_vec, out_vec);
     21    fvec_print(in_vec);
     22  }
     23
     24  // memory clean-up, one for each new
     25  del_aubio_filter(o);
     26  del_fvec(in_vec);
     27  del_fvec(tmp_vec);
     28  del_fvec(out_vec);
     29
     30  return 0;
    1531}
Note: See TracChangeset for help on using the changeset viewer.