[Speex-dev] [SPAM] [BombData][alltestmode] Re: Speex Echo Cancellation

devi devi at purpletalk.com
Tue Jul 20 03:16:30 PDT 2010


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..



More information about the Speex-dev mailing list