# Preparations to implement FFT on a wav file (code Java, not Library)

I am making preparations to implement FFT on a wav File.wav Only Java. I'm reluctant to use matlab

I have a File wav stereo, 16 bits.

I need to calculate the FFT, but I have confusing.

My File has a Frequency of 44100, the samples in bytes are 10 minuts ->

(10 minuts)*(60 seconds)*(44100 sample rate)*(2 bytes because are 16 bits)
= 52920000 >~ 52MB per channel.


As you can see it's a big file.

1. Question. Can I to split my file in order to make smaller calculus? If yes, My file can be variable, How I can calculate a moderate lenght working in function of frequency (greater frequency will need greater length FFT).

2. Question. According to FFT the size need to have a lenght = mantissa = Pow(2, Integer). Can I to fill with zeros to reach Pow(2, Integer), Example I have a file with a lenght of 65000 samples, then I will need a FFT with order of 16 -> mantissa = 65536, Can i to fill with zeros the others 536 samples?

Thank you.

• Can you explain the goal of calculating of FFT for whole file? It is possible that you need STFT (Short time Fourier transform) - en.wikipedia.org/wiki/Short-time_Fourier_transform . About your questions. The frequency resolution depend on length of input array. Maximum frequency depend on time step. It is good idea to read textbook second time before implementing FFT. I think there are a lot java FFT library (see for example - stackoverflow.com/questions/3287518/…). Why do you need implement it? (homework?). Oct 11, 2013 at 4:20
• Thank you.__________Can you explain the goal of calculating of FFT for whole file?------> I want to extract the main frequency of Sample, example of sound of piano recorded into file.__________ Why do you need implement it?------>I want to implement something like: WaveSpectra -> s000.tinyupload.com/… But I need Full control of process and my data. Now, I need implement STFT. Oct 11, 2013 at 14:46
• SergV: rework your comment into a proper answer, maybe by elaborating a bit more on why it doesn't make sense to compute the FFT of 10 minutes of audio (concept of stationarity), and maybe give a short overview of the STFT computation process (with references to windowing and zero-padding, maybe a warning about the time/frequency resolution trade-off), you'll get an upvote on that :) Oct 11, 2013 at 16:47
• You can to obtasin WaveSpectra here: mediafire.com/download/uv92kugn52650wo/WaveSpectra.zip May 19, 2014 at 3:15