Go Down

Topic: reacting to specific frequencies (Read 1 time)previous topic - next topic

hilukasz

Apr 17, 2012, 05:12 amLast Edit: Apr 17, 2012, 05:31 am by hilukasz Reason: 1
is there a direction someone can push me on how to build a circuit that would react to a certain sound like a clap?

was thinking of using something like this with a filter: http://www.sparkfun.com/products/9964

I have means of recording and analyzing a sound so I can find what frequency the sound is around at least. I was thinking of building a hardware or digital band-pass filter (not even sure how I would do that honestly, hah) that would only trigger a signal to arduino if that frequency was met.

I've seen suggestions in using a UM3763: http://www.chinaicmart.com/series-UM3/UM3763.html

This is only my guess at how to do this. maybe there is a better way? any ideas?
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Grumpy_Mike

#1
Apr 17, 2012, 05:55 am
The main problem is that a sound like a clap is a complex waveform and is not just one frequency. That makes it difficult to recognise.
For getting at the frequency content of a waveform look to use a FFT. However that gives you in effect a list of all the frequencies and their relitave strengths. Recognising a specific sound is a lot more complex because its FFT will change over time.
While you can implement a band pass filter digitally it will not be a very high order filter due to the lack of processing power of the arduino.

MarkT

#2
Apr 17, 2012, 09:25 am
Bandpass filters can have high-Q with low order though...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

sbright33

#3
Apr 17, 2012, 07:16 pm
http://www.sparkfun.com/products/10024

That might help you, but he's right, claps are difficult to differentiate from other complex high frequency waveforms.  If all the others are low pure tones and less brief than it will be easy!  Read the datasheet within my link above.

MarkT

#4
Apr 17, 2012, 07:25 pm
Implementing an envelope detector might help with capturing claps - the envelop is pretty distinctive.  Basically rapid attack and no noticeable duration before decay.  The only frequency-dependent part is choosing a time-constant for the decay - wants to be short but long enough to not count a single clap as several events.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Docedison

#5
Apr 17, 2012, 10:07 pm
Operating under the "Assumption" that microphone placement relative to the event is constant... a VERY big "Assumption" then just measure the rise time of the envelope. A properly configured comparator will return a measurable rectangular pulse and the pulse duration (short) could indicate a hand clap, unfortunately so would a book dropped on a hard surface or any other loud impact noise.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

hilukasz

#6
May 03, 2012, 01:13 pm

The main problem is that a sound like a clap is a complex waveform and is not just one frequency. That makes it difficult to recognise.
For getting at the frequency content of a waveform look to use a FFT. However that gives you in effect a list of all the frequencies and their relitave strengths. Recognising a specific sound is a lot more complex because its FFT will change over time.
While you can implement a band pass filter digitally it will not be a very high order filter due to the lack of processing power of the arduino.

I understand they are complex frequency but everything has a fundamental or a dominant freq, so you can basically search for a specific freq something likes to resonate at. I have done this purely digitally, no problem. It's doing it with an arduino that I am stuck on.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

hilukasz

#7
May 03, 2012, 01:14 pm

http://www.sparkfun.com/products/10024

That might help you, but he's right, claps are difficult to differentiate from other complex high frequency waveforms.  If all the others are low pure tones and less brief than it will be easy!  Read the datasheet within my link above.

ooo, this is awesome! something I will definitely try out. thanks.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

hilukasz

#8
May 03, 2012, 01:17 pm

Implementing an envelope detector might help with capturing claps - the envelop is pretty distinctive.  Basically rapid attack and no noticeable duration before decay.  The only frequency-dependent part is choosing a time-constant for the decay - wants to be short but long enough to not count a single clap as several events.

that is genius! never thought about adding envelope detector. any suggestions on where I should go to learn about this? assuming this would be done software side. I might even be able to do redundant tests, envelope, freq, pitch etc.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Grumpy_Mike

#9
May 03, 2012, 03:30 pm
Quote
but everything has a fundamental or a dominant freq, so you can basically search for a specific freq something likes to resonate at.

No that is not correct, especially with impulse sounds like a clap. If you take the FFT you will see the distribution of frequencies changes rapidly with time, so their is no one signature spectrum for the sound.
An envelop detector is an example of parameter extraction, which is more likely to succeed than a full frequency analysis. Another popular parameter is zero crossing timing.

Once you have these parameters extracted at many points at during the sound, you can then compare them to a template or standard sound. As you are comparing many values with many values the answer is not a simple yes or no, it is more like a probability. You then set a threshold on a probability that you want to use in order to differentiate a clap from some other percussive sound you might pick up. One way of comparing templates is to use an cross-correlation:-
http://en.wikipedia.org/wiki/Cross-correlation

Go Up