4

Hi I am trying to add VOIP feature to an android Application. For this I need Acoustic Echo Cancellation.
I have seen the official documentation for AcousticEchoCanceler here.
I am using this piece of code for Acoustic Echo Cancellation:

if(AcousticEchoCanceler.isAvailable()) {
            echoCanceler = AcousticEchoCanceler.create(mAudioRecord.getAudioSessionId());
            echoCanceler.setEnabled(true);
        }

But this does not seem to help at all. isAvailable() returns true and echoCanceler objects gets created. If I query echoCanceler.getEnabled() it returns true also.

Even if I make a sample app using AudioRecord and AudioTrack this does not work. I heard a lot of echo.
If I set the source of AudioRecord as:

android.media.MediaRecorder.AudioSource.VOICE_COMMUNICATION

I see the echo gets cancelled in case of Nexus 5(for Android version 5 and 6).
(I am not using AcousticEchoCanceler when I set the source as VOICE_COMMUNICATION) However with same Android version, the same method does not work with Samsung Galaxy S4 and Samsung Note 4 etc devices.
Using echo Cancellation Libraries(like libspeexdsp etc) is NOT possible (as I am working on an existing project).
Please help as soon as possible.
Thank you very much.

Vivek Kumar
  • 103
  • 1
  • 9
  • Any luck with this? I'm having the same problem. Devices that have AcousticEchoCanceler and seem to work: Nexus 5 (Android version : 6.0.1) Moto X (Android version : 5.1.1) Dont seem to work: Samsung Galaxy Grand Prime (Android version : 5.1.1) Samsung Galaxy S6Edge (Android version : 5.1.1) HTC One – rmp251 Jan 21 '16 at 21:55
  • 1
    Try setting the audio mode to `MODE_IN_COMMUNICATION`. – Vivek Kumar Aug 08 '16 at 11:38
  • Vivek that was the issue in my case! – rmp251 Aug 08 '16 at 18:04

1 Answers1

0

Make sure the audio mode is set to MODE_IN_COMMUNICATION

rmp251
  • 5,018
  • 4
  • 34
  • 46