Hi, I want to take a .wav and generate a bytestream that I can feed direct to speex_decode(). The speexenc program appears to produce it wrapped up in an ogg stream, and it doesn't have any sort of "raw" mode. I've tried hacking on it to remove the ogg parts, but I must have got it wrong, as my decode dies after decoding 160 bytes (which I believe is one frame) with an error about a corrupted stream. How can I turn a .wav into a stream of raw speex data? Also, the above question leads to the following request for clarification: when decoding, is the "frame size" for a particular codec the amount of bytes that will get written to the output buffer per call? Or is it the amount of data you have to give to each call to speex_bits_read_from()? Or both? Or neither? Gerv --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Gervase Markham wrote:> Hi, > > I want to take a .wav and generate a bytestream that I can feed direct > to speex_decode(). The speexenc program appears to produce it wrapped > up in an ogg stream, and it doesn't have any sort of "raw" mode. I've > tried hacking on it to remove the ogg parts, but I must have got it > wrong, as my decode dies after decoding 160 bytes (which I believe is > one frame) with an error about a corrupted stream. How can I turn a > .wav into a stream of raw speex data? > > Also, the above question leads to the following request for > clarification: when decoding, is the "frame size" for a particular > codec the amount of bytes that will get written to the output buffer > per call? Or is it the amount of data you have to give to each call to > speex_bits_read_from()? Or both? Or neither?<p>Each frame is generally 160 samples, which is 320 bytes, which is 20ms at 8khz. (For narrow-band). The encoded size will depend on what settings you use, but it will always be much less than that (like 1/10 the size). So, your 160 byte encoded frame sounds awfully large.. [I'm guessing this has nothing to do with Mozilla :)] -SteveK <p>> --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
What happens is that on most mode, there isn't an integer number of bytes for each encoded frame, so you either need to do like sampleenc/sampledec or you can use the speex_bits_write_whole_bytes and speex_bits_read_whole_bytes functions to get optimal packing. Jean-Marc> I want to take a .wav and generate a bytestream that I can feed direct > to speex_decode(). The speexenc program appears to produce it wrapped up > in an ogg stream, and it doesn't have any sort of "raw" mode. I've tried > hacking on it to remove the ogg parts, but I must have got it wrong, as > my decode dies after decoding 160 bytes (which I believe is one frame) > with an error about a corrupted stream. How can I turn a .wav into a > stream of raw speex data? > > Also, the above question leads to the following request for > clarification: when decoding, is the "frame size" for a particular codec > the amount of bytes that will get written to the output buffer per call? > Or is it the amount of data you have to give to each call to > speex_bits_read_from()? Or both? Or neither? > > Gerv > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to > 'speex-dev-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered. > ><p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
I would guess that the sampleenc and sampledec programs (I think they're in the doc dir) would be closer to what you want. On Apr 28, 2004, at 3:18 PM, Gervase Markham wrote:> Hi, > > I want to take a .wav and generate a bytestream that I can feed direct > to speex_decode(). The speexenc program appears to produce it wrapped > up in an ogg stream, and it doesn't have any sort of "raw" mode. I've > tried hacking on it to remove the ogg parts, but I must have got it > wrong, as my decode dies after decoding 160 bytes (which I believe is > one frame) with an error about a corrupted stream. How can I turn a > .wav into a stream of raw speex data? > > Also, the above question leads to the following request for > clarification: when decoding, is the "frame size" for a particular > codec the amount of bytes that will get written to the output buffer > per call? Or is it the amount of data you have to give to each call to > speex_bits_read_from()? Or both? Or neither? > > Gerv > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to > 'speex-dev-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is > needed. > Unsubscribe messages sent to the list will be ignored/filtered. >-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: smime.p7s Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20040428/8f12de2d/smime-0001.bin
Rib Rdb wrote:> I would guess that the sampleenc and sampledec programs (I think they're > in the doc dir) would be closer to what you want.They were - many thanks :-) (Steve: no, this has nothing to do with Mozilla :-) Gerv --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.