[Speex-dev] Trouble in decoding speex on PC

Kumar Vply kumarvply at yahoo.com
Thu Jan 28 02:45:15 PST 2010


I am trying to develop a command line utility on PC side which will decode the encoded speex file without any header - ie. raw speex encoded data. 

I downloaded the speex-1.2rc1 version and used the testenc.c under libspeex library. Just to make sure that things are working fine, encoded a .raw audio file and could get the .bit and decoded audio raw file which was validated by using a raw to wav converter and playing on PC.

I modified the same code to make an independent decode utility and facing the following issue.. I could find that each time 160 samples are encoded, there are 26 bytes of encoded speex data, hence read 26 bytes of encoded data from file and processed as shown below.. But it gives error like - Invalid mode and stream got corrupted...What could be the reason? Also how do I calculate the number of speex bytes to be decoded at a given time.. Any help will be appreciated..

while (!feof(fin))
      fread(tempd, 1, 26, fin);

      if (feof(fin))

     speex_bits_read_from(&bits, tempd, 26);     


      speex_decode_int(dec, &bits, out_short);

fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout);
      skip_group_delay = 0;


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20100128/b3cdd519/attachment.htm 

More information about the Speex-dev mailing list