[Speex-dev] [BombData][alltestmode] Re: [SPAM] [BombData][alltestmode] Re: Speex EchoCancellation
Anton A. Shpakovsky
saa at tomsksoft.com
Tue Jul 20 03:44:57 PDT 2010
Well, I'm not a professional in AEC theory, but what I've mentioned is:
speex_echo_state_init(20, 320*10) - frame size should correspond to
20ms. At your sampling rate (16000hz) is should be 16K*0.02 = 320. The
same I can notice about echo tail. 100ms: 16000*0.3 = 4800, not 3200 as
you has. But that's not crucial I think. Just wanna you get the point.
"Internally, speex_echo_playback() simply buffers the playback frame so
it can be used by
speex_echo_capture() to call speex_echo_cancel(). A side effect of using
this alternate API is that the playback audio is
delayed by two frames, which is the normal delay caused by the
soundcard. When capture and playback are already synchronised,
speex_echo_cancellation() is preferable since it gives better control on
the exact input/echo timing."
So, please, be careful with calling these two functions in separate
threads (be aware of the calling order).
And still, I do not get the entire idea of "didn get echo cancellation".
You should accept that there'll be a lot of situations and environments
where AEC will seem to be not working at all. As for me, I still have
problems with standalone speakers layout while laptop built-in
mic/speakers work good for me.
And again - no noticeable AEC doesn't mean you're doing smth wrong. Play
with params, read the manual. Cause number '20you're your
speex_echo_state_init call shows you're not good with
http://speex.org/docs/
p.s. Would be Happy if helped somehow.
Regards,
Anton A. Shpakovsky
-----Original Message-----
From: speex-dev-bounces at xiph.org [mailto:speex-dev-bounces at xiph.org] On
Behalf Of devi
Sent: Tuesday, July 20, 2010 5:17 PM
To: speex-dev at xiph.org
Subject: [BombData][alltestmode] Re: [Speex-dev] [SPAM]
[BombData][alltestmode] Re: Speex EchoCancellation
Anton A. Shpakovsky <saa <at> tomsksoft.com> writes:
>
> As for me - speex_echo_cancellation is a better choise. Try using it
in
> capture thread instead
> of those speex_echo_capture and speex_echo_playback functions.
>
> And please, describe your problem in details. Cause the fact that you
> "didn get echo cancellation"
> doesn't mean you are doing smth wrong.
>
> Regards,
> Anton A. Shpakovsky
>
> -----Original Message-----
> From: speex-dev-bounces <at> xiph.org [mailto:speex-dev-bounces <at>
xiph.org] On
> Behalf Of devi
> Sent: Tuesday, July 20, 2010 3:13 PM
> To: speex-dev <at> xiph.org
> Subject: [SPAM] [BombData][alltestmode] Re: [Speex-dev] Speex Echo
> Cancellation
>
> >
> > > Message: 1
> > > Date: Thu, 15 Jul 2010 00:19:43 -0600
> > > From: devi <at> purpletalk.com
> > > Subject: [Speex-dev] Speex Echo Cancellation
> > > To: speex-dev <at> xiph.org
> > > Message-ID: <20100715001943.pr04hvtxsc8k04so <at>
> mail.purpletalk.com>
> > > Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes";
> > > format="flowed"
> > >
> > > Hi
> > >
> > > I am using speex for cancelling echo.but i am not succeeded.
> > > I need echo cancellation in urgent.Please help m.
> >
> > Just check the documentation.... but, to be more precise: check out
> the
> > mini application for a quick start, loadable from this URL:
> >
> > http://svn.xiph.org/trunk/speex/speexclient/
> >
> > Rob
> >
>
> Hi
>
> i tried the code from the mini application for a quick start, loadable
> from
> this URL:
> Maris Engineering <mail <at> maris-ee.eu> writes:
>
> but i didnt get echo cancellation.
> In my code i used two threads one for audio capture and another thread
> for
> playback.
>
> Please help me.......
>
> thanks in advance.
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev <at> xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
>
Thanks for your reply.
I will describe my problem in detail.
I have 3 classes CspxEnDe(for encoding and decoding
audio),CAudiosrc(Capturing
Audio),CAudioSink(playback the audio).
In CAudioSink::AudioPlayer() which is timer functon called every 5ms,i
will
decode the audio which i receive from server,play the decoded audio and
after
i am calling speex_echo_playback().
In CAudiosrc class i am calling
waveInOpen(&hWaveIn, WAVE_MAPPER, &format,m_ThreadID,NULL,
CALLBACK_THREAD);
ON_THREAD_MESSAGE(MM_WIM_DATA, OnWaveInFun)
In CAudiosrc ::OnWaveInFun() i am calling
speex_echo_capture,speex_preprocess_run,speex_encode_int.
void CspxEnDe::Init(int mode)
{
speex_mode = mode;
initialized = 1;
speex_bits_init(&bits);
int hz = 16000; // 8khz sampling
if (speex_mode == SPEEX_MODE_ENCODE)
{
const SpeexMode * mode = speex_lib_get_mode
(SPEEX_MODEID_WB);
enc_state = speex_encoder_init(mode); // For Wideband
speex_wb_mode ,Narrowband speex_nb_mode
speex_encoder_ctl(enc_state, SPEEX_SET_SAMPLING_RATE,
&hz);
int quality= 8;
speex_encoder_ctl(enc_state,SPEEX_SET_QUALITY,&quality);
quality = 2;
speex_encoder_ctl(enc_state, SPEEX_SET_COMPLEXITY,
&quality);
echo_state = speex_echo_state_init(20,320*10);
speex_echo_ctl(echo_state,SPEEX_ECHO_SET_SAMPLING_RATE,&hz);
preprocess_state = speex_preprocess_state_init(20
/*frame size
in ms*/, hz);
speex_preprocess_ctl(preprocess_state,
SPEEX_PREPROCESS_SET_ECHO_STATE,echo_state);
/* int value = -226;
if (preprocess_state != NULL)
{
speex_preprocess_ctl(preprocess_state,
SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &value);
speex_preprocess_ctl(preprocess_state,
SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE, &value);
speex_preprocess_ctl(preprocess_state,
SPEEX_PREPROCESS_SET_DENOISE, &value);
value=0;
speex_preprocess_ctl(preprocess_state,
SPEEX_PREPROCESS_SET_AGC, &value);
}*/
}
else if (speex_mode == SPEEX_MODE_DECODE)
{
const SpeexMode * mode = speex_lib_get_mode
(SPEEX_MODEID_WB);
dec_state = speex_decoder_init(mode);
speex_decoder_ctl(dec_state, SPEEX_SET_SAMPLING_RATE,
&hz);
int enh = 1; // enable perceptual enhancer
speex_decoder_ctl(dec_state, SPEEX_SET_ENH, &enh);
}
}
this is the code which i am using..
_______________________________________________
Speex-dev mailing list
Speex-dev at xiph.org
http://lists.xiph.org/mailman/listinfo/speex-dev
More information about the Speex-dev
mailing list