3

I successfully integrated speex aec in android (integrated in Android/frameworks/av/media/libeffects/preprocessing).

Echo was cancelling when I use sample rates 8k and 11k for capturing. But it is working worse as I go to higher capturing sample rates such as 16k, 22k, 32k and so on.

I am using speex resampler only to resample my input data. I don't know why the Echo is not cancelling with higher sample rates.

Can anyone explain the solution for this?

flotothemoon
  • 1,882
  • 2
  • 20
  • 37
swetha
  • 67
  • 8

1 Answers1

3

Based on your capturing data on 8kHz, the problem are in 2 aspects: (1) The nearend signal has almost no delay (or maybe even a little bit more earlier!) from the farend signal. Add a short delay (for examle 10ms) before near end signal will work. (2) The ERL is more than -12dB. So, you should configure the AEC module to set some kind of configuration item such as "worstExpectedERLdB" bigger than 12dB.

gary
  • 1,569
  • 3
  • 20
  • 30
  • Thanks for your reply.I did exactly the way you said(i mean i applied AEC before speex codec),But still the echo remains the same after AEC process.I'm struggling with this problem from 1 week. Even i tried with matlab script i.e., echo_diagnostic.m. Through this script i observed that delay was normal and clock drift also normal.But still not able to cancel echo.I don't know what is the problem.I tried in many ways.But still facing the same problem.Can you say any another solution. – swetha Jul 14 '14 at 04:43
  • There're a lot of limitation before AEC works. One of the most popular issue is the bulk delay. Could you capture the audio samples and send me to analyse? just save them into the raw pcm files before AEC function call. – gary Jul 14 '14 at 06:48
  • 1
    yeah,sure.i resampled near-end data as well as far-end data to 8k from 16k using speex resampler. Because speex AEC will work with 8k sample rate. But echo is not cancelled. https://drive.google.com/folderview?id=0B2xy_Xym01KzVnFhNUxaVnV4cU0&usp=sharing find the SPEEX AEC inputs from above link. Can you please help me on this. – swetha Jul 14 '14 at 08:51
  • 2
    I got it. Your problem is in 2 aspects: (1) The nearend signal has almost no delay (or maybe even a little bit more earlier!) from the farend signal. How comes? Normally, in Android system, you should get tens miliseconds delay between them. How do you get your recording? (2) The ERL is more than 12dB. So, you should configure the AEC module to set some kind of configuration item such as "worstExpectedERLdB" bigger than 12dB. – gary Jul 14 '14 at 09:25
  • "The ERL is more than 12dB"..what it means? sorry,i didn't get you. And one more thing i wanna say,in android there is delay compensator ( in echo_reference.c file). It will compensate the render delay by adding zero's in far-end data.So we get far-end and near-end data at same time intervals.But with 8K sample rate app it's working fine. – swetha Jul 14 '14 at 09:53
  • 2
    ERL means "Echo Return Loss". A negative value means "gain" instead of "loss". -12dB means your echo is even much louder than farend signal. Most of the echo cancellation algorithm can handle lower than -3dB (or at most -6dB) echo very well. But if echo is stronger than -6dB ERL, you have to check if this AEC algorithm has any configuration item to change WorstExpectedERL. (in previous comment, I missed a "-" negative sign before 12, please note it.) – gary Jul 14 '14 at 10:20
  • 1
    You can have a good try to attenuation nearend signal by -12dB (just multiply 0.063), and do AEC, and then amplify it to restore the level (by multiply 15.8). If then speex AEC works, it can prove this root cause. – gary Jul 14 '14 at 10:33
  • Thank you so much..I delayed near-end data manually by 10 milli seconds by adding zero's. Echo canceled completely.I surprised.But here i got one more doubt I'm able to cancel echo when i use capture sampling rate as 8k in application,But for the same code I'm not able to cancel echo with capture sampling rate as 16k.The only difference is that just I'm doing re-sampling process with 16k app. I don't think that re-sample process will effect AEC process. – swetha Jul 14 '14 at 10:56
  • 1
    Nice to see it works now! AEC topic is so complex and you'd better split into different topics on stackOverflow:) For resampler problem, you need capture the samples before and after your Resampler, and send to me for analysis. – gary Jul 14 '14 at 11:34
  • 1
    shared files in link https://drive.google.com/folderview?id=0B2xy_Xym01KzTDk2VFVvMEgxN1U&usp=sharing . – swetha Jul 14 '14 at 12:44
  • 1
    Don't you feel these answers are useful? please remember to click "Up Arrow" to mark it as "useful answer". These resampler output are good, no new problem, just same as 8kHz sample rate files, put a little delay on near end signal should work. – gary Jul 14 '14 at 13:14
  • 1
    thank you so much and I'm extremely sorry I'm not able to click "up arrow",i need 15 reputations to do that or else I'll do that at beginning itself. I'm new user to this site.But your's was really useful answer. – swetha Jul 15 '14 at 03:57
  • @gary, could you please share how do you analize ERL? – rightaway717 Dec 03 '15 at 12:11