Hi Anton<div><br></div><div>Thanks again for the tips... its worth a try... =)</div><div><br></div><div>I know now how to proceed...</div><div><br></div><div>1. From playback thread I need to save the clean buffer/frame via <b>speex_echo_playback()</b></div>
<div>2. In the audio recorder thread, I'll read a new buffer/frame(which might include far-end+echo fragments)</div><div>3. Then I'll use the <b>speex_echo_capture()</b> to cancel out the echo fragment coming from the playback buffer</div>
<div>4. The resulting <b>"out"</b> buffer contains the cleaned frame which in turn I'll use to encode to my target codec, ex. G77, GSM, etc..</div><div><br></div><div>I hope I'm on the right track.. I'll let you know if I succeed on this AEC development..</div>
<div><br></div><div>Many thanks</div><div>Chris Adoremos</div><div><br><div class="gmail_quote">On Thu, Sep 30, 2010 at 3:00 PM, Anton A. Shpakovsky <span dir="ltr"><<a href="mailto:saa@tomsksoft.com">saa@tomsksoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="RU" link="blue" vlink="purple"><div><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Hi</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">So in your case if you don’t want to use </span><b><span style="font-size:10.5pt;color:black">speex_echo_cancellation</span></b><b><span style="font-size:10.5pt;color:black"> </span></b><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">than you should do next way:</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Save the playback frames (clean echo) within separate playback thread with </span><span><b><span style="font-size:10.5pt;color:black">speex_echo_playback</span></b></span><span><b><span style="font-size:10.5pt;color:black"> </span></b></span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">func.</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Then use </span>speex_echo_capture<span lang="EN-US"> - </span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">it will remove the clean echo frame (saved with </span><span><b><span style="font-size:10.5pt;color:black">speex_echo_playback</span></b></span><span><b><span style="font-size:10.5pt;color:black"> </span></b></span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">func) from</span></p>
<p class="MsoNormal">const spx_int16_t *rec <span lang="EN-US" style="font-size:11.0pt;color:#1F497D">buffer (saved with </span><span><b><span style="font-size:10.5pt;color:black">speex_echo_</span></b></span><span><b><span lang="EN-US" style="font-size:10.5pt;color:black">capture)</span></b></span><span><b><span lang="EN-US" style="font-size:10.5pt;color:black"> </span></b></span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">and you will get clean frame in "out" buffer.</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">The sync is very important - because </span><span><b><span style="font-size:10.5pt;color:black">speex_echo_</span></b></span><span><b><span lang="EN-US" style="font-size:10.5pt;color:black">capture </span></b></span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">won't be able to remove clean echo frame that you didn't provide with </span><span><b><span style="font-size:10.5pt;color:black">speex_echo_playback</span></b></span><span><b><span lang="EN-US" style="font-size:10.5pt;color:black">.</span></b></span></p>
<p class="MsoNormal"><span><b><span lang="EN-US" style="font-size:10.5pt;color:black"> </span></b></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">I hope I didn't messed up anything :)</span><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"></span></p>
<div class="im"><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Best Regards,</span></p><p class="MsoNormal">
<span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Anton A. Shpakovsky</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
</div><p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> Christopher Adoremos [mailto:<a href="mailto:chrisadoremos@gmail.com" target="_blank">chrisadoremos@gmail.com</a>] <br>
<b>Sent:</b> Thursday, September 30, 2010 11:52 AM<br><b>To:</b> Anton A. Shpakovsky<br><b>Cc:</b> <a href="mailto:speex-dev@xiph.org" target="_blank">speex-dev@xiph.org</a><br><b>Subject:</b> [SPAM] [BombData][alltestmode] Re: [SPAM] [BombData][alltestmode] [Speex-dev] Using Speex Echo Canceller</span></p>
<div><div></div><div class="h5"><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-bottom:12.0pt">Hi Anton<br><br>Thanks for the info...<br><br>What if I use this function do I still need to sync the playback and capture?<br>
Assuming that the captured voice (*rec) already contains the echo which I need to cancel out...<br>--------------------------------<br>void speex_echo_capture (SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out)<br>
<br>Parameters:<br> st Echo canceller state<br> rec signal from the microphone (near end + far end echo)<br> out Returns near-end signal with echo removed<br>---------------------------------- <br>
<br>thanks & regards,<br>Chris Adoremos</p><div><p class="MsoNormal">On Wed, Sep 29, 2010 at 5:46 PM, Anton A. Shpakovsky <<a href="mailto:saa@tomsksoft.com" target="_blank">saa@tomsksoft.com</a>> wrote:</p><div>
<div><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Hi</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Yes, it's absolutely unnecessary to use speex codec. You can encode the echo cancelled auido data</span><span lang="EN-US" style="font-size:10.0pt;color:#333333"> with any codec you want.</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;color:#333333">The Echo Canncelation API is here - </span><a href="http://www.speex.org/docs/api/speex-api-reference/group__SpeexEchoState.html" target="_blank">http://www.speex.org/docs/api/speex-api-reference/group__SpeexEchoState.html</a></p>
<p class="MsoNormal"><span lang="EN-US">I would advice you to look at </span><b><span style="font-size:10.5pt;color:black">speex_echo_cancellation </span></b><span lang="EN-US">function but you will have to sync playback and capture streams by yourself.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">I've used GSM, iLBC and Speex codecs with Speex AEC and it works fine.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Best Regards,</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;color:#1F497D">Anton A. Shpakovsky</span></p><p class="MsoNormal">
<span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:speex-dev-bounces@xiph.org" target="_blank">speex-dev-bounces@xiph.org</a> [mailto:<a href="mailto:speex-dev-bounces@xiph.org" target="_blank">speex-dev-bounces@xiph.org</a>] <b>On Behalf Of </b>Christopher Adoremos<br>
<b>Sent:</b> Wednesday, September 29, 2010 4:39 PM<br><b>To:</b> <a href="mailto:speex-dev@xiph.org" target="_blank">speex-dev@xiph.org</a><br><b>Cc:</b> <a href="mailto:jean-marc.valin@usherbrooke.ca" target="_blank">jean-marc.valin@usherbrooke.ca</a><br>
<b>Subject:</b> [SPAM] [BombData][alltestmode] [Speex-dev] Using Speex Echo Canceller</span></p><div><div><p class="MsoNormal"> </p><div><p class="MsoNormal">Hi</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">
Is it possible to use only the speex echo cancellation module w/o using the speex codec?</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Here's the scenario:</p></div><div><p class="MsoNormal">
1. I have my voice recorded in PCM audio file format</p></div><div><p class="MsoNormal">2. I want to cleanup the recorded voice by removing any echo included in the audio file/buffer</p></div><div><p class="MsoNormal">3. can I just use the ff APIs?</p>
</div><div><p class="MsoNormal"> - SpeexEchoState* speex_echo_state_init()</p></div><div><p class="MsoNormal"> - int speex_echo_ctl()</p></div><div><p class="MsoNormal"> - void speex_echo_capture()</p></div><div><p class="MsoNormal">
4. then, will it be possible to encode the output buffer from speex_echo_capture() to any codec?</p></div><div><p class="MsoNormal"> Like G711? GSM? etc....</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">
I'm quite new to audio format concepts/development, so if you have any ideas your advice is highly appreciated..</p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">Thanks in advance</p></div><div>
<p class="MsoNormal">Chris A</p></div></div></div></div></div></div><p class="MsoNormal"> </p></div></div></div></div></blockquote></div><br></div>