DSPRelated.com
Forums

Is there an Open Source Echo Cancellation module available?

Started by Robert Oschler March 30, 2005
Hello,

I am the lead programmer for the SourceForge based Robosapien Dance Machine
project, released under the GPL license:

http://sourceforge.net/projects/robodance

I just added voice recognition capability to the program using another
SourceForge open source project, the Sphinx 3.5 speech recognition engine:

http://sourceforge.net/projects/cmusphinx

The Robosapien robot is a very loud robot which, using the average speech
detection/silence detection algorithms, will trigger a lot of "false"
recognition activity on the microphone; even on a decent headset microphone.
At about 3 feet away he still pumps out healthy 60+ decibels of sound which
left unchecked, triggers the microphone frequently and subsequently
generating false recognition results.

I managed to do a very effective job at eliminating the problem using some
tricky volume thresholding, but in the future I'd like to go a step further
and use echo cancellation techniques to remove the robot's "voice".

It would be very simple for me to record everything the robot says, each to
separate audio file.  Since my program is controlling the robot, I always
know exactly what he is saying.  Therefore, I should be able to take the
appropriate pre-recorded audio file of his voice and remove it from the
incoming microphone signal using spectral subtraction techniques.

But since I am not a DSP expert (that's an understatement), I'd be far
better off finding some open source code that I could include in the project
to perform the spectral subtraction.

I'd need the module to be able to take a pre-recorded file and create a
filter that would remove the audio in that file, from an audio signal in
real-time (live microphone input).  I would need that filter to be able to
adapt to differences between the audio contained in the pre-recorded file,
and the way that audio will sound coming in on a different microphone than
the one the audio was originally recorded with, and at a different distance
from the microphone as the original (pre-recorded file versus actual audio
coming in from a new microphone).

Does anyone know of something I could use?  I am a veteran, C/C++/Object
Pascal programmer and can even handle some assembler if needed.

Thank you if you have read this far, I know it's a long message. :)

Thanks,

-- 
Thanks,
Robert
http://www.evosapien.com/
Robosapien Hacks & Tricks


Robert Oschler wrote:
> Hello, > > I am the lead programmer for the SourceForge based Robosapien Dance Machine > project, released under the GPL license: > > http://sourceforge.net/projects/robodance > > I just added voice recognition capability to the program using another > SourceForge open source project, the Sphinx 3.5 speech recognition engine: > > http://sourceforge.net/projects/cmusphinx > > The Robosapien robot is a very loud robot which, using the average speech > detection/silence detection algorithms, will trigger a lot of "false" > recognition activity on the microphone; even on a decent headset microphone. > At about 3 feet away he still pumps out healthy 60+ decibels of sound which > left unchecked, triggers the microphone frequently and subsequently > generating false recognition results. > > I managed to do a very effective job at eliminating the problem using some > tricky volume thresholding, but in the future I'd like to go a step further > and use echo cancellation techniques to remove the robot's "voice". > > It would be very simple for me to record everything the robot says, each to > separate audio file. Since my program is controlling the robot, I always > know exactly what he is saying. Therefore, I should be able to take the > appropriate pre-recorded audio file of his voice and remove it from the > incoming microphone signal using spectral subtraction techniques. > > But since I am not a DSP expert (that's an understatement), I'd be far > better off finding some open source code that I could include in the project > to perform the spectral subtraction. > > I'd need the module to be able to take a pre-recorded file and create a > filter that would remove the audio in that file, from an audio signal in > real-time (live microphone input). I would need that filter to be able to > adapt to differences between the audio contained in the pre-recorded file, > and the way that audio will sound coming in on a different microphone than > the one the audio was originally recorded with, and at a different distance > from the microphone as the original (pre-recorded file versus actual audio > coming in from a new microphone). > > Does anyone know of something I could use? I am a veteran, C/C++/Object > Pascal programmer and can even handle some assembler if needed. > > Thank you if you have read this far, I know it's a long message. :) > > Thanks,
What makes you think it's easy? Imagine a robot swimmer in a pool. Since you programmed it, you know its every move. In theory, you could generate antiwaves that would create calm water wherever you want it. Of course, you would need to account for reflection and diffraction from the sides and objects in the pool. Lets take a different scenario. You have two microphones in a room and a speaker who is not always in the same place. The microphones, although the same model, are not identical; nor do they receive precisely the same acoustic signal. What would need to happen in order for the output of one of them to cancel the other's? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
What is the relationship between the robot's loudspeaker and the microphone?  Is
it fixed or dynamic?  I'm guessing the microphone is fixed but the robot's
loudspeaker is going to be moving.  This makes it harder for an adaptive
algorithm to work well as it is constantly having to adapt.

My first thought would be a much simpler solution:  turn off speech recognition
while that loud robot is "talking"!

FWIW, I don't know of any open source echo cancellation code.  I'm aware of a
few commercial products.

"Robert Oschler" <no-mail-please@nospam.com> wrote in message
news:gsGdnb7MOfFGl9bfRVn-hw@adelphia.com...
> Hello, > > I am the lead programmer for the SourceForge based Robosapien Dance Machine > project, released under the GPL license: > > http://sourceforge.net/projects/robodance > > I just added voice recognition capability to the program using another > SourceForge open source project, the Sphinx 3.5 speech recognition engine: > > http://sourceforge.net/projects/cmusphinx > > The Robosapien robot is a very loud robot which, using the average speech > detection/silence detection algorithms, will trigger a lot of "false" > recognition activity on the microphone; even on a decent headset microphone. > At about 3 feet away he still pumps out healthy 60+ decibels of sound which > left unchecked, triggers the microphone frequently and subsequently > generating false recognition results. > > I managed to do a very effective job at eliminating the problem using some > tricky volume thresholding, but in the future I'd like to go a step further > and use echo cancellation techniques to remove the robot's "voice". > > It would be very simple for me to record everything the robot says, each to > separate audio file. Since my program is controlling the robot, I always > know exactly what he is saying. Therefore, I should be able to take the > appropriate pre-recorded audio file of his voice and remove it from the > incoming microphone signal using spectral subtraction techniques. > > But since I am not a DSP expert (that's an understatement), I'd be far > better off finding some open source code that I could include in the project > to perform the spectral subtraction. > > I'd need the module to be able to take a pre-recorded file and create a > filter that would remove the audio in that file, from an audio signal in > real-time (live microphone input). I would need that filter to be able to > adapt to differences between the audio contained in the pre-recorded file, > and the way that audio will sound coming in on a different microphone than > the one the audio was originally recorded with, and at a different distance > from the microphone as the original (pre-recorded file versus actual audio > coming in from a new microphone). > > Does anyone know of something I could use? I am a veteran, C/C++/Object > Pascal programmer and can even handle some assembler if needed. > > Thank you if you have read this far, I know it's a long message. :) > > Thanks, > > -- > Thanks, > Robert > http://www.evosapien.com/ > Robosapien Hacks & Tricks > >
"Jon Harris" <goldentully@hotmail.com> wrote in message
news:3b0rgnF6d12jsU1@individual.net...
> What is the relationship between the robot's loudspeaker and the
microphone? Is
> it fixed or dynamic? I'm guessing the microphone is fixed but the robot's > loudspeaker is going to be moving. This makes it harder for an adaptive > algorithm to work well as it is constantly having to adapt. > > My first thought would be a much simpler solution: turn off speech
recognition
> while that loud robot is "talking"! > > FWIW, I don't know of any open source echo cancellation code. I'm aware
of a
> few commercial products. > > "Robert Oschler" <no-mail-please@nospam.com> wrote in message
Jon, - The robot's loudspeaker will be in constant movement and so is the microphone since it most likely will be a headset mic. - Can't turn off speech recognition while the robot is talking. It is designed such that most of the move it makes are accompanied by his voice. Since I am using voice recognition to control his movements, and he talks when he moves, I'm stuck with this environment (and so are all my users).
"Jerry Avins" <jya@ieee.org> wrote in message
news:5r2dnSKXY6nKrdbfRVn-pw@rcn.net...
> > What makes you think it's easy? Imagine a robot swimmer in a pool. Since > you programmed it, you know its every move. In theory, you could > generate antiwaves that would create calm water wherever you want it. Of > course, you would need to account for reflection and diffraction from > the sides and objects in the pool. > > Lets take a different scenario. You have two microphones in a room and a > speaker who is not always in the same place. The microphones, although > the same model, are not identical; nor do they receive precisely the > same acoustic signal. What would need to happen in order for the output > of one of them to cancel the other's? > > Jerry > -- > Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry, What makes me think it will be easy? LOL. Apparently, as I stated at the top of my message, my lack of expertise in DSP. :) After seeing so many noise cancelling microphones advertised, and headphones like those that kill in-flight noise for airline passengers, If figured wrongly that it had become a known art. Thanks, Robert
On Wed, 30 Mar 2005 21:01:22 -0500, Robert Oschler wrote:
> "Jerry Avins" <jya@ieee.org> wrote in message > news:5r2dnSKXY6nKrdbfRVn-pw@rcn.net... >> >> What makes you think it's easy? Imagine a robot swimmer in a pool. Since >> you programmed it, you know its every move. In theory, you could >> generate antiwaves that would create calm water wherever you want it. Of >> course, you would need to account for reflection and diffraction from >> the sides and objects in the pool. >> >> Lets take a different scenario. You have two microphones in a room and a >> speaker who is not always in the same place. The microphones, although >> the same model, are not identical; nor do they receive precisely the >> same acoustic signal. What would need to happen in order for the output >> of one of them to cancel the other's? >> >> Jerry >> -- >> Engineering is the art of making what you want from things you can get. >> &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; > > Jerry, > > What makes me think it will be easy? LOL. Apparently, as I stated at the > top of my message, my lack of expertise in DSP. :) > > After seeing so many noise cancelling microphones advertised, and headphones > like those that kill in-flight noise for airline passengers, If figured > wrongly that it had become a known art.
Oh, the art is pretty well known. It's the physics that makes application of the art essentially impossible except under very tightly constrained conditions. To consider the two examples you gave: Noise cancelling microphones are (a) generally bolted onto your head, so that the relationship between their position and your mouth doesn't change very much and (b) typically have a built-in second transducer in a known (close) relationship to the first one. Speech is fairly limited in bandwidth to start with, so reject everything outside that range. Then, reject everything that has a propagation path inconsistent with the direction of wave propagation from mouth past first and second microphones. Noise cancelling headphones take advantage of the fact that they only have to attempt to cancel sound waves in the tiny space between the speaker and your eardrum. Even so, that means that they have no hope for signals outside a certain frequency range thanks to the physical dimensions of the problem, and rely to a fairly large extent on the (passive) blocking capability of the headphone body. Cheers, -- Andrew
On Wed, 30 Mar 2005 20:56:18 -0500, Robert Oschler wrote:
> - Can't turn off speech recognition while the robot is talking. It is > designed such that most of the move it makes are accompanied by his voice. > Since I am using voice recognition to control his movements, and he talks > when he moves, I'm stuck with this environment (and so are all my users).
Have you tried using a commercially available noise cancelling microphone? I believe that they're pretty common for (say) car phone installations. -- Andrew
"Andrew Reilly" <andrew-newspost@areilly.bpc-users.org> wrote in message
news:pan.2005.03.31.02.50.46.240286@areilly.bpc-users.org...
> > Have you tried using a commercially available noise cancelling microphone? > I believe that they're pretty common for (say) car phone installations. > > -- > Andrew >
Andrew, I thought about it but most of the ones I saw were in the $70+ range. Since my software is free, I'm trying to make entry into it as cheap as possible. I'm finding out that only a handful of my users are willing to spend more than around $15. If you know of anything, please let me know. Thanks, Robert
On Wed, 30 Mar 2005 23:27:19 -0500, Robert Oschler wrote:

