1
$\begingroup$

I want to give my Linux robot the ability to locate a sound source and drive towards it. I am reading a paper on sound localization that seems to cover the theory well enough, but I'm at a loss as to how do I implement it. Specifically I would like to know:

  1. How do I connect two microphones to a Linux PC?
  2. How do I record from two microphones simultaneously?
  3. Is there any library of sound processing algorithms (similar to how OpenCV is a library of computer vision algorithms) available for Linux?
$\endgroup$
  • $\begingroup$ Does the sound processing need to be done in software instead of in hardware? To break left/right ambiguity, you would need at least 3 microphones. $\endgroup$ – Ian Jun 2 '14 at 21:41
  • $\begingroup$ I'd rather not use custom hardware if possible. And I'm OK with the robot having to turn and wait for further input in order to resolve any ambiguous cases. $\endgroup$ – xperroni Jun 3 '14 at 0:51
  • $\begingroup$ Even without custom hardware, each audio input will require its own hardware parts - specifically, additional audio processor PCI cards or USB converters. There are numerous open source audio processing applications (many for music mixing) that can record audio from multiple sources. As for the libraries, I am unaware of any. The best solution will likely be a custom, external one. $\endgroup$ – Kurt E. Clothier Oct 18 '15 at 5:45
  • $\begingroup$ Just in case you don't know this little fellow mykeepon.com. $\endgroup$ – Marian Paździoch Jul 19 '16 at 13:31
0
$\begingroup$

The easiest way to connect multiple microphones to a Linux PC is probably to use USB mics. There are myriad brands appealing to all tastes and pocket sizes, check your favorite online marketplace for options.

The PortAudio C++ library (and its Python wrapper, PyAudio) enable cross-platform access to multiple audio devices in either callback or blocking modes. Also see here for a list of audio-processing libraries; specifically, the Open embeddeD Audition System (ODAS) and Time Difference of Arrival (TDOAS) libraries are concerned with determining the direction of sound sources. Additionally, a solution implemented directly on PyAudio is discussed here.

For an integrated solution, the ReSpeaker project builds a variety of microphone arrays that can be controlled through a Python API. See here for how it can be used to determine sound source direction.

| improve this answer | |
$\endgroup$
-1
$\begingroup$

I strongly suggest using a single sound card instead of multiple USB microphones or sound cards. For an application like sound location, it is essential that the samples from the different microphones are recorded at exactly the same time. When using multiple devices, that's next to impossible; they will be slightly out of sync when the recording starts, and because their sample rates are not exactly the same, after some time the time difference becomes substantial. This can be counteracted using adaptive clock synchronization and adaptive rate resampling (see alsaloop for an example) but you will never obtain the precision a single sound card can get you.

So this means either using the stereo input of a standard sound card and dealing with the ambiguities this introduces or using a (USB) sound card that has 4 (microphone) inputs. Also a tip on the microphones: get omnidirectional ones, it makes the samples much easier to compare.

I'm not aware of the kind of the kind of software you're looking for, but directly working with ALSA is not too difficult; ALSA comes with great examples and audio data is relatively easy to work with compared to image data.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, but you'll notice the accepted answer already provides references to the kind of software I was looking for and a recommendation for a multi-mic board. The point about multiple USB mics being problematic is relevant but would be better located at a comment on that answer. $\endgroup$ – xperroni Apr 16 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.