The model was talking to itself because the mic picked up speaker output. Three fixes that together enable Android's hardware echo cancellation: 1. AudioManager.MODE_IN_COMMUNICATION — tells the platform this is a voice call so the audio routing + AEC pipeline activates 2. USAGE_VOICE_COMMUNICATION on AudioTrack — links playback to the capture path so AEC knows what to subtract from the mic signal 3. Explicit AcousticEchoCanceler on the AudioRecord session as fallback Also enables speakerphone mode (isSpeakerphoneOn) since MODE_IN_COMMUNICATION defaults to earpiece routing. Cleanup restores previous audio mode. |
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| build.gradle.kts | ||
| proguard-rules.pro | ||