feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change
on this file since be8b18b was
be8b18b,
checked in by Paul Brossier <piem@piem.org>, 5 years ago
|
[tests] [filterbank] add get/set power/norm calls
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[addc9ec] | 1 | #include <aubio.h> |
---|
| 2 | |
---|
[158e031] | 3 | int main (void) |
---|
[6938a20] | 4 | { |
---|
[8f68dfb] | 5 | uint_t win_s = 1024; // window size |
---|
| 6 | uint_t n_filters = 13; // number of filters |
---|
[addc9ec] | 7 | |
---|
[6938a20] | 8 | cvec_t *in_spec = new_cvec (win_s); // input vector of samples |
---|
| 9 | fvec_t *out_filters = new_fvec (n_filters); // per-band outputs |
---|
| 10 | |
---|
| 11 | // create filterbank object |
---|
[addc9ec] | 12 | aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); |
---|
| 13 | |
---|
[be8b18b] | 14 | smpl_t power = aubio_filterbank_get_power(o); |
---|
| 15 | smpl_t norm = aubio_filterbank_get_norm(o); |
---|
| 16 | if (aubio_filterbank_set_power(o, power)) { |
---|
| 17 | return 1; |
---|
| 18 | } |
---|
| 19 | if (aubio_filterbank_set_norm(o, norm)) { |
---|
| 20 | return 1; |
---|
| 21 | } |
---|
| 22 | |
---|
[845c435] | 23 | // apply filterbank ten times |
---|
| 24 | uint_t n = 10; |
---|
| 25 | while (n) { |
---|
| 26 | aubio_filterbank_do (o, in_spec, out_filters); |
---|
| 27 | n--; |
---|
| 28 | } |
---|
[addc9ec] | 29 | |
---|
[845c435] | 30 | // print out filterbank coeffs |
---|
| 31 | fmat_t *coeffs; // pointer to the coefficients |
---|
| 32 | coeffs = aubio_filterbank_get_coeffs (o); |
---|
| 33 | fmat_print (coeffs); |
---|
[addc9ec] | 34 | |
---|
[a4c1e86] | 35 | aubio_filterbank_set_coeffs (o, coeffs); |
---|
| 36 | coeffs = aubio_filterbank_get_coeffs (o); |
---|
| 37 | fmat_print (coeffs); |
---|
| 38 | |
---|
[845c435] | 39 | //fvec_print (out_filters); |
---|
[addc9ec] | 40 | |
---|
[845c435] | 41 | // clean up |
---|
[addc9ec] | 42 | del_aubio_filterbank (o); |
---|
[6938a20] | 43 | del_cvec (in_spec); |
---|
| 44 | del_fvec (out_filters); |
---|
[addc9ec] | 45 | aubio_cleanup (); |
---|
| 46 | |
---|
| 47 | return 0; |
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.