Pages: [1]   Go Down
Author Topic: reacting to specific frequencies  (Read 845 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 3
Posts: 188
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: April 16, 2012, 10:31:25 pm by hilukasz » Logged

for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31428
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10431
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bandpass filters can have high-Q with low order though...
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Edison Member
*
Karma: 6
Posts: leet
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

0
Offline Offline
Shannon Member
****
Karma: 161
Posts: 10431
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

--> 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

Offline Offline
Full Member
***
Karma: 3
Posts: 188
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Offline Offline
Full Member
***
Karma: 3
Posts: 188
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Offline Offline
Full Member
***
Karma: 3
Posts: 188
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31428
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: