Forums

Sound Source Localization

Started by Plum December 3, 2004
Hi, I'm working on a semester project on sound source localization,
where my aim is to determine the position of the source of a sound
using  two microphones and estimating the time delay of arrival. But,
how do I process the signals from the two microphones???
I mean how do I send the two signals to a PC???
Say i add the two siganls....ow do  i separate them then?
On 2004-12-03 10:51:43 +0100, karthik.ravikanti@gmail.com (Plum) said:

> Hi, I'm working on a semester project on sound source localization, > where my aim is to determine the position of the source of a sound > using two microphones and estimating the time delay of arrival. But, > how do I process the signals from the two microphones??? > I mean how do I send the two signals to a PC??? > Say i add the two siganls....ow do i separate them then?
Why would you want to add the signals if you need two signals for DOA estimation? I'd recommend you use a mic preamp to make a line signal out of your two mic signals and plug that into the line in on your PC sound card (as left and right channel). Then you can start experimenting with the signals by applying your algorithm to the sampled data... -- Stephan M. Bernsee http://www.dspdimension.com
Mr. Stephan....
May be I'm askin too silly a question...
But i m just in my sophomore year...but a sound card has only one input
channel!!

Mr. Bernsee,
What do you mean by line signal??
Can you please consider this to be some sort of tutorial and elaborate
on that?
Also, after sending it to the PC sound card, how do i get the sampled
data?
Do i record it in the form of a wav file?
And then the very first question....how do i then separate the two
channels???
Coz, the PC sound card has only one Mic input....
Also can u suggest any open source libraries for processing wave
files???
Or can i process them using matlab???

"P L U M !" <karthik.ravikanti@gmail.com> wrote in message
news:1102101738.277303.15420@f14g2000cwb.googlegroups.com...
> Mr. Stephan.... > May be I'm askin too silly a question... > But i m just in my sophomore year...but a sound card has only one input > channel!!
Most (all standard?) Windows soundcards have 2 inputs, a microphone input that is mono or one channel and a line-level input, which is stereo or 2 channels. They are usually separate 1/8" phone jacks, often color-coded differently. See http://www.homerecording.com/sound_card_basics.html or http://documents.epanorama.net/documents/pc/soundcard_tips.html (includes diagram) for more information.
Plum wrote:
> Hi, I'm working on a semester project on sound source localization, > where my aim is to determine the position of the source of a sound > using two microphones and estimating the time delay of arrival. But, > how do I process the signals from the two microphones??? > I mean how do I send the two signals to a PC??? > Say i add the two siganls....ow do i separate them then?
You record them as wav files if you like. Matlab will read them in. look up "wavread" command. If it's stereo, it will read in a 2D signal array so you process the 2 channels from there. If it's mono, it returns a 1D array. A good place to look for information on localization is: http://www-engr.sjsu.edu/~duda/Duda.Research.frameset.html Tim
P L U M ! wrote:
 > Mr. Bernsee,
 > What do you mean by line signal??
 > Can you please consider this to be some sort of tutorial and elaborate
 > on that?
 > Also, after sending it to the PC sound card, how do i get the sampled
 > data?
 > Do i record it in the form of a wav file?
 > And then the very first question....how do i then separate the two
 > channels???
 > Coz, the PC sound card has only one Mic input....
 > Also can u suggest any open source libraries for processing wave
 > files???
 > Or can i process them using matlab???
 >


"Line level" refers to the signal level in volts that the input is designed for. 
A dynamic microphone generates a  very low-level signal (e.g. in the micro-volt 
range, up to a few milllivolts), whereas the line output from a mixer, say, will 
be something like .775 volts. Line inputs will generally tolerate a wide range 
of levels, but will not be sensitive enough to deal with a microphone signal.

Alternatively, you may be using capacitor microphones; these require power 
either from a built-in battery, or via "phantom power" supplied by a mic preamp 
or mixer. The power is "phantom" as it is supplied via a balanced line connector 
(three pins), which a capacitor microphone will use, but which a dynamic 
microphone will remain safely unaware of. If all this leaves you bothered and 
bewildered, you will need to find a local audio boffin (or serious home 
recordist), who can show you the ropes so to speak, and help you get set up.

All serious audio microphones will provide a balanced output via an XLR socket 
on the body; ideally you want to run this to a mixer or preamp with similarly 
balanced inputs (again, only the very cheapest mixers will not have this), and 
run as shiort a cable as possoble from the mixer to the unbalanced inout of your 
soundcard. Balanced lines ensure that hum and interference don't get picked up 
and recorded along with your signal.

