source: tests/src/spectral/test-fft.c @ 7e8b276

sampler
Last change on this file since 7e8b276 was 8076ecd, checked in by Paul Brossier <piem@piem.org>, 8 years ago

tests/src/spectral/test-fft.c: fix default size

  • Property mode set to 100644
File size: 1003 bytes
Line 
1#include <aubio.h>
2
3int main (void)
4{
5  int return_code = 0;
6  uint_t i, n_iters = 100; // number of iterations
7  uint_t win_s = 512; // window size
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
14  if (!fft) {
15    return_code = 1;
16    goto beach;
17  }
18
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;
28  //fvec_print(in);
29
30  for (i = 0; i < n_iters; i++) {
31    // execute stft
32    aubio_fft_do (fft,in,fftgrain);
33    cvec_print(fftgrain);
34
35    // execute inverse fourier transform
36    aubio_fft_rdo(fft,fftgrain,out);
37  }
38
39  // cleam up
40  //fvec_print(out);
41  del_aubio_fft(fft);
42beach:
43  del_fvec(in);
44  del_cvec(fftgrain);
45  del_fvec(out);
46  aubio_cleanup();
47  return return_code;
48}
Note: See TracBrowser for help on using the repository browser.