[Speex-dev] Workflow question

Evgueni Tsygankov eugenet at rusmex.com
Fri Jun 6 05:28:20 PDT 2008


Hello,

I am trying to stream voice data in NB mode between two devices. I just
wanted to confirm that my understanding of encoding / decoding workflow
is correct. 

On the sender:
(1) Obtain a buffer of 16-bits samples from a microphone
(2) Break this buffer into buffers of size 160 and pass each of them to
speex_encode_int, then to speex_bits_write. In my understanding, I must
do speex_bits_write for each frame to ensure that each frame ends with a
terminator that will be needed by the decoder.
(3) Assemble all encoded frames into a single buffer and pass it to the
receiving device

On the receiver:
(4) Take that single buffer, and read 5 bits at a time until I get the
terminator code 15. This gives me a single encoded frame.
(5) Then, pass that single encoded frame to speex_bits_read_from and
speex_decode_int. Keep decoding frames until the end of the buffer.
(6) Assemble decoded frames into a buffer and pass it to the speaker

Is that the right workflow? 

Thank you,

Evgueni


More information about the Speex-dev mailing list