fanchuan0077 at gmail.com
2010-Jun-28 02:57 UTC
[Speex-dev] ACE does not work for me at all.
Hello, all. 1) ACE does not work for me I am in a voip project using Speex, failed to have hte Speex ACE work. here is how I initialize it: /** * Configurations : * #define BITS_PER_SAMPLE (16) * #define SAMPLE_RATE (8000) * #define CHANNEL_NB (1) * #define DURATION (20) * SPEEX_MODEID_NB */ _eco_state = speex_echo_state_init(_encframe_size, 10*_encframe_size); speex_echo_ctl(_eco_state, SPEEX_ECHO_SET_SAMPLING_RATE, &_sample_rate); _den_state = speex_preprocess_state_init(_encframe_size, _sample_rate); speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_ECHO_STATE, _eco_state); tmp=1; speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_DENOISE, &tmp); tmp=1; speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_AGC, &tmp); ftmp=24000; // actually default is 8000(0,32768),here make it louder for voice is not loudy enough by default. 8000 speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &ftmp); tmp=1; speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_VAD, &tmp); and following is how I cancel echo: I have a player class and a recorder class using windows wavein and waveout with waveInProc and waveOutProc event handlers void __stdcall WFAudioPlayer::WaveOutProc(HWAVEOUT hWaveOut,UINT uMsg,DWORD dwInstance,DWORD dwParam1,DWORD dwParam2) { if(uMsg != WOM_DONE) return; WFAudioPlayer* player = reinterpret_cast<WFAudioPlayer*>(dwInstance); if (player) { // get the frame to be played back next. tByte* nextframe = player->GetNextBlockFrame(); /** * No matter the following two lines are commented or not, the voip performances are the same, with echo. */ // make speex AEC buffer it for echo cancellation for recorder if (nextframe) player->GetConverter()->SpeexEchoPlayback(nextframe); } ...... } void WFAudioRecorder::ProcessRecordedFrame(tByte* record) { static tUInt32 timestamp_counter = 0; // cancel echo _converter->SpeexEchoCapture(record,_echooutframe); //preprocess _converter->SpeexPreprocessRun(_echooutframe); ........ } and ACE seems not work for me at all. I don't know why. the voices are the same whether I cancel echo or not,full of echos. Any help would be appreciated, thanks. 2) BTW speex_echo_state_destroy crashes if the echo state was initialized with filter length 0. _eco_state = speex_echo_state_init(_encframe_size, 0); I know it's unreasonable to make filter length 0, but crash is unacceptable, I think. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20100628/4ccc050d/attachment.htm
No matter I speex_echo_playback the received voice data(from far end) right before it's played by waveout or right after it's played, it cann't cancel any echo. I read the documentation again and again,found I am indeed following the instruction. 2010/6/28 <fanchuan0077 at gmail.com>> Hello, all. > > 1) ACE does not work for me > I am in a voip project using Speex, failed to have hte Speex ACE work. here > is how I initialize it: > /** > * Configurations : > * #define BITS_PER_SAMPLE (16) > * #define SAMPLE_RATE (8000) > * #define CHANNEL_NB (1) > * #define DURATION (20) > * SPEEX_MODEID_NB > */ > _eco_state = speex_echo_state_init(_encframe_size, 10*_encframe_size); > speex_echo_ctl(_eco_state, SPEEX_ECHO_SET_SAMPLING_RATE, &_sample_rate); > > _den_state = speex_preprocess_state_init(_encframe_size, _sample_rate); > speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_ECHO_STATE, > _eco_state); > > tmp=1; > speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_DENOISE, &tmp); > tmp=1; > speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_AGC, &tmp); > ftmp=24000; // actually default is 8000(0,32768),here make it louder for > voice is not loudy enough by default. 8000 > speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &ftmp); > tmp=1; > speex_preprocess_ctl(_den_state, SPEEX_PREPROCESS_SET_VAD, &tmp); > > and following is how I cancel echo: > > I have a player class and a recorder class using windows wavein and waveout > with waveInProc and waveOutProc event handlers > > void __stdcall WFAudioPlayer::WaveOutProc(HWAVEOUT hWaveOut,UINT uMsg,DWORD > dwInstance,DWORD dwParam1,DWORD dwParam2) > { > if(uMsg != WOM_DONE) > return; > > WFAudioPlayer* player = reinterpret_cast<WFAudioPlayer*>(dwInstance); > > if (player) > { > // get the frame to be played back next. > tByte* nextframe = player->GetNextBlockFrame(); > > /** > * No matter the following two lines are commented or not, the voip > performances are the same, with echo. > */ > // make speex AEC buffer it for echo cancellation for recorder > if (nextframe) > player->GetConverter()->SpeexEchoPlayback(nextframe); > } > ...... > } > > void WFAudioRecorder::ProcessRecordedFrame(tByte* record) > { > static tUInt32 timestamp_counter = 0; > > // cancel echo > _converter->SpeexEchoCapture(record,_echooutframe); > > //preprocess > _converter->SpeexPreprocessRun(_echooutframe); > ........ > } > and ACE seems not work for me at all. I don't know why. the voices are the > same whether I cancel echo or not,full of echos. > > Any help would be appreciated, thanks. > > 2) > BTW speex_echo_state_destroy crashes if the echo state was initialized with > filter length 0. > _eco_state = speex_echo_state_init(_encframe_size, 0); > I know it's unreasonable to make filter length 0, but crash is > unacceptable, I think.-- B.r Sincerly Dongwen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20100628/16c9155d/attachment.htm