So, to get two microphone outputs into your soundcard, you will need two preamps 
- these may be standalone devices (usually reack-mounted), or provided as part 
of a mixer. Connect the line outputs from the preamps to the stereo "Line IN" on 
your soundcard. Many cheap soundcards rely on mini stereo jacks for both inputs 
and outputs, while better ones provide individual "phono" sockets. Mixers may 
use phonos, 1/4" jacks, or 3-pin XLR sockets. You will need to find connector 
canbles with the right combination of connectors.

A soundcard of the kind we are considering provides two audio "devices" to the 
OS, one each for recording and playback. More pro-grade cards support multiple 
channels  (e.g. for 5.1 playback), and multiple devices too, such as three 
stereo input devices. In Windows, you can see what the card provides by looking 
at Settings-->Control Panel-->Sound and Multimedia. Top of the range cards may 
use a "breakout" box to keep the audio electronics away from the computer, and 
may even offer balanced inputs. You can get good audio interfaces now that 
connect via USB or Firewire.

To record audio, you ~can~ just use the Windows "Sound recorder" application 
(See under Start-->Programs-->Accessories); but this is really too much of a toy 
for serious use. Better to use proper audio software such as Audacity or 
Wavesurfer (both free, Google with find both easily) , or commercial tools such 
as Cool Edit, SoundForge, WaveLab, etc. If your college is serious about the 
work it wants you to do, in must surely have something on these lines!

I don't use Matlab (not a student, can't afford it); as far as I know it has 
functions for reading and writing soundfiles into vectors for use with the full 
gallimaufry of Matlab functions. Others on this list will be able to tell you 
much more about that.

The canonical free software for reading and writing soundfiles is libsndfile:
http://www.mega-nerd.com/libsndfile/

It is easy with this to write a program that can read a stereo file and write 
two mono ones, and/or do whatever processing you wish in between. Also, consider 
looking at Csound (www.csounds.com), an acoustic compiler that will read 
soundfiles, and provides a huge library of opcodes for time-dmain and frequency 
domain processing. There is a huge variety of free audio software "out there" of 
great power and flexibility, including tools and libraries for frequency domain 
processing and analysis/resynthesis. I suggest if you want to know more, join 
the music-dsp list (http://www.musicdsp.org/); not so many dsp specialists there 
as here (but quite a few nevertheless), but probably a lot more audio/music 
specialists.

As for source separation via two microphones, a paper on this was presented at 
DAFx 2003: http://www.elec.qmul.ac.uk/dafx03/

All the papers are available online (as they are for all DAFx conferences). Look 
for "Real Time Implementation of a Source Separation Algorithm" by  Baeck and 
Zoelzer.

Richard Dobson


"P L U M !" <karthik.ravikanti@gmail.com> wrote 

> Mr. Stephan.... > May be I'm askin too silly a question... > But i m just in my sophomore year...but a sound card has only one input > channel!!
Are you sure it's not stereo? Ciao, Peter K.
Richard Dobson wrote:

> [SNIP] > > I don't use Matlab (not a student, can't afford it); as far as I know it > has functions for reading and writing soundfiles into vectors for use > with the full gallimaufry of Matlab functions. Others on this list will > be able to tell you much more about that. > > [SNIP]
Scilab [ http://scilabsoft.inria.fr/ ] can read/write mono/stereo WAV files and do any math you wish on resulting vector(s). Price is right --- FREE. There is an active newsgroup [ comp.soft-sys.math.scilab ] with helpful individuals. Time delay of responses can be erratic at times. But replys can definitely be worth waiting for. [ For prescriptive grammarians -- apologies participle dangling for ;]
"P L U M !" <karthik.ravikanti@gmail.com> wrote in message news:<1102103073.714970.140290@c13g2000cwb.googlegroups.com>...
> Mr. Bernsee, > What do you mean by line signal?? > Can you please consider this to be some sort of tutorial and elaborate > on that? > Also, after sending it to the PC sound card, how do i get the sampled > data? > Do i record it in the form of a wav file? > And then the very first question....how do i then separate the two > channels??? > Coz, the PC sound card has only one Mic input.... > Also can u suggest any open source libraries for processing wave > files??? > Or can i process them using matlab???
Maybe if you provide a bit more information on your overall requirements it will make the answers easier. For example, is this a 'real time' practical system you're trying to build? or can you get away with just proving the concept? Answering that will answer most of your questions for you. As Stephan mentioned, take a look at preamps, you can get a cheap one for around $60. QN