I want to read in a sound file and get the frequency at each time interval of the signal.
I thought that the best way to approach this is by applying FFT to small chunks of the signal. Because FFT needs to be applied to a periodic function I first apply a hamming window to each chunk, as I understand it the hamming window also reduces spectral leakage because unlike the rectangular window is smoothly decreases the signal amplitude to $0$.
Next I apply the FFT function to each sample in each window and store all the results in a 2D array, each array holds the FFT results for the samples in that window. I then find the frequency which corresponds to each FFT value using this function:
def frequencies_from_fft(num_windows, window_size, df): window_frequencies =  for window in range(num_windows): frequencies =  for i in range(window_size): if i < window_size: frequencies.append(df * i) window_frequencies.append(frequencies) return window_frequencies
dt = 1 / sampling_frequency T = dt * num_samples df = 1 / T
I already halved the
window_size before passing the
window_samples in the function because the spectrum is reflected about the nyquist frequency so I only want half the frequency values.
I am unsure about what effect overlapping the windows has on the 2D array of frequency values for each sample in each window. The more overlap, the more frequency readings are resolved, but do I need to average the frequency values from the samples in the windows that overlap? I'm really confused. In addition, are all frequency values from the window useful, in which case I would have a frequency value for each sample, or do I only extract the dominant frequency from each window, in which case I would have as many frequency readings as the number of windows?