Filter sounds from iOS device's speakers from the microphone capture

Hi All,

I would appreciate any guidance on a particular problem I have come up against with the default behaviour of the microphone on iOS.

My game relies upon using the microphone continuously to detect sounds, while playing music within the game. Unfortunately however the microphone on iOS does not seem to apply any cancellation to the sounds from the speakers, and this high noise floor makes it difficult to discern external sounds through the microphone.

FYI - I have enabled “Force Audio Through Speakers” in Unity’s player settings to produce music in the game, the default is to to mute sounds when the mic is open.

Summary - Looking for a solution to cancel out sounds from an iOS device’s speakers from the microphone through Unity.

There’s no “built-in” solution.

You can detect headphones / require them (but keep in mind Bluetooth will result much lower sample rate when being used as full-duplex - mic in, headset out)

The other option is implement your own echo cancelation algorithm similar to apps such as zoom/google meet/etc.

You can try and look into webrtc and chromium source code to see such implementations.

Many thanks for the reply - You wouldn’t happen to know of any good audio engineers that can build an algorithm to filter out the background noice?

Filter out background noise is a different thing.
btw, since iOS 15 there’s additional API I’ve seen available at least in Zoom and Google Meet.
https://developer.apple.com/documentation/avfoundation/avcapturedevice/3850455-activemicrophonemode?changes=latest_beta

Okay great, I’ll take a look into this. Thank you