I'm working on a web app that lets users control audio playback using voice commands, but I'm facing a challenge. While using a voice detection service, it works perfectly fine until I start playing audio. At that point, the microphone struggles to pick up voice commands since it also picks up the audio from the speakers. I've noticed that during Google Meets, my microphone doesn't seem to pick up any background audio. How do they manage this, and what's the best way to implement something similar in my project?
4 Answers
Google's solutions include built-in AEC and noise cancellation. I once set something similar up, so I'll look through my old code. Just a heads up, it might not fully solve your problem if the music is louder than the voice. Also, I'd love to know if you're planning to make your app available for free or if it’s going to be a paid service?
You're encountering what's known as acoustic echo. Your mic is inadvertently picking up sound from your speakers. Solutions like Google Meet use something called Acoustic Echo Cancellation (AEC) to fix this issue.
Many video conferencing applications are designed to automatically mute microphone input when audio is being played, which helps in ignoring the background sounds.
To tackle this, you need to implement echo cancellation. You can capture the outgoing audio stream and experiment with different settings like latency and frequency volume levels to minimize mic input.
Right! I’m trying to figure out how to implement that logic in my own app.