2

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.

Sal
  • 5,129
  • 5
  • 27
  • 53
  • 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 Jul 19 '12 at 10:33
  • @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 question – Sal Jul 19 '12 at 11:02
  • 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 Jul 19 '12 at 11:18
  • @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 Jul 19 '12 at 11:25
  • 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 Jul 19 '12 at 12:03
  • @Killercam Unfortunately that is not what i want. I just want to plot X*30-50ms samples of Same song. Let's say my recording is 4096Bytes. Doing 256 Sample FFT, I will have 8 FFT Results..I Want to plot these 8 FFT's continously to see the amp/freq graph of the whole audio recording. – Sal Jul 19 '12 at 14:05
  • This will not work. Splitting the signal into seperate windows will change the results of the FFT. The temporal representation is lost during an FFT, as you are mapping from (amplitude, t) -> (OtherAmplitude, frequency). The FFT will show you the dominant frequencies in the data you provide it. Why not just FFT the entire time-series? – MoonKnight Jul 19 '12 at 14:45

2 Answers2

2

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.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
1

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.

chaohuang
  • 3,965
  • 4
  • 27
  • 35