>>>> Hi, <br>>>> <br>>>> I have a scenario in a mobile VoIP app that requires echo cancellation but <br>>>> is somewhat different from what's described in the docs. <br>>>> <br>>>> Audio is received from and sent to the network at 8000Hz. Each packet <br>>>> contains 160 samples worth a playback of 20ms. <br>>>> <br>>>> But the hardware requires aggregation for both playback and capture. So for <br>>>> playback, I coalesce 4 packets in a buffer and queue them as a larger buffer <br>>>> for playback. <br>>>> On the send side, I read a large buffer (worth 4 packets) and send them out <br>>>> over time 20ms apart. <br>>>> <br>>>> I tried using speex_echo_playback just when a 160-sample packet arrives from <br>>>> the network, before coalescing and speex_echo_capture just before a packet <br>>>> is sent out to the network but that doesn't seem to work properly (doesn't <br>>>> cancel any echo). <br>>><br>>> The most likely reason is that you didn't align the far-end and near-end samples.<br>>> So the filter can not converge.<br>><br>>Thanks for your response. Can you please explain what you mean by <br>>align samples from near-end and far-end? And how is that usually <br>>accomplished? <br><br>You need to know the total delay caused by DAC buffer before speaker, ADC buffer<br>after microphone and acoustic path between speaker and microphone. Simply to say,<br>if you play an impluse signal and its first echo appears after N sample cycles,<br>you can call N as the delay between y (echo in near-end signal) and x (far-end<br>signal). Then you can buffer far-end signal for N-M cycles before sending to AEC.<br>M is a little number (such as 100) in order to avoid filter failure when echo<br>path drifts.<br><br>>><br>>>>> So, in this scenario above, please recommend a good place to insert <br>>>> speex_echo_playback and speex_echo_capture. Should I be just before the read <br>>>> and write to hardware? In that case, should I use a larger "frame size" of <br>>>> 160 samples x 4? <br>>><br>>> Of course you can set frame size to 160*4. Otherwise you can feed samples 4 times<br>>> to the AEC if you don't want to modify the frame size. <br>>><br>>>> <br>>> Thanks in advance, <br>>> Daniel.<br><br><br><br><span title="neteasefooter"><span id="netease_mail_footer"><hr/>
<a href="http://mail.163.com/html/110414_attachment/att1.htm" target="_blank">体验网易邮箱2G超大附件,轻松发优质大电影、大照片,提速3倍!</a>
</span></span>