I'm developing some speech recognition app. I need to recognize words when the phone is ringing, but to do this I must cancel the speakers contribution to the microphone. So i want the microphone to ignore all audio coming from the speakers.
I've found that AcousticEchoCanceler is used for VoIP apps to cancel the echo, but I've tried to use it, and there's no difference when a tone is ringing on my phone.
I'm reading the audio from an AudioRecord object called 'recorder', and then applying the AcousticAudioCanceler
boolean isAvailable = AcousticEchoCanceler.isAvailable();
if (isAvailable) {
AcousticEchoCanceler aec = AcousticEchoCanceler.create(recorder.getAudioSessionId());
if(!aec.getEnabled())
aec.setEnabled(true);
Log.d("AEC", " AEC enabled : " + aec.getEnabled() + " . Has control: " + aec.hasControl());
}
else
Log.d("AEC", " AEC is not available");
I'm getting the same input when applying the AcousticCanceler and when not applying it. Why? Maybe it doesn't control the audio when coming from another application? I need it to work cancelling any output from the speakers, independently from which app they come from.
Furthermore, is AcousticAudioCanceler the only way to do this? I mean, it just works on Android Jelly Bean, and I need it to work on all devices... Thanks in advance