[islandlabs] Arduino audio detection

Burns, William burns at cshl.edu
Fri Apr 23 15:39:12 EDT 2010


re: 2 locations:
Yes. I'd be assuming that the sound came from the "front", and not the
"back".
If I can re-orient the microphone "ears" and then hear a second clap
from the same source, I should be able to reliably eliminate one of the
choices, and point a microphone assembly at a sound.
 
re: sample rate w/ 2 micrphones
A low (halved) sample rate could introduce a lot of error/inaccuracies.
 
re: the arduino.cc link:
That's a great example. It should give me agood starting point for the
code... but they're only shooting for 5 directions. (left,right,center
plus the 2 "in-between" bearings)
Maybe that indicates that I should limit my expectaions re: accuracy if
I'm gonna use an arduino for this.
 
-Bill
 
From: john abella
Sent: Friday, April 23, 2010 2:32 PM

Someone made an Arduino powered robot that reacts to (and moves toward)
hand claps -- seems like it would have all the pieces Bill needs ?
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1202056662/0

 


________________________________

	From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Jim Robert
	Sent: Friday, April 23, 2010 2:15 PM
	To: Island Labs main mailing list
	Subject: Re: [islandlabs] Arduino audio detection
	
	
	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. 
	
	
	positioning based on audio required identifying the sounds,
which might be hard to do :/
	
	
	also, for any given sound there are 2 possible locations it
could be if you have 2 mics. You actually need 3 mics to triangulate the
position in a 2d plane and more if you want ti know it's location in 3d
(unlikely that you do)
	
	
	just thinking out loud,
	jim
	
	
	
	On Fri, Apr 23, 2010 at 1:59 PM, Burns, William <burns at cshl.edu>
wrote:
	

		The idea was to use 2 microphones and use the difference
(delay) between the audio signals to determine where the sound was
coming from.
		 
		The basic questions are:
		1) How to interface microphones to an Arduino
		2) How to use software to simultaneously detect sound
coming from 2 microphones and place a time-stamps on the start of a
sound as it reaches each microphone.
		 
		Given 2 *reliable* + accurate timestamps, it's not hard
to do the math to give you a bearing. (or at least 2 possible bearings)
		 
		Ideally, I'd like to mount the 2 microphones on a servo,
so it could point the assembly toward the source of the sound. It'd be
like a head facing itself towards ("looking at") the source of the
sound.
		That way, it would provide a good visual indicator of
where the arduino thought the sound came from, plus  w/ a 2nd
bang/clap/pop, it'd be real easy to eliminate errors, and pinpoint the
direction of the sound.
		 
		Based on endolith's numbers, the accuracy could be
extremely limited at 15Khz sample rate.
		 
		A more difficult problem would be to find a
bang/pop/clap over background noise like people talking, etc.
		 
		-Bill
		 


________________________________

			
			From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Endolith
			
			Sent: Friday, April 23, 2010 1:43 PM 

			To: Island Labs main mailing list
			
			Subject: Re: [islandlabs] Arduino audio
detection
			
			

			It's the sampling frequency that's 15 kHz, so it
can only reproduce up to 7.5 kHz audio.  If the mics are 10 cm apart,
the best-case delay (directly in line with the microphones) is:
			
			(10 centimeters) / speed of sound at sea level =
293.866996 microseconds
			
			and the time between samples is:
			
			1 / (15.25000 kilohertz) = 65.5737705
microseconds
			
			so that's only 4.5 samples difference, and any
other angle is going to be less than this, so if you only have
granularity of one sample, it would be able to detect 8 different
angles, best case?  Separating the microphones would give more accuracy,
but would also make the waveforms less similar, which would decrease the
accuracy. :)
			

		 
		 
		 

________________________________

			From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Jonathan Dahan
			Sent: Friday, April 23, 2010 12:50 PM 

			To: Island Labs main mailing list
			
			Subject: Re: [islandlabs] Arduino audio
detection
			
			
			Actually you need to sample at 2x the frequency
you want to detect, hence CDs sample at 44.1kHz (2x20k, with
20Hz-20,000Hz being the baseline of a normal persons undamaged hearing
range). 

			Since percussive sound is broad spectrum the
frequency doesn't matter as much - just sum up the total energy of the
sound and any loud noise will do. Of course, you can also record your
clapping, and check the spectrum if you want it to match claps
specifically, but its probably not necessary for what you want to do
(I'm assuming a clap-on/clap-off).

			- Jonathan
			
			
			
			On Fri, Apr 23, 2010 at 12:33 PM, Jim Robert
<jim.mixtake at gmail.com> wrote:
			

				15kHz is plenty high enough. That is
near the limit of human hearing (less than an octive). 

				I would say that anything over 1kHz is
plenty, and you probably wouldn't have any trouble as low as 500Hz. (the
'sh' sound is in the 1kHz range) 


				On Fri, Apr 23, 2010 at 11:32 AM, Burns,
