[islandlabs] Arduino audio detection: bearing of a sound

Burns, William burns at cshl.edu
Wed Apr 28 00:38:13 EDT 2010


re: amplitude:
You're describing a threshold amplitude as a trigger (I think) and not
for determining a bearing?
 
re: sample rate
If my max delay is 5 samples, then (without getting sub-sample accuracy)
I can only resolve 5 different bearings within a 90-degree sweep. that
averages to 18 degrees.. That's not very good.
 
Let's see about the math...
 
Assume 2 microphones w/ a sample rate (and accuracy) of 15,250hz.
Speed of sound is 340.29 meters/s
340.29/15250=.022
Sound travels .022 meters per sample. (a.k.a. 2.2cm) per sample.
If our microphones are .11 meters (a.k.a. 11cm) apart, we get max 5
samples time-difference in our signals.
 
If the time difference is 5 samples, the sound is to our right or left.
If the time difference is 0 samples, the sound is straight ahead. (or
behind)

If the time difference is 1 sample, then the sound is 2.2cm further from
one mic than the other.
If we assume that the sound is coming from "far away" then:
bearing = 90 - arccos(.022/.11)*180/pi
(whisper the secret incantation "help me wolfram alpha" and...)
bearing = 11.537 degrees from center.
 
2 samples: bearing = 23.5782
3 samples: bearing = 36.8699
4 samples: bearing = 53.13
5 samples: bearing = 90
 
(all bets are off if the sound is coming from within 1 meter of the
microphones)
 
Hmm. The accuracy is a little better towards our front-and-center
position:
11.537 degrees vs 36.87 degrees on our left+right.
That's good for a scheme that allows for successive approximation when
orienting a microphone assembly towards a sound.
 
Still, the sampling rate is crucial.
 
-Bill



________________________________

	From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Endolith
	Sent: Tuesday, April 27, 2010 10:12 PM
	To: Island Labs main mailing list
	Subject: Re: [islandlabs] Arduino audio detection
	
	
	On Tue, Apr 27, 2010 at 9:34 PM, Burns, William <burns at cshl.edu>
wrote:
	

		Wow.
		Thanks for posting the code sample, and the waveforms.

	
	I've been meaning to do stuff like this myself anyway.  :)
	 

		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.

	
	That sound like a great idea to me.  Just read in values
continuously until one channel goes past a threshold, then start writing
them to memory, then process it.
	 

		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.

	
	Hmm.  The "naive" cross-correlation method might actually be
faster, since you know the maximum delay.   If you know it's never going
to be delayed more than 5 samples, for instance, you only need to
compute the correlation at -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
	 

		
		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.


	I'm actually having trouble with this.  :)  My algebra and
geometry are rusty.
	 

		You've worked w/ DSPs?


	Never.   :)
	 

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


	I'd love to know this, too.  I only know analog electronics and
the high-level theoretical side of DSP stuff.
	
	
http://chiphacker.com/questions/59/dsp-recommendation-for-beginners
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://freeculture.org/pipermail/list/attachments/20100428/dae615e8/attachment.htm>


More information about the List mailing list