FFT on on whole file

Hi All,

I’m trying to find a way of plotting the frequency response of an impulse response. I have used dsp::FFT to create real-time graphs before but not over the course of a whole wav file and I can’t seem to get it to work. Is there an easy way of converting a whole file from the time domain to frequency domain that is passing me by?

Thanks!

What have you tried already that isn’t working?

You’ll just need to load the audio data from the file to some sort of buffer - converting to mono if it isn’t already, and assuming you don’t want a separate plot for each channel - and then pad that buffer with some zeros to ensure the buffer is some power of two in size.

In case the length of your IR exceeds your desired frequency resolution, you can split the IR into smaller blocks and transform the sum of them. That way you can create a 1024 point FFT from e.g. a 10second IR

1 Like

I’d rather average (or max) the blocks’ FFT magnitudes. Probably even using a window and 50% overlap (force of habit).
Averaging/summing in the time domain isn’t the same as the magnitude/abs operation is non-linear. For example white noise would come out zero instead of flat if averaged in the time domain.

1 Like

Cheers for the suggestions everyone. I eventually managed to get this to work by using an fft on the whole file at once as I didn’t need tlit to be real-time. I think the biggest issue I had was that I was actually accidentally sending an empty buffer (full of noise)… Small mistakes. I’ll edit this post with the working code later in case anyone is interested.

1 Like

yes, i am