Echo Cancellation on Android and AudioRecord
- On June 5, 2015
- Acoustic Echo Cancellation, AEC
Background
When developing a VoIP application, most implementations use AudioRecord as the foundation class for capturing audio from the microphone. Can this class be used to cancel echo as well ?
Current Status
The answer is: depends. On several phone models and versions of Android, setting the value VOICE_COMMUNICATION to the AudioSource can provide reasonable results by utilizing the built-in AEC capabilities of the phone. But, there are many brands and versions for which the built-in AEC does not provide good results. For such cases, a dedicated echo cancellation software should be used. This dedicated echo cancellation software must be a robust filter that can overcome the complexity of echo cancellation on Android.
AudioRecord Settings
When you integrate a dedicated AEC software, you should make sure the build-in signal processing algorithms (e.g. AEC and AGC) does not interfere and modify the captured audio signal and as a result reducing the convergence score of the dedicated AEC. Therefore, when you use a dedicated AEC software, we recommend to use the MIC AudioSource for the AudioRecord. By doing so, you make sure the captured audio signal is delivered as-is to your application and AEC software.
What is required from the dedicated AEC software?
In addition to the obvious demand of robustly cancelling echo in this challenging environment, you should also make sure, the SDK that contains the AEC also includes additional fundamental signal processing filters like automatic gain control (AGC) and noise reduction (NR). These additional filters are required because the built-in signal processing filters would be disabled.