Hello I would like to recognize a sound (beep) that is in a wav file and compare it with a direct sound! how to do it ?
Hello I would like to recognize a sound (beep) that is in a wav file and compare it with a direct sound! how to do it ?
I have done that before – recognize a tone in real time using FFT's. I believe I may have used Klaus' FFT library or I may have used my own. Search this Forum for "Canalrun FFT", maybe I uploaded it, I don't remember.
I captured a short period, may be one half second, of raw, real-time microphone data, performed a 16 point FFT, computed the square root of sum magnitude squared, and checked the bin corresponding to the tone frequency that I was expecting for a power level above the computed background noise. Doing this requires a little signal processing knowledge, but it's not too bad.
I used the first FFT that detected the tone and counted the number of continuous FFT's that contained the tone to estimate the tone duration.
It can be done on a fairly recent device. I believe I was using hardware comparable to an LG G2 to do this.
Barry.
I did a quick search, You didnt post anything of yours anywhere. Could you? I need something similar to detect a coach whistle which actually has 3 different frequencies an a beat frequency created by the 3 coupled together.
I couldn't find it online in these forums either. I did this about four years ago, the software is on another computer, and unfortunately long gone.
Thinking about what I did:
I capture data from the microphone guided by one of Erels examples. I believe you are able to specify the number of samples you want and you will receive an event with a buffer containing those samples. I chose some power of two number of points – probably 1024. Once I have the buffer of points I add the buffer to a global list.
I had a timer firing at somewhere between one and 5 ms. In the timer routine I would check if the global list contained a buffer. If it had a buffer I would do multiple sliding, probably 128 point, FFT's on the data array. I would compute the square root of the real and imaginary sum of magnitude squares and look for the tones within the resulting bins.
The only tricky part is that the number of audio samples specifies a time constraint. If you're using 44K samples per second and 1024 points, the time constraint is about 1024/44,000 = about 20 ms. You need to complete the timer FFT computations within this 20 ms.
I did get this working, but it did take some testing and tweaking.
Barry.
Whew. My brain is fried. That one went over my head like a fart in a fan factory.
I'm not a math guy so its one of those projects that just continue to sit on the backburner. I appreciate the details though.
I had a deeper look into your problem, the attached project is a demonstrator to your request.
...
In the first line we have 44100, which is the sampling frequency and I put it in the table only for comparison, it cannot be used for FFT calculations, the number of samples, for FFT, must be a power of 2.
I found that the number of 8192 time signal samples is a good compromise.
Acquisition time less than 200ms and a frequency resolution about 5 Hz.
What exactly is the problem?Do you think there is any reason why I can not select i.e. 22050/512 or 44100/1024?