Wave frequency question

Started by
10 comments, last by Prads 12 years, 6 months ago
So now that I think I understand what you want, I guess we can go back to the original question: determining the frequency of a signal.

In all but the very trivial cases where the signal is basically only a tone, either pure or with little overtones, this problem is not well defined unless you have specific requirements of what the frequency of a signal really is. A pure tone contains a single frequency, but anything else will contain multiple frequencies, so there is no the frequency.

Two examples could be the dominant frequency, or the pitch of the signal. The dominant frequency can be determined by the frequency bin from a DFT with the largest magnitude. In this case, you can look for a DFT library, such as fftw. You can also approximate it by the number of zero-crossings (for example, your signals in the pictures, has one zero-crossing; two periods would have three zero-crossings, but you have to be careful with the corner cases at the borders of the buffer). The pitch is the perceived frequency of a signal. Without going into details, it is extremely simplified as the average of all frequencies weighted by their corresponding magnitude. Again, you would need a DFT library to determine the frequencies and magnitudes.

As I said, the problem is not well defined for arbitrary signals, only for very trivial signals that are mostly tonal.
Advertisement
Wow, Thank you so much for all those information. I am going to look into DFT and zero crossing that you mentioned and try to come up with a solution. :)
My first 3D game: Click Here

This topic is closed to new replies.

Advertisement