// Josiah Boning // // trans.c // Code to take Fourier transforms of audio data // Calls FFTW to perform DFT #include "project.h" #include #include double** transforms(double* datas, int size) { int n; int transsize = ITEMS_PER_TRANS/2 + 1; int numtrans = size / ITEMS_PER_TRANS; double** trans = (fftw_complex**) fftw_malloc(numtrans * sizeof(fftw_complex*)); for (n = 0; n < numtrans; n++) { trans[n] = (fftw_complex*) fftw_malloc(transsize * sizeof(fftw_complex)); int t; double* index = datas+n*ITEMS_PER_TRANS; fftw_plan plan = fftw_plan_dft_r2c_1d(ITEMS_PER_TRANS, index, trans[n], FFTW_ESTIMATE); fftw_execute(plan); } return trans; }