3
$\begingroup$

I'm experimenting with a 30 Hz sine wave and I want to extract the frequencies of this, and have implemented the algorithm to do so. This gives a correct reading, well, gives 29 Hz.

I'm now wanting to compute the algorithm for an STFT. So, for this, I use NFFT = 256 with an overlap of 128, using the Hanning Window function.

This gives me a series of bins which I can then calculate the frequency formula on. However, when I graph this, the results do not seem right, for some reason:

enter image description here

I mean, it might just be me in thinking that the results do not look right, however, if they are, why would the results be this? I just don't get it.

For example, I was expecting when the energy is low, the result would be low and thus when the energy was high, the result would be high. Let me give you another example on a more structured sound file.

Sample rate = 12000 
NFFT = 256 
Overlap = 128

enter image description here

And the STFT output for this is below:

enter image description here

Am I doing something wrong here, or, do these results look ok?

$\endgroup$
5
  • 3
    $\begingroup$ 1. Your plots have no axis labels or titles, so it's more work for us in trying to help you. 2. You don't show any code, so how are we supposed to know if your code is correct? 3. Your title is misleading, the frequency bins are associated with the energy. $\endgroup$
    – porten
    Commented Jan 12, 2014 at 23:04
  • $\begingroup$ @porten - thanks for your reply. I'll update this tomorrow. I didn't change the title.. Also are you saying these results are therefore right or wrong? since you said "the frequency bins are associated with the energy".. I noticed (because this is my own implenentation; the max freq was 6000 whereas my results show 3..? $\endgroup$
    – Phorce
    Commented Jan 12, 2014 at 23:09
  • 1
    $\begingroup$ Your X axis, the number of bins, don't match half the stated length of your FFTs. $\endgroup$
    – hotpaw2
    Commented Jan 13, 2014 at 4:40
  • $\begingroup$ If NFFT = 256 for real data, then you should only plot 128 bins or points. $\endgroup$
    – hotpaw2
    Commented Jan 13, 2014 at 15:28
  • $\begingroup$ I'm having trouble following your question for the reasons listed by @porten, but here's a link to a blog post I wrote for people with similar problems: blog.bjornroche.com/2012/07/… $\endgroup$ Commented Jan 13, 2014 at 16:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.