source:
tests/src/spectral/test-fft.c
@
afbd7e7
Last change on this file since afbd7e7 was 5f9df77, checked in by , 14 years ago | |
---|---|
|
|
File size: 1.1 KB |
Rev | Line | |
---|---|---|
[26499e4] | 1 | |
[8701ec3] | 2 | #include <aubio.h> |
[26499e4] | 3 | |
[437fa65] | 4 | int main(){ |
[8701ec3] | 5 | /* allocate some memory */ |
[38e9732] | 6 | uint_t win_s = 8; /* window size */ |
[aea235c] | 7 | fvec_t * in = new_fvec (win_s); /* input buffer */ |
8 | cvec_t * fftgrain = new_cvec (win_s); /* fft norm and phase */ | |
9 | fvec_t * out = new_fvec (win_s); /* output buffer */ | |
10 | in->data[0] = 1; | |
11 | in->data[1] = 2; | |
12 | in->data[2] = 3; | |
13 | in->data[3] = 4; | |
14 | in->data[4] = 5; | |
15 | in->data[5] = 6; | |
16 | in->data[6] = 5; | |
17 | in->data[7] = 6; | |
[8701ec3] | 18 | /* allocate fft and other memory space */ |
[aea235c] | 19 | aubio_fft_t * fft = new_aubio_fft(win_s); |
[8701ec3] | 20 | /* fill input with some data */ |
[38e9732] | 21 | fvec_print(in); |
[8701ec3] | 22 | /* execute stft */ |
23 | aubio_fft_do (fft,in,fftgrain); | |
[38e9732] | 24 | cvec_print(fftgrain); |
[8701ec3] | 25 | /* execute inverse fourier transform */ |
26 | aubio_fft_rdo(fft,fftgrain,out); | |
[38e9732] | 27 | fvec_print(out); |
[8701ec3] | 28 | del_aubio_fft(fft); |
[17fbb7a] | 29 | del_fvec(in); |
30 | del_cvec(fftgrain); | |
[8701ec3] | 31 | del_fvec(out); |
[17fbb7a] | 32 | aubio_cleanup(); |
[437fa65] | 33 | return 0; |
34 | } |
Note: See TracBrowser
for help on using the repository browser.