Talha Iqbal
Posts: 3
Joined: Wed Dec 17, 2014 8:57 am

Sound Direction and Range Finder System

Wed Dec 17, 2014 9:19 am

Hello all,
This is my final year undergrad project. I need help regarding my project.
Its basically about Sound direction and range finder system.
I have to use microphones array to capture sound and for Calculating DOA. I have to use Raspberry Pi. How can I do this , I'm the beginner of Raspberry Pi . so plz any body help me.......

elusiveneutrino
Posts: 1
Joined: Sat Dec 20, 2014 11:38 pm

Re: Sound Direction and Range Finder System

Sun Dec 21, 2014 12:30 am

So if you're doing TDOA you are going to need a microphone array (which you said), which means multiple microphones, but the Raspberry Pi has no built-in audio input of its own (the audio jack is output only). But the latest Pi (B+) has 4 USB 2.0 connectors, and you could hook up a powered USB hub to that, so maybe you think you will get away with using lots of USB microphones - maybe you could record the raw audio from each of them individually into its own file and then process it at your convenience, comparing the difference between the times each microphone "heard" the pulse or, if your prof hates you, you will have a sinusoid and then you get to keep track of the phases as you do your decomposition - hell, I don't know, there are probably other ways of doing that nowadays and I haven't done this stuff in years - this is off the cuff from memory and experience...

Ok, but if you go through the process I've just described, you have to be really careful about what kind of USB audio adapters you use because, chances are, they will each have their own individual timing crystal used to drive not just the USB data interface, but also the sampling rate and, thus, after time, the time-length of the signal measured as well...

It's like back in the day when you wanted to mic your drums right but didn't want to shell out $17,000 for a fancy PCI interface that was soooo proprietary and doomed to early obsolescence that you knew there had to be a better way - so you slapped in 4 Soundblaster AWE 64+ Golds in that hoopty and, voila, your shareware sound editing software could see them all as separate PCM devices..

So you recorded and it looks awesome to see all those tracks getting laid - until you play it back and wtf NONE OF IT MATCHES UP - how is this possible? you literally hit record one time and then it was just... recording - must be a bug in the software?

NOPE - each of those cards has its own crystal, and (this is assuming you don't have any PCI latency issues or whatever on your motherboard) they are all firing at slightly different frequencies and obviously they're nowhere near being in phase - even when they start. This builds up over time so that the tracks become misaligned in time... Until, that is, you get the bright idea to use a SINGLE timing source for all the cards by wiring their crystals together (depending on the individual board there are different ways this might have to be done).

So yeah - long story long, you should use something that is capable of sampling lots of analog inputs in a predictable fashion AND at a reliable and constant rate... Something like an AVR, maybe? Have you heard of arduino? Some of the arduino-compatible boards have 16 or more analog inputs and, you could do something like use either an external timing source or, by making use of its interrupts to sample the inputs, you could get a much more consistent idea of the TDOA of the signal at each input... A little front-line processing on the input and then serialize it up for transfer over to a raspberry pi and you could display the source and distance relative to the array graphically and pretty much in real-time.

If your prof is REQUIRING that you ONLY use the raspberry pi instead of a microcontroller or something capable of RT functionality in combination, perhaps, with other parts, then either he/she is ignorant about the most appropriate hardware for this purpose, or else he/she is trying to teach you a lesson about how much you don't know when it comes to application in "the real world" - then they will gloat over you about how awesome they are and how insignificant and basically offensive you are to them... Ah yes I have been an undergrad research whipping boy myself more than once...

t-F-l;dr: if you have to use an array to do TDOA, then don't use just a raspberry pi alone by itself with a baker's dozen of USB microphones... Instead use the analog pins on (for example) and arduino-compatible board and the interrupts to trigger the sampling (based on, e.g., the input reaching a minimum threshold). Then send those off to the pi for more processing, if you must.

And obviously for the distance part of it you just have another arduino+array with the same setup at a different point in space and then once you have a direction at both arrays your pi can triangulate to get the distance... So yeah I guess having a pi or something central makes sense for the fancy stuff.

lol, only 800 words brolio - you got off easy...

Talha Iqbal
Posts: 3
Joined: Wed Dec 17, 2014 8:57 am

Re: Sound Direction and Range Finder System

Wed Dec 24, 2014 7:02 am

thanks alot sir for helping me so much......
yeah sir i m initially trying on auduino to capture the sound through analog port. i still working on it ....
one thing more can auduino only do all that stuff ? i mean can it calculate the TDOA .....?
bcz i dont know the A,B ,C of Raspberry Pi , and it would take a lot time for me to write a code in linux or python bcz i firstly have to learn those languages..........

Return to “Graphics, sound and multimedia”