[islandlabs] Arduino audio detection
burns at cshl.edu
Tue Apr 27 21:34:49 EDT 2010
Thanks for posting the code sample, and the waveforms.
I never thought of using amplitude to get an angle. I was always
thinking of using the delay between signals.
I guess an arduino could endlessly copy stereo sound into a 1-second
revolving buffer, and then if a clap is detected, the arduino can stop
recording, and spend as much time as it needs analyzing what's in it's
buffer to determine a delay/phase_difference.
Still, accuracy may be poor.
I don't want to overstate my expertise (it's minimal)
I haven't connected a microphone to an arduino, I've never worked w/
FFTs, and I don't know if they're commonly available on/for the arduino.
The one thing I think I could handle easily is the math that determines
the parabola that a sound source would be on, given the time difference,
and distance between received signals.
You've worked w/ DSPs? Do you think there's one that would be easy to
write code for, and that wouldn't require a lot of hardware support
(like a microcontroller?)
From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Endolith
Sent: Tuesday, April 27, 2010 8:28 PM
To: Island Labs main mailing list
Subject: Re: [islandlabs] Arduino audio detection
On Fri, Apr 23, 2010 at 1:59 PM, Burns, William <burns at cshl.edu>
Based on endolith's numbers, the accuracy could be
extremely limited at 15Khz sample rate.
Yeah, if you put the microphones far apart it will give more
The problem with trying to do it in a simple way like a
threshold is that the actual waveforms are very long and complex
compared to the delay between them. They don't just instantly jump to a
value you can trigger at. I did a little test the other day, using
computer at 48 kHz:
You can see how the two waves are similar in shape, but not
exactly the same, which is why cross-correlation works well and a
threshold wouldn't be very reliable. Also, if you do a
cross-correlation, you can get sub-sample accuracy by interpolating when
you find the peak:
I'm not sure how to do it in real time or if an Arduino can do
it, though. I guess you'd have to process chunks at a time or
On Fri, Apr 23, 2010 at 2:15 PM, Jim Robert
<jim.mixtake at gmail.com> wrote:
using 2 mics might also half your sampling rate. this is
based on crappy knowledge, but if it takes time to read the analog input
it is possible.
I'm just getting that number from the link:
"When an interrupt takes place the analog input of channel 0 and
1 is alternately sampled so that the audiosignal is sampled with an
effective rate of 15.250 Khz."
On Fri, Apr 23, 2010 at 2:31 PM, john abella <john at abella.net>
I know I saw some links posted earlier, but this one
seems particularly fitting? Not sure if it was already posted.
Someone made an Arduino powered robot that reacts to
(and moves toward) hand claps -- seems like it would have all the pieces
Bill needs ?
Hmmm.. It looks like they're using amplitude differences
instead of delay, and just for a crude estimation of direction, not a
If I remember correctly from last time I was messing around with
this, the phase difference places the source on a hyperbola
(http://en.wikipedia.org/wiki/Multilateration), and the amplitude ratio
places it on an ellipse or something?, so you can get a location by
finding the intersection of the two.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the List