0
$\begingroup$

I'm a newcomer to signal processing, so forgive my ignorance. I'm working on a project in Python that will play a .wav file and pick out the dominant frequency as it plays. I've found a few examples on the web, but none seem to be accurate for stereo files. It seems like I need to do something with an FFT, but I don't know too much about it. Any help would be greatly appreciated. Thanks!

$\endgroup$
  • $\begingroup$ Please clarify what your question is. Try to be as specific as possible, and also describe what you have already tried. $\endgroup$ – MBaz Jul 4 '15 at 15:19
-1
$\begingroup$

Here's a recent blog post that may be helpful:

https://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/

You want to install numpy (and probably scipy, too), and read up on the Discrete Fourier Transform (DFT; this is what the FFT computes). I'm not that up on Python media packages for the playback part. Python's wave module may be enough.

The algorithm could be as simple as computing the FFT of the last, say, 4096 samples, getting the index of the maximum absolute value, and multiplying by the bin width. Or you can get fancier and use a Hanning window, peak interpolation, overlap processing, and exponential averaging.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.