source: tests/src/spectral/test-filterbank_mel.c

Last change on this file was 158e031, checked in by Paul Brossier <piem@piem.org>, 7 years ago

tests/: add void to prototypes to build with -Wstrict-prototypes

  • Property mode set to 100644
File size: 932 bytes
RevLine 
[afc584d]1#include <aubio.h>
2
[158e031]3int main (void)
[afc584d]4{
[6938a20]5  uint_t samplerate = 16000; // samplerate of signal to filter
[8f68dfb]6  uint_t win_s = 512; // fft size
7  uint_t n_filters = 40; // number of filters
[afc584d]8
[6938a20]9  cvec_t *in_spec = new_cvec (win_s); // input vector of samples
10  fvec_t *out_filters = new_fvec (n_filters); // per-band outputs
11
12  // create filterbank object
[afc584d]13  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
14
[6938a20]15  // assign Mel-frequency coefficients
[afc584d]16  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
17
[845c435]18  // apply filterbank ten times
19  uint_t n = 10;
20  while (n) {
21    aubio_filterbank_do (o, in_spec, out_filters);
22    n--;
23  }
[afc584d]24
[845c435]25  // print out filter coefficients
26  fmat_t *coeffs; // pointer to the coefficients
27  coeffs = aubio_filterbank_get_coeffs (o);
28  fmat_print (coeffs);
[8f68dfb]29
[845c435]30  //fvec_print (out_filters);
[afc584d]31
32  del_aubio_filterbank (o);
[8f68dfb]33  del_cvec (in_spec);
34  del_fvec (out_filters);
[afc584d]35  aubio_cleanup ();
36
37  return 0;
38}
Note: See TracBrowser for help on using the repository browser.