source:
tests/src/spectral/test-fft.c
@
37a6942
Last change on this file since 37a6942 was 8076ecd, checked in by , 8 years ago | |
---|---|
|
|
File size: 1003 bytes |
Rev | Line | |
---|---|---|
[8701ec3] | 1 | #include <aubio.h> |
[26499e4] | 2 | |
[158e031] | 3 | int main (void) |
[6938a20] | 4 | { |
[3c6f584] | 5 | int return_code = 0; |
[44755a0] | 6 | uint_t i, n_iters = 100; // number of iterations |
[8076ecd] | 7 | uint_t win_s = 512; // window size |
[6938a20] | 8 | fvec_t * in = new_fvec (win_s); // input buffer |
9 | cvec_t * fftgrain = new_cvec (win_s); // fft norm and phase | |
10 | fvec_t * out = new_fvec (win_s); // output buffer | |
11 | // create fft object | |
12 | aubio_fft_t * fft = new_aubio_fft(win_s); | |
13 | ||
[3c6f584] | 14 | if (!fft) { |
15 | return_code = 1; | |
16 | goto beach; | |
17 | } | |
18 | ||
[6938a20] | 19 | // fill input with some data |
20 | in->data[0] = 1; | |
21 | in->data[1] = 2; | |
22 | in->data[2] = 3; | |
23 | in->data[3] = 4; | |
24 | in->data[4] = 5; | |
25 | in->data[5] = 6; | |
26 | in->data[6] = 5; | |
27 | in->data[7] = 6; | |
[44755a0] | 28 | //fvec_print(in); |
[6938a20] | 29 | |
[44755a0] | 30 | for (i = 0; i < n_iters; i++) { |
31 | // execute stft | |
32 | aubio_fft_do (fft,in,fftgrain); | |
33 | cvec_print(fftgrain); | |
[6938a20] | 34 | |
[44755a0] | 35 | // execute inverse fourier transform |
36 | aubio_fft_rdo(fft,fftgrain,out); | |
37 | } | |
[6938a20] | 38 | |
39 | // cleam up | |
[44755a0] | 40 | //fvec_print(out); |
[6938a20] | 41 | del_aubio_fft(fft); |
[3c6f584] | 42 | beach: |
[6938a20] | 43 | del_fvec(in); |
44 | del_cvec(fftgrain); | |
45 | del_fvec(out); | |
46 | aubio_cleanup(); | |
[3c6f584] | 47 | return return_code; |
[437fa65] | 48 | } |
Note: See TracBrowser
for help on using the repository browser.