feature/constantq
Last change
on this file since 45c2c5c was
45c2c5c,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
tests/src/spectral/test-constantq.c: add basic test
|
-
Property mode set to
100644
|
File size:
883 bytes
|
Rev | Line | |
---|
[45c2c5c] | 1 | #include <aubio.h> |
---|
| 2 | #include "utils_tests.h" |
---|
| 3 | |
---|
| 4 | int main (int argc, char **argv) |
---|
| 5 | { |
---|
| 6 | uint_t size = 4096; |
---|
| 7 | uint_t samplerate = 44100; |
---|
| 8 | uint_t bins_per_octave = 24; |
---|
| 9 | uint_t run_times = 10; |
---|
| 10 | uint_t i = 0; |
---|
| 11 | |
---|
| 12 | if ( argc >= 2 ) size = atoi(argv[1]); |
---|
| 13 | if ( argc >= 3 ) samplerate = atoi(argv[2]); |
---|
| 14 | if ( argc >= 4 ) bins_per_octave = atoi(argv[3]); |
---|
| 15 | if ( argc >= 5 ) run_times = atoi(argv[4]); |
---|
| 16 | |
---|
| 17 | cvec_t *fftgrain = new_cvec (size); |
---|
| 18 | aubio_constantq_t * s = new_aubio_constantq (size, samplerate, bins_per_octave); |
---|
| 19 | fvec_t *cqt_output; |
---|
| 20 | if (!s) return 1; |
---|
| 21 | |
---|
| 22 | fftgrain->norm[1] = 1.0; |
---|
| 23 | fftgrain->norm[size/8] = 1.0; |
---|
| 24 | |
---|
| 25 | cqt_output = new_fvec (aubio_constantq_get_numbins(s)); |
---|
| 26 | |
---|
| 27 | while (i < run_times) |
---|
| 28 | { |
---|
| 29 | aubio_constantq_do (s, fftgrain, cqt_output); |
---|
| 30 | i++; |
---|
| 31 | } |
---|
| 32 | fvec_print (cqt_output); |
---|
| 33 | |
---|
| 34 | del_aubio_constantq (s); |
---|
| 35 | del_fvec (cqt_output); |
---|
| 36 | del_cvec (fftgrain); |
---|
| 37 | |
---|
| 38 | return 0; |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.