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.
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.