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