[Speex-dev] Why speex echo cancellation is not work

leafsilver leafsilver at 163.com
Fri Feb 13 07:09:32 PST 2009


I have invoke the speex echo cancellation interface as follow, but it seems not work (the echo still exists, my testbed is a small udp based p2p voice chat software). Can anyone tell me why it doesn't work? or whether I have made some mistake? Thanks a lot.
#define SPEEX_SAMPLERATE 8000
#define SPEEX_NN 128
#define SPEEX_TAIL 1920

class AECHandler
{
public:
    AECHandler(void){
        this->st = speex_echo_state_init(SPEEX_NN, SPEEX_TAIL);
        int tmp = SPEEX_SAMPLERATE;
        this->den = speex_preprocess_state_init(SPEEX_NN, SPEEX_SAMPLERATE);
        speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &tmp);
        speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE, st);
        //int tmp1 = 1;
        //speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_AGC, &tmp1);
    }
    //FILE *echo_fd, *ref_fd, *e_fd;
    short echo_buf[SPEEX_NN], ref_buf[SPEEX_NN], e_buf[SPEEX_NN];
    SpeexEchoState *st;
    SpeexPreprocessState *den;    
    char* inputBuf;
    ~AECHandler(void){
        speex_echo_state_destroy(this->st);
        speex_preprocess_state_destroy(this->den);
    }
    void HookComingSound(char* buf){
        speex_echo_playback(this->st,(spx_int16_t*)buf);
    }
    void HookOutingSound(char* origin, char* &outbuf){
        speex_echo_capture(this->st,(spx_int16_t*)origin,(spx_int16_t*)outbuf);
        speex_preprocess_run(this->den,(spx_int16_t*)outbuf);
    }
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20090213/d5900cc4/attachment.htm 


More information about the Speex-dev mailing list