# FFT calculation suitable, Wav File, Java

If I have a wav file with this characteristics:

• 16bits (2 Bytes per Sample)
• 32000 Sampling Rate
• 60 Seconds
• 2 Channels

then I have:

Samples Per Channel: 32000*60 = 1920000
Samples Per File: 32000*60*2 = 3840000
Bytes Per File: 32000*60*2*2 = 7680000


It's a huge file!

If I change my file Characteristics to:

• 8bits (1 Byte per Sample)
• 8000 Sampling Rate
• 60 Seconds
• 1 Channel

then I have:

Samples Per Channel: 8000*60 = 480000
Samples Per File: 8000*60*1 = 480000
Bytes Per File: 8000*60*1*1 = 480000


If my FFT 2^12 = 4096 or 2^16 = 65536

Do I need to calculate the FFT 480000 times?

Does each how many samples I need to calculate the FFT? (480000 - 65536 = 414464?)

what is the suitable calculus?

How to do to show the spectrum?

To show only one spectrum then FFT of the whole sample could be done.But for better result you could take a window and take FFT. For taking windows of 4096 with 50% overlap then it is equivalent to doing FFT
no of times $$\frac{480000}{4096*0.5}$$ times that is equivalent to $$\frac{Total\hspace{1mm} sample\hspace{1mm} length}{(window \hspace{1mm}length)*(amount\hspace{1mm} of\hspace{1mm} overlap)}$$

• Thank you for your answer, I will have in account! this mean that I need perform 235 FFT's. – Anita Jan 16 '15 at 23:01

If you want to see how the spectrum is changing over time, which is what it sounds like you want to do, then don't do it for every sample - it's too much information and too much calculation.

A rule of thumb I use is to calculate the Fourier Transform every 0.05 seconds, since this is roughly the human ear's temporal resolution. In your case, at a sampling frequency of 8kHz, that's a FT every 400 samples.

You also don't need to use the entire 60 seconds of data for each FT. A common technique here is to do a short-time FT - i.e. each point in time that you want to calculate the spectrum for you use a data 'window' of a certain sample size (e.g. 4096 samples). Also consider multiplying each 'window' of data by a window function to reduce spectral leakage.

• Thank you, Where you obtain the rule "every 0.05 seconds, since this is roughly the human ear's temporal resolution." have you a link o greater information... – Anita Jan 16 '15 at 1:07