Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Speex codec (Read 5269 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Speex codec

Hello guys,

Has somebody had any experience with Speex codec? I have some questions about that. I would really appreciate your help

Speex codec

Reply #1
Just ask the questions.

Speex codec

Reply #2
And please don't double-post again.

Speex codec

Reply #3
Has somebody had any experience with Speex codec?

I do 

Speex codec

Reply #4
Can we have the latest unstable version (1.1.5) for windows ?? In , only the 1.1.4 is available.


Speex codec

Reply #5
And please don't double-post again.

I am sorry, I am a newbie on this forum and did not notice a forum dedicated to codecs.

Actually, I would like to show you what I do in my application and would really appreaciate if you point me the spot where I am wrong.

I am sorry for my previous post. I made a mistake assuming that I get mu-law data. No. I get linear PCM, 8 bits per second, signed.  So the sequence of my actions is the following:

void CompressAndDecompress (const char* cData, int iLength = /*160*/)
      vector <short> vecLinearPCMdata

    // Speex needs linear PCM, 16 bit per sample
    // Convert my signed 8 bit to signed 16 bits

    for (i = 0; i < iLength; i++)
        short cTemp =  (short)  (cData >> 8);     
        short_buffer.push_back ( cTemp);

  // now we have 160  samples. Encode the frame

    //  array to keep encoded frame
  char cEncodedFrame [38];


      speex_encode(state, &short_buffer [0], &bits);
    int nbBytes = speex_bits_write(&bits, cEncodedFrame, 38);

    /// now decode the frame
        short  cDecodedData [160];
        char  cLinearPCM8Bits [160];

        speex_bits_read_from (&dec_bits, cEncodedFrame, 38);
        speex_decode (speex_dec, &dec_bits, cDecodedData );

          for (int j=0; j < 160; j++)

                // convert each sample back to signed 8 bits PCM   
                cLinearPCM8Bits [j] = (char) (cDecodedData [j] >> 8) ;


As a result,  decompressed data does not match original data.  They are totally different and I can't play them.  Where am I wrong?


Speex codec

Reply #6
I have the same problem,
i am trying to add to my application the speex,i get stream of audio of wideband(16khz) and each smaple have 16 bit, as i understood from the manual is that speex get one frame at the time to encode , (one frame for wide band is 320 sample, mean 640 bit), after encode i send it on tcp\ip to the other size and then take the stream i got from the encoder and do decode.
i see that the buf i got after decoder has many zero , and not like the stream before.
i use quality=10 and stiil it sound bad!!!
what do i do wrong?

is it write that the encoder of wideband get frame at size 640 bit , and put them in float array of 320, and in decoder i get array of float of 320 and put them into 640 bit, each 4 bit insert to 2 bit of short?

i would be greatfull if someone who understand the code behind the speex could help me with this.


SimplePortal 1.0.0 RC1 © 2008-2021