Hi I have just written a small c programm which reads in speex files and outputs them as asci text numbers. This is necessary as for writing a hw testbench for decoding tests, since thy only read ascii files :-(.I can't read the bitrate properly from the header file. It's allways -1. Please see example below and attached c programm. I wan't to check for a fixed bitrate (8000). The only difference is the framesize of the ogg file, which is not a sure guess due to the -nframes option? Is there a discription of the format of the frames. What is the reason that the first frame after the header is larger than the other frames? Thanks ST speex-1.1.12/src/speexenc -n --bitrate 12000 female.wav female_nb_12.spx readspx female_nb_12.spx |head -20 speex header Version:1.1.12 rate:8000 mode:0 mode_bitstream_version:4 nb_channels:1 bitrate:-1 frame_size:160 vbr:0 frames_per_packet:1 extra_headers:0 Framesize:33 25 0 0 0 69 110 99 111 speex-1.1.12/src/speexenc -n --bitrate 8000 female.wav female_nb_8.spx readspx female_nb_8.spx |head -20 speex header Version:1.1.12 rate:8000 mode:0 mode_bitstream_version:4 nb_channels:1 bitrate:-1 frame_size:160 vbr:0 frames_per_packet:1 extra_headers:0 Framesize:33 25 0 0 0 69 110 99 111 -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: text/x-makefile Size: 54 bytes Desc: not available Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20060419/d8690cc3/Makefile.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: speex_header.h Type: text/x-chdr Size: 3720 bytes Desc: not available Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20060419/d8690cc3/speex_header.h -------------- next part -------------- A non-text attachment was scrubbed... Name: readspx.c Type: text/x-csrc Size: 2072 bytes Desc: not available Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20060419/d8690cc3/readspx.c
Jean-Marc Valin
2006-Apr-19 16:27 UTC
[Speex-dev] HW-Speex: Fileformat and encoding process
> I have just written a small c programm which reads in speex files and outputs > them as asci text numbers. This is necessary as for writing a hw testbench > for decoding tests, since thy only read ascii files :-(.I can't read the > bitrate properly from the header file. It's allways -1.Sorry about that, my encoder never actually bothered setting the bitrate field. It doesn't matter much because Speex is designed to be able to switch bit-rate on the fly and encodes the bit-rate directly in each encoded frame. For narrowband, the bit-stream is defined in Tables 3 and 4 of http://www.speex.org/manual2/node9.html#SECTION00094000000000000000 This means that at 8 kbps, all frames will start with (in binary) 00011> Please see example > below and attached c programm. I wan't to check for a fixed bitrate (8000). > The only difference is the framesize of the ogg file, which is not a sure > guess due to the -nframes option?Not sure I understand what you mean here...> Is there a discription of the format of the frames. What is the reason that > the first frame after the header is larger than the other frames?The only description of the format is the link above, but I can answer the remaining questions you have. If you encode in CBR, all frames are the same size, which is 20 bytes at 8 kbps. If you're seeing something different then it may be a problem with the Ogg parsing. I don't know the context of your project, but it may not be necessary to play with Ogg at all. Speex only uses Ogg for encoding to files (so they can be seeked and all). Applications like VoIP don't use Ogg at all. Jean-Marc> Thanks > ST > > speex-1.1.12/src/speexenc -n --bitrate 12000 female.wav female_nb_12.spx > readspx female_nb_12.spx |head -20 > speex header > Version:1.1.12 > rate:8000 > mode:0 > mode_bitstream_version:4 > nb_channels:1 > bitrate:-1 > frame_size:160 > vbr:0 > frames_per_packet:1 > extra_headers:0 > Framesize:33 > 25 > 0 > 0 > 0 > 69 > 110 > 99 > 111 > > speex-1.1.12/src/speexenc -n --bitrate 8000 female.wav female_nb_8.spx > readspx female_nb_8.spx |head -20 > speex header > Version:1.1.12 > rate:8000 > mode:0 > mode_bitstream_version:4 > nb_channels:1 > bitrate:-1 > frame_size:160 > vbr:0 > frames_per_packet:1 > extra_headers:0 > Framesize:33 > 25 > 0 > 0 > 0 > 69 > 110 > 99 > 111 > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev