Ask HN: How to isolate a single voice in JavaScript?

1 points by pas256 7 hours ago

I am making a 2 player game where each player uses their phone as a microphone. It works well when players don't talk at the same time, but there is a big problem when players are talking simultaneously. It turns out the iPhone microphone is really good at picking up everyone's voice who is in the same room.

My AudioConstraints has echoCancellation: true and noiseSuppression: true, but I think those are built for a different purpose.

Any ideas on how to solve this?

JohnFen 7 hours ago

It's a nontrivial problem, Javascript or no. There are a few approaches you could explore, and you might find it an interesting research project.

I believe, though, that the iPhone, some Samsung phones, and Teams already have a voice isolation feature that might do what you want here, so you may not have to implement it yourself. You could just recommend that players use a supported phone and turn the voice isolation on.

  • pas256 7 hours ago

    Interesting, thanks.

    I was thinking perhaps something in the browser's WebRTC stack might have some kind of voice isolation in it for video conferencing too. I'll investigate.

efavdb 5 hours ago

There is a technique for this called “Independent Component Analysis” you might check out.

  • pas256 4 hours ago

    Oh really? Cool, thank you very much! I will.