[Speex-dev] Speex echo cancellation and denoise issues

Gurinder gurinder.singh at patni.com
Mon Feb 22 02:43:14 PST 2010

Hi All


I am using speex in one of my WinCE project.


I have been trying to use speex to perform denoise on the captured audio
packet and echo cancellation. Following behavior I have observed while using
various options. I would really appreciate if you could help me with the
issues I am facing.


1.	Denoise: I have written the following to code to perform denoise.

//To initialize speex preprocess state and set the denoise option

int nEnable = 1;

                        SpxPreprocessState =
speex_preprocess_state_init(160, 8000); //20ms audio at 8000 bps

speex_preprocess_ctl(SpxPreprocessState, SPEEX_PREPROCESS_SET_DENOISE,


//Run the preprocess on the buffer captured before encoding

speex_preprocess_run(SpxPreprocessState, (short*)pbBuffer);



On calling speex_preprocess_run removes all the audio from the buffer and a
constant humming sound is heard. I open the recorded file in Cool edit pro
tool and see that all the spikes are removed and flat wave is there. What
could be the reason for this behavior?


2.	Echo cancellation: I have two separte threads, one to capture live
audio and another one to playback the audio recvevied on the network. Since
audio capture and playback are handled asynchronously I call the function
speex_echo_playback right after I enqueue a buffer for sound card to play
and call the function speex_echo_capture for every packet captured before I
call speex_encode_int for encoding. As soon as the audio start I see below
warnings on the screen


Warning: No playback frame available (your application is buggy and/or got

Warning: Auto-filling the buffer (your application is buggy and/or got


These warning are displayed few times and then it stops. Then once in a
while again these warnings are printed. What exactly do these warning means
as the audio keeps on playing without any problem?


3.	For AGC: 

//To initialize speex preprocess state and set the AGC option

int nEnable = 1;

                        SpxPreprocessState =
speex_preprocess_state_init(160, 8000); //20ms audio at 8000 bps

speex_preprocess_ctl(g_pSpxPreprocessState, SPEEX_PREPROCESS_SET_AGC,


On enabling AGC I get the below warning.


Warning: Unknown speex_preprocess_ctl request: 2


Is AGC not supported?


Thanks & Regards



This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at netadmin at patni.com and delete this mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20100222/54f99528/attachment.htm 

More information about the Speex-dev mailing list