metalhobo
04-17-2010, 10:41 PM
Sorry for being such a noob, but I really need some help with WDL fft.
From what I have gathered, if you do a complex DFT with N samples on a function with a defined real part in the time domain and with the time imaginary part zero, in the frequency domain you get the spectrum data in bins 0 through N/2 of both the real and imaginary parts (they are equal, I think) with the frequency of the bins from 0 to N/2 equal to the sample rate times the bin number divided by the FFT size. The bins N/2+1 to N-1 represent the negative frequency spectrum, and for the real part N/2+1 is equal to N/2-1, all the way to N-1 being equal to bin 1.
Using this info which I'm not positively sure of, I tried doing some processing but get no output.
WDL_fft_init();
WDL_fft(fftbuffer, fftbuffersize, false);
//---------------------------------------
//--
for(int p = 0; p < fftbuffersize; p++) //make quieter
{
fftbuffer[p].re /= (fftbuffersize);
fftbuffer[p].im /= (fftbuffersize);
}
//--
for(int x = 0; x <= fftbuffersize/2; x++)
{
double F = (GetSampleRate() * (x)) / (fftbuffersize);
fftbuffer[x].re *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
fftbuffer[x].im *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
}
for(int x = fftbuffersize/2 + 1; x < fftbuffersize; x++)
{
double F = (GetSampleRate() * (fftbuffersize-x)) / (fftbuffersize);
fftbuffer[x].re *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
fftbuffer[x].im *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
}
//---------------------------------------
WDL_fft(fftbuffer, fftbuffersize, true);
The long function of F is just a equalization curve I'm trying to implement.
From what I have gathered, if you do a complex DFT with N samples on a function with a defined real part in the time domain and with the time imaginary part zero, in the frequency domain you get the spectrum data in bins 0 through N/2 of both the real and imaginary parts (they are equal, I think) with the frequency of the bins from 0 to N/2 equal to the sample rate times the bin number divided by the FFT size. The bins N/2+1 to N-1 represent the negative frequency spectrum, and for the real part N/2+1 is equal to N/2-1, all the way to N-1 being equal to bin 1.
Using this info which I'm not positively sure of, I tried doing some processing but get no output.
WDL_fft_init();
WDL_fft(fftbuffer, fftbuffersize, false);
//---------------------------------------
//--
for(int p = 0; p < fftbuffersize; p++) //make quieter
{
fftbuffer[p].re /= (fftbuffersize);
fftbuffer[p].im /= (fftbuffersize);
}
//--
for(int x = 0; x <= fftbuffersize/2; x++)
{
double F = (GetSampleRate() * (x)) / (fftbuffersize);
fftbuffer[x].re *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
fftbuffer[x].im *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
}
for(int x = fftbuffersize/2 + 1; x < fftbuffersize; x++)
{
double F = (GetSampleRate() * (fftbuffersize-x)) / (fftbuffersize);
fftbuffer[x].re *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
fftbuffer[x].im *= (10.46 + 20 * log10(.00008885*F + 12.601/F - (.04292)*sqrt(F) + (.05472)*(log (F))*(log (F)) - .8933));
}
//---------------------------------------
WDL_fft(fftbuffer, fftbuffersize, true);
The long function of F is just a equalization curve I'm trying to implement.