0
\$\begingroup\$

I am designing an embedded device for my personal project. It has a speaker which plays voice received from remote location and also records voice using a microphone while playing back the sound. The recorded voice is send back to remote location where it is delivered to the user sitting over remote location. It is similar to talking to someone over a phone call on speaker mode.

I am designed an amplifier using LM386 for speaker and it works perfectly. But i am confused over whether microphone will also record the sound coming out from the speaker and user over remote location will hear echo of his/her own voice.

My question is how to cancel the sound from speaker while recording using a microphone? Should i cancel them in hardware or in software? How it can be done in hardware?

\$\endgroup\$

closed as too broad by Eugene Sh., Scott Seidman, pipe, Voltage Spike, Daniel Grillo Sep 8 '16 at 11:28

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Using the echo cancellation algorithms. Google it. \$\endgroup\$ – Eugene Sh. Sep 7 '16 at 19:28
  • 2
    \$\begingroup\$ A simple and somewhat effective hardware solution is to use a bidirectional or cardoid microphone, and orient it so that the speaker is in a deadzone. \$\endgroup\$ – Dampmaskin Sep 7 '16 at 20:13
  • \$\begingroup\$ If you can feed the signal used to drive the speaker to a circuit that has access to the microphone input, and if you can adequately model the microphone and speaker behaviors, then at first blush a simple cross-correlation function will magically develop a phase delay for you. With that in hand, you can subtract the interfering signal. But you need an automatic way to match signal amplitudes and although the microphone may be pretty good, the speaker is usually a significant distorting source and may need a good model. That, and more reasons, are why echo cancellation takes serious work. \$\endgroup\$ – jonk Sep 7 '16 at 22:00
  • \$\begingroup\$ @Dampmaskin: That is far too simplistic. The speaker fills the area with sound, and reverberation from walls and other nearby objects means that the microphone receives speaker sound from many arbitrary directions. Furthermore, the reverberaton changes when the relative positions of objects (including people) change, so any echo canceller must be adaptive. \$\endgroup\$ – Dave Tweed Sep 8 '16 at 12:33
  • 1
    \$\begingroup\$ @Dampmaskin: My point is that your solution is simple and not at all effective. In other words, it isn't a solution, period. \$\endgroup\$ – Dave Tweed Sep 8 '16 at 12:52
2
\$\begingroup\$

This is a very complex signal processing task known as "echo cancellation". Some open source voice encoders have it selectably built in (such as Speex). I believe that some Bluetooth hands-free devices have this too, if that is an option for your system.

Sidenote: It can actually be present at multiple locations in a voice chat (bluetooth hands-free, cell phone, telephone carrier, remote VoIP system, remote speakerphone) leading to large and annoying delays, since each echo cancellation step adds a small amount of delay.

To my knowledge this is not something that is available to simply 'plug in' very easily, unless you spend some big money.. but you might have luck looking into those open source voice encoders.

\$\endgroup\$
1
\$\begingroup\$
  • The easiest solution is either two mics in differential mode for high quality and cancel background noise or an electret with good noise cancellation properties for background. (Trial and error)
  • However, mic must be close to mouth.
  • Otherwise variable echo cancellation can get complex.
\$\endgroup\$

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