I'm experiencing an issue with the official AcousticEchoCanceler and WebRtc libraries on many test devices, including Samsung S23, Pixel 8a, Pixel 7, and Galaxy Tab A9. Despite implementing the code correctly and importing it into AudioRecorder, there is still a loud noise when I export the recording to a file. Here's what I've tried so far:
AcousticEchoCanceler Implementation:
AcousticEchoCanceler echoCanceler = AcousticEchoCanceler.create(audioSessionId); if (echoCanceler != null) { echoCanceler.setEnabled(true); }
My sample rate is 16k
Additionally, I set up AudioManager.MODE_IN_COMMUNICATION
The same happen when I try NoiseSuppressor
NoiseSuppressor mNoiseSuppressor = NoiseSuppressor.create(audioSessionId);
if (mNoiseSuppressor != null) {
int res = mNoiseSuppressor.setEnabled(true);
}
WebRtc Library Implementation
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);
But none of them can work, the recording still contains loud noise when exported to a file.
I wonder what is the correct way to support Acoustic Echo Cancellation (AEC) on android device?
Or is there other third party library?