source: tests/src/spectral/test-filterbank_mel.c @ 845c435

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since 845c435 was 845c435, checked in by Paul Brossier <piem@piem.org>, 6 years ago

tests/src/spectral/test-filterbank*: improve comments, print coeffs

  • Property mode set to 100644
File size: 928 bytes
Line 
1#include <aubio.h>
2
3int main ()
4{
5  uint_t samplerate = 16000; // samplerate of signal to filter
6  uint_t win_s = 512; // fft size
7  uint_t n_filters = 40; // number of filters
8
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
13  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);
14
15  // assign Mel-frequency coefficients
16  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);
17
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  }
24
25  // print out filter coefficients
26  fmat_t *coeffs; // pointer to the coefficients
27  coeffs = aubio_filterbank_get_coeffs (o);
28  fmat_print (coeffs);
29
30  //fvec_print (out_filters);
31
32  del_aubio_filterbank (o);
33  del_cvec (in_spec);
34  del_fvec (out_filters);
35  aubio_cleanup ();
36
37  return 0;
38}
Note: See TracBrowser for help on using the repository browser.