2
votes

I Have a bit of a hypothetical question to understand this concept..

Let's say I captured a mono voice clip with 8000hz sample rate, that is 4096 bytes in data.. Feeding the First 512 Bytes(16bit encoding) through an FFT of size 256, will return me 128 values, which i convert to amplitude. So my frequencies for this output are

FFT BIN #1
0: 0*8000/256
1: 1*8000/256
.
.
127: 127*8000/256

So far so good ey? So now i 3584 bytes of unprocessed data left. So i perform another fft of 256 size on 512 bytes of data. And get the same amount of results.. So for this do i again have frequencies of:

FFT BIN #2:
Example1:
0: 0*8000/256
1: 1*8000/256
.
.
127: 127*8000/256

or

FFT BIN #2
Example2:
128: 129*8000/256
139: 130*8000/256
.
.
255: 255*8000/256

Because I would like to plot this amplitude/freq graph. But i don't understand if all these fft bins should be overlapped on the same frequencies like examaple1, or spread out like the second example.

Or am I trying to do something that is completely redundant? Because what i want to accomplish is find the peak amp value of every 30-50ms time frame to use for comparison of other sound files..

If anyone can clear this out for me, I'd be very grateful.

2
The original signal/data should be padded with zeros to allow the transform to take place for the specified radix. If I understand your question, and you are using a recognised library to do the transform, what you are doing looks OK.MoonKnight
@Killercam There are three possibilities in my question. Either I can plot the graph using Example1 or Example2, or I can't plot the graph. Maybe i'm understanding your answer wrong but basically what your saying is "Yes" to a choice questionSal♦
Yes, I am saying you can plot the graph of the entire range of values as the FFT will have taken care of any 'zero' values you have in the bins not filled with data. However, you will need to be weary of edge effect for a data set as small as yours (256), and it maybe neccessary to _window_/wrap your data to avoid spurious periods being picked up by the FFT.MoonKnight
@Killercam So I shall plot according to my Example2? So the formula is: i*Samplerate/fftwindowsize . And i'll just keep increasing 'i' untill no more data is left?Sal♦
I think I understand, you have two time-series (2x30-50ms samples) and you are wanting to compare the results of the FFT for each one. Then you compute the first FFT and plot using the first example above. You then take the next time series and do exactly the same thing, using the same range - you essentally treat the second sampling as an independent time-series/dataset. I hope this helps.MoonKnight

2 Answers

2
votes

Your FFT result bins represent the same set of frequencies in every FFT, as in your example #1, but for different slices of time.

Each FFT will allow you to plot magnitude vs. frequency for about a 12 mS window of time.

You could also vector sum the FFT magnitudes together to get a Welch method PSD (power spectral density) for a longer time frame.

1
votes

If you want to find the peak amp value of every 30-50ms time frame, you just need to plot the amp spectra for signals in each of the time frames.

Also, if you take FFT of 256 samples for each frame, then you should get 129, not 128, frequency components. The first one is the DC component, and the last one is the Nyquist frequency component.