[Speex-dev] Need help on making speex AEC to work

Hai Yun Tao hytparadisee at hotmail.com
Tue Aug 21 04:26:27 PDT 2007



Hello All

I'm accessing speex via jni, I have successfully
decoded and encoded data and capture and play it back in java. Now my
challenge is speex's echo canceller.
My capture and playback are not synchronized, so i got to use the method from 1.2beta2 right?
What's
the proper way to fit speex_echo_capture() and speex_echo_playback()
into the following procedures, assuming they were already wrapped by
jni properly?

                    speexInit();
        final PcmRecorder r = new PcmRecorder();
        final PcmPlayer p = new PcmPlayer();
        r.setListener(new RecorderListener() {

            public void recorded(Object source, byte[] bytes, int length) {
                    // WHEN A FRAME IS CAPTURED, THIS CALLBACK WILL BE TRIGGERED

                int c = speexEncode(bytes);
                    // this is just for local playback, a demo only
                speexDecode(bytes, c);
                p.write(bytes, 0, length);    // THIS IS WHERE A FRAME WAS WRITTEN FOR PLAYBACK
            }
            
        });
        p.start();
        r.start();
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                speexDestroy();
            }
        });
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20070821/f441086e/attachment.htm


More information about the Speex-dev mailing list