Member Avatar for computerfreak97

Can anyone give me an example on how to use fft to see weather there is a certain frequency above a certain amplitude in the microphones current sample(s).

I can give you a hint

>>> from scipy.fftpack import fft

and a link.
Now, all you have to do is to obtain an array of sampled data, call the function and get another array, the fft of the first. Next step: understand the meaning of the output.

Member Avatar for computerfreak97

Alright, now what does the output of the fft mean?

You can see it as a frequency analysis of the sound. If your output array is a series of complex numbers, you should compute the array of the squared modulus of the numbers and plot this array. You should obtain a graph where the x axis is the frequency of the sound and the y axix is the energy. So peaks in this graph represent the frequencies which carry the more energy in the incoming signal. The next step si to compute the scale of the frequency axis. It depends on the duration of your sample data. If you can post a plotted result of both the sample and it's fft, it would be great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.