问题
How to measure sound frequency using c# or XNA?? Have any library do it? I want to record sound and identify the frequency of this sound.
回答1:
What do you mean by the frequency? Most sounds, such as voice, music etc. consist of an entire spectrum of frequencies. So what you are essentially looking for is a spectrum analyzer. Such a spectrum can be calculated using the Fast Fourier Transform (FFT). Once you have done that, you can look for the dominant frequency in the spectrum, if there is one.
You might want to check out NAudio and related libraries such as the WPF Sound Visualizer to see how this could be done in C#. There is also a CodeProject article that uses XNA to capture microphone input, and then uses NAudio for further processing. While the example in that article is aimed at Windows Phone, I suppose it should also work in a desktop application with minor modifications.
来源:https://stackoverflow.com/questions/13219365/how-to-measure-sound-frequency-using-c-sharp-or-xna