Docstoc

trans.c

Document Sample
trans.c Powered By Docstoc
					// // // // //

Josiah Boning trans.c Code to take Fourier transforms of audio data Calls FFTW to perform DFT

#include "project.h" #include <stdlib.h> #include <fftw3.h> 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; }


				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:9
posted:1/3/2010
language:English
pages:1