William <burns at cshl.edu> wrote:
				

				Wow.
				That's a great link (realtime audio
processing) thanks.
				 
				I don't really need to sample sound,
just detect that it's a loud "pop, clap" etc.
				Hopefully that means my sampling rate
doesn't need to be high.
				 
				Meetings are every wednesday, at 7:00pm,
'though they've been starting a little bit late recently.
				 
				-Bill
				
				 

________________________________

				From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Endolith
				Sent: Wednesday, April 21, 2010 2:58 PM
				To: Island Labs main mailing list
				Subject: Re: [islandlabs] adafruit
videos
				
				
				Cheap omnidirectional electret mics are
probably fine.  They would just need a few resistors and capacitors to
interface, in the simplest case. 
				
	
http://upload.wikimedia.org/wikipedia/commons/5/57/Electret_condenser_mi
crophone_schematic.png
				
				If the level isn't high enough to pick
things up from far away, you can boost it with op-amps first.
				
				I don't know Arduinos too well, but this
page seems to say the sampling frequency can only go up to 15 kHz, which
might limit your accuracy:
				
	
http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio
-processing/
				
				I'd prove the concept with a computer
before trying to do it in an Arduino.
				
				You have meetings every Wed night?
Maybe I should stop being lame and come out to one.  :)
				
				
				
				On Wed, Apr 21, 2010 at 10:52 AM, Burns,
William <burns at cshl.edu> wrote:
				

				Any loud sound. (Pop, bang, etc.)
				I have not chosen microphones.
				 
				-Bill


________________________________

				From: list-bounces at islandlabs.org
[mailto:list-bounces at islandlabs.org] On Behalf Of Endolith
				Sent: Tuesday, April 20, 2010 8:09 PM 

				To: Island Labs main mailing list
				Subject: Re: [islandlabs] adafruit
videos
				

				Have you already chosen the microphones?
What kind are they?
				
				Are you only trying to detect hand
claps, or any kind of impulsive sound, or what?
				
				
				On Mon, Apr 19, 2010 at 10:15 PM, Burns,
William <burns at cshl.edu> wrote:
				

				Wow.
				Thanks for the detailed answer.
				
				I understand the math behind determining
position based on the time difference between received sound signals
hitting the microphones. (and the limitations)
				What I don't know is how to do the
hardware part:
				 connecting the pair of microphones to
an arduino
				and the software part:
				 accurately detecting the front-edge of
the sound envelope on both microphones simultaneously.
				
				-Bill
				
				________________________________
				
				From: list-bounces at islandlabs.org on
behalf of Endolith
				Sent: Sat 4/17/2010 7:06 PM
				To: Island Labs main mailing list
				Subject: Re: [islandlabs] adafruit
videos
				




				       Q1) When building a buck/boost
converter around an arbitrary inductor, How do I measure the energy the
inductor can store? How do I find what size capacitor (or other
components) are required?
				
				
				
				You could ask on http://chiphacker.com/,
too.
				
				
				
				       Q2) How can I use a pair of
microphones to detect the direction a sound (clap?) came from? Would an
arduino work well for this? are there special requirements of the
microphones?
				
				
				
				The microphones should be identical, so
that the received signal is the same in both (frequency response), and
then you could use cross-correlation to determine the delay between
them, which would correspond to angle if the distance to the source is
much greater than the distance between the microphones.
				
	
http://en.wikipedia.org/wiki/Cross-correlation
				
				It could only tell you angle in ... uh
... "one dimension", though.  I'm not sure how to explain.  If you drew
all the points at which the source could be for a given delay, it would
be rotationally symmetric around the axis that passes through the two
microphones.  It can only tell you the angle relative to that axis, but
it cant tell you where the source is up or down.  You could use three
microphones to pin it down to two lines, I think, instead of a surface.
Our heads obviously only have two microphones, but we use reflections
off the folds in the ears to determine location.  I don't know how to
simulate that.
				
				To detect distance, too, you can
estimate by chopping the signal up into STFT frequency components and
estimating the delay and amplitude difference for each individual blip.
:)
				
				

	
_______________________________________________
				List mailing list
				List at islandlabs.org
	
http://freeculture.org/cgi-bin/mailman/listinfo/list
				
				



	
_______________________________________________
				List mailing list
				List at islandlabs.org
	
http://freeculture.org/cgi-bin/mailman/listinfo/list
				
				



	
_______________________________________________
				List mailing list
				List at islandlabs.org
	
http://freeculture.org/cgi-bin/mailman/listinfo/list
				
				



	
_______________________________________________
				List mailing list
				List at islandlabs.org
	
http://freeculture.org/cgi-bin/mailman/listinfo/list
				
				



		_______________________________________________
		List mailing list
		List at islandlabs.org
		http://freeculture.org/cgi-bin/mailman/listinfo/list
		
		


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


More information about the List mailing list