> > "Andrew Reilly" <andrew-newspost@areilly.bpc-users.org> wrote in message > news:pan.2005.03.31.02.50.46.240286@areilly.bpc-users.org... >> >> Have you tried using a commercially available noise cancelling microphone? >> I believe that they're pretty common for (say) car phone installations. >> >> -- >> Andrew >> > > Andrew, > > I thought about it but most of the ones I saw were in the $70+ range. Since > my software is free, I'm trying to make entry into it as cheap as possible. > I'm finding out that only a handful of my users are willing to spend more > than around $15. If you know of anything, please let me know.
You almost certainly won't be able to do echo cancellation of the sort that you're after with software on a PC: the minimum A/D + buffer/compute + D/A latency is such that you can't even think about generating an anti-signal in time for it to cancel the original, even if you could nail down the movement and other physics-related problems. You'll find that most echo cancellation systems (headphones, microphones) of the sort that you've mentioned are analog, mainly for this reason. It's possible to do echo cancellation in the digital domain (provided you can make the physics nice) if you can make the acceptable lag from the output, and the acoustic echo path length significantly longer than that minimum processing latency. It's not clear from what you've described of your system that this can be done, but I don't know for sure. Perhaps my mental image of what you're trying to achieve isn't right... Cheers, -- Andrew
Robert Oschler wrote:
> "Jerry Avins" <jya@ieee.org> wrote in message > news:5r2dnSKXY6nKrdbfRVn-pw@rcn.net... > >>What makes you think it's easy? Imagine a robot swimmer in a pool. Since >>you programmed it, you know its every move. In theory, you could >>generate antiwaves that would create calm water wherever you want it. Of >>course, you would need to account for reflection and diffraction from >>the sides and objects in the pool. >> >>Lets take a different scenario. You have two microphones in a room and a >>speaker who is not always in the same place. The microphones, although >>the same model, are not identical; nor do they receive precisely the >>same acoustic signal. What would need to happen in order for the output >>of one of them to cancel the other's? >> >>Jerry >>-- >>Engineering is the art of making what you want from things you can get. >>&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295; > > > Jerry, > > What makes me think it will be easy? LOL. Apparently, as I stated at the > top of my message, my lack of expertise in DSP. :) > > After seeing so many noise cancelling microphones advertised, and headphones > like those that kill in-flight noise for airline passengers, If figured > wrongly that it had become a known art. > > Thanks, > Robert
The noise-canceling microphone is relatively simple. While not completely effective, it does a pretty good job. It consists of two microphones back to back, in essentially the same sound field as far as distant sounds sources are concerned and so connected that their outputs largely cancel. In use, the speaker talks directly into one side, greatly unbalancing the sound pressures on the two elements. Another way to look at a noise-canceling mike is as a microphone that is relatively insensitive to common-mode (remote) signals but sensitive to differential-mode (close-talking) signals. The salient difference between it and what you propose is that its construction makes cancellation at the source possible. No fixed reference such as the sound that had been commanded can do that. I wrote above, "Lets take a different scenario. You have two microphones in a room and a speaker who is not always in the same place. The microphones, although the same model, are not identical; nor do they receive precisely the same acoustic signal. What would need to happen in order for the output of one of them to cancel the other's?" The simple answer is that the microphones need to be very closely matched and located very near to one another. They need to respond to pressure, which is (nearly) the same for both rather than to velocity, which depends on the direction to the source and affects them differently. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;