Hi, 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)) ???????? break; ????? speex_bits_reset(&bits); ??? ?speex_bits_read_from(&bits, tempd, 26);??? ? ????? speex_bits_rewind(&bits); ????? 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; Regards, Kumar 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
Have you tried starting from sampleenc.c/sampledec.c (see manual)? Jean-Marc On 2010-01-28 05:45, Kumar Vply wrote:> Hi, > > 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)) > break; > speex_bits_reset(&bits); > > speex_bits_read_from(&bits, tempd, 26); > > speex_bits_rewind(&bits); > > 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; > > > > > > Regards, > Kumar > > > ------------------------------------------------------------------------ > Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! > <http://in.rd.yahoo.com/tagline_ie8_new/*http://downloads.yahoo.com/in/internetexplorer/>. > > > > > _______________________________________________ > Speex-dev mailing list > Speex-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev
Seemingly Similar Threads
- notification: More than two wideband layers found. The stream is corrupted.
- Purpose of skip_group_delay variable in testen.c
- a question on sqldf's handling of missing value and factor
- caret() train based on cross validation - split dataset to keep sites together?
- Reading in FORTRAN data using R