Hi all, I'm using speex through my own python wrapper based on ctypes. In my application I'm forced to process relatively large chunks of audio data (250ms). I was able to supply sufficiently large buffer to the SpeexBits structure and then encode using (code snippet) _speex.speex_bits_reset(byref(self.bits)) for i in range(0, len - self.frameSize, self.frameSize): _speex.speex_encode_int( ... ) N2 = _speex.speex_bits_write( ... ) However, when I receive the encoded chunk at the decoder side, I don't know how large the output buffer should be since the DTX and VAD is turned on. Shall I send number of encoded frames together with the speex data or is it possible to infer (from the received speex data) how large the output buffer should be? Best regards, Jan Trmal
> However, when I receive the encoded chunk at the decoder side, I don't know > how large the output buffer should be since the DTX and VAD is turned onI don't think either DTX or VAD should change the output size, only the input size (from the decoders perspective) will change. So, if you know you are sending 1/4 of a second of sound every time and you are using wide-band speex (16kHz) on 16bit sound data, that gives you 1/4 * 16000 * 2 = 8000 bytes of output data... Peter
Dne 27.2.2010 14:41, Peter Kirk napsal(a):>> However, when I receive the encoded chunk at the decoder side, I don't know >> how large the output buffer should be since the DTX and VAD is turned on > I don't think either DTX or VAD should change the output size, only the input > size (from the decoders perspective) will change. So, if you know you are > sending 1/4 of a second of sound every time and you are using wide-band speex > (16kHz) on 16bit sound data, that gives you 1/4 * 16000 * 2 = 8000 bytes of > output data...Hi Peter, thanks for your reply and apologies for my delay. You are absolutely right, from the perspective of decoder, the input is of a different size and the output size is in multiples of frame size. The main problem is that I have not the guarantee of constant length of input of the decoder. It is about 250ms, but the size varies quite a lot. So, the question is: when I encode the whole input chunk of audio data to speex data, is it possible on the decoder side, having only the encoded speex data, to infer how large buffer shall I prepare for the decoder? Or is it necessary to send the number of encoded frames together with the data? Best regards, Yenda