Changeset 26499e4 for examples/tests
- Timestamp:
- Jul 21, 2006, 8:35:24 PM (18 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 3eb0cc3
- Parents:
- 45c0f16
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/tests/test-fft.c
r45c0f16 r26499e4 1 #include <stdlib.h> 2 #include <math.h> 3 #include <complex.h> 4 #include <aubio.h> 1 5 2 # include "aubio_priv.h"3 #include <aubio.h> 6 #define NEW_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t)) 7 4 8 5 9 int main(){ … … 14 18 /* allocate fft and other memory space */ 15 19 aubio_fft_t * fft = new_aubio_fft(win_s); /* fft interface */ 16 smpl_t * w = AUBIO_ARRAY(smpl_t,win_s); /* window */20 smpl_t * w = NEW_ARRAY(smpl_t,win_s); /* window */ 17 21 /* complex spectral data */ 18 fft_data_t ** spec = AUBIO_ARRAY(fft_data_t*,channels);22 fft_data_t ** spec = NEW_ARRAY(fft_data_t*,channels); 19 23 for (i=0; i < channels; i++) 20 spec[i] = AUBIO_ARRAY(fft_data_t,win_s);24 spec[i] = NEW_ARRAY(fft_data_t,win_s); 21 25 /* initialize the window (see mathutils.c) */ 22 26 aubio_window(w,win_s,aubio_win_hanningz); … … 35 39 for (i=0; i < channels; i++) { 36 40 for (j=0; j<win_s/2+1; j++) { 37 spec[i][j] = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j]));41 spec[i][j] = cexp(I*aubio_unwrap2pi(fftgrain->phas[i][j])); 38 42 spec[i][j] *= fftgrain->norm[i][j]; 39 43 } … … 44 48 del_fvec(out); 45 49 del_cvec(fftgrain); 46 AUBIO_FREE(w);50 free(w); 47 51 del_aubio_fft(fft); 48 52 for (i=0; i < channels; i++) 49 AUBIO_FREE(spec[i]);50 AUBIO_FREE(spec);53 free(spec[i]); 54 free(spec); 51 55 aubio_cleanup(); 52 56 return 0;
Note: See TracChangeset
for help on using the changeset viewer.