I'm working on an application which is recording the microphone's input and at the same time has to be able to play an MP3 file via Loudspeakers.
I need to cancel the echo of the MP3 file. I've tried to use AcousticEchoCanceler, but it didn't work.
Now i've integrated speex library in my project. EchoCanceller function interface looks like this:
public native static short[] process(short[] inputFrame, short[] echoFrame);
The problem is i don't know how to get "echoFrame" (data of currently playing MP3 file). I'm using MediaPlayer to play it.
Is it possible to cancel echo from an MP3 file? Or i must convert MP3 to PCM and play it via SoundTrack? Thanks for reading.
As far as I know, You should use PCM. The AEC does not work on a compressed audio format.