Displaying 20 results from an estimated 157 matches for "speex_bits_reset".
2005 Jun 06
1
SpeexBits Questions
Thanks, it makes more sense to me now. Does speex_bit_read_from also
append in that manner?
Jean-Marc Valin wrote:
> speex_bits_reset is before encoding, not decoding. If you don't call it,
> then everything you encode will be appended so it will grow without end.
> As for the point of the SpeexBits struct, it's there as a sort of "array
> of bits" to it's easy to pack and unpack bits.
>
>...
2005 Jun 06
1
SpeexBits Questions
The example in the documentation demonstrates using speex_bits_reset
before encoding and decoding each frame.
"
speex_bits_reset(&bits);
speex_encode(enc_state, input_frame, &bits);
nbBytes = speex_bits_write(&bits, byte_ptr, MAX_NB_BYTES);
"
What happens if this is not done? I think I'm missing the point of
having a SpeexBits object.
2004 Nov 16
3
version 1.0.1 X 1.1.4
...fread( in, sizeof( short ), FRAME_SIZE, fin );
if( feof( in ) )
break;
/* Copy the 16 bits values to float so Speex can work on them */
for( i = 0; i < FRAME_SIZE; i++ )
input[ i ] = in[ i ];
/* Flush al the bits in the struct so we can encode a new frame */
speex_bits_reset( &bits );
/* Encode the frame */
speex_encode( state, input, &bits );
...
encoder 1.1.4:while( 1 )
{
/* Read a 16 bits/sample audio frame */
fread( in, sizeof( short ), FRAME_SIZE, fin );
if( feof( in ) )
break;
/* Flush al the bits in the struct so we ca...
2009 Sep 02
3
voice sound like robot voice :)
...ity );
speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_QUALITY,
&encoderQuality );
speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_VBR,
&disabled );
speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_DTX,
&disabled );
// init encoder
speex_bits_init( &codecBits );
speex_bits_reset( &codecBits );
// determine encoded bytes per frame with spx_int16_t type, speex can
work with float;s, but not in this engine
speex_encode_int( pCodecEncoderState, (spx_int16_t*)pCodecBuffer,
&codecBits );
encodedFrameBytes = (uint)speex_bits_nbytes( &codecBits );
// setu...
2011 Nov 17
1
Just getting noise
...why the sample I was working off of was converting
the shorts to floats then calling the other encode/decode methods.
Based off of your suggestions I tried the following but I get the same
result.
virtual Enigma::u8* Encode(Enigma::u8* inputBuffer,size_t inputSize,
size_t& outputSize)
{
speex_bits_reset(&mBits);
speex_encode_int(mState, (Enigma::s16*)inputBuffer, &mBits);
speex_bits_insert_terminator(&mBits);
outputSize = speex_bits_nbytes(&mBits);
/*Copy the bits to an array of char that can be written*/
Enigma::u8* cbits = new Enigma::u8[outputSize]();
speex_bi...
2006 Jan 10
3
Using speex (newbie)
Thank you for the answer but i've already read manual and examples and i'm doing same thing
of your code, so, maybe you can give me a hint about the problem i have, that it is for sure in my code. A
question: is it possible that i hear a "tick" because between two frame i call speex_bits_reset? (for this reason if i encode
more than one frame together there is no "tick"). Maybe the solution is to call not speex_bits_reset and using another way (but in
your examples it functions)?
Thank you
>
> Same answer as for everyone else: start from the sampleenc/sampledec
> pro...
2004 Nov 17
2
version 1.0.1 X 1.1.4
...) )
>> break;
>>
>> /* Copy the 16 bits values to float so Speex can work on them */
>> for( i = 0; i < FRAME_SIZE; i++ )
>> input[ i ] = in[ i ];
>>
>> /* Flush al the bits in the struct so we can encode a new frame */
>> speex_bits_reset( &bits );
>>
>> /* Encode the frame */
>> speex_encode( state, input, &bits );
>>...
>>
>>
>>encoder 1.1.4:while( 1 )
>>{
>> /* Read a 16 bits/sample audio frame */
>> fread( in, sizeof( short ), FRAME_SIZE, fin );
>...
2011 Sep 29
1
Nothing but rhythm was left after encoding and decoding by speex on ipad(XCode 4.1 48110)
...clude config.h" in arch.h) and
did the same thing with that on speex 1.0.5.
The following is the code I used to encode and decode, it works
properly in Android 3.0:
static int speexo_encode(const void *in_bytes, void *out_bytes, int size)
{
if (!codec_open)
return 0;
int return_value;
speex_bits_reset(&ebits);
//speex_echo_capture(echo_state, (short*)in_bytes, (short*)in_bytes);
//speex_preprocess_run(prep_state, (short*)in_bytes);
speex_encode_int(enc_state, (short*)in_bytes, &ebits);
if(speex_bits_nbytes(&ebits) >= (int)size) {
return_value = 0;
}
else {
return_v...
2009 Sep 03
1
Speex-dev Digest, Vol 64, Issue 2
...rQuality );
> > speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_VBR,
> > &disabled );
> > speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_DTX,
> > &disabled );
> >
> > // init encoder
> > speex_bits_init( &codecBits );
> > speex_bits_reset( &codecBits );
> >
> > // determine encoded bytes per frame with spx_int16_t type, speex can
> > work with float;s, but not in this engine
> > speex_encode_int( pCodecEncoderState, (spx_int16_t*)pCodecBuffer,
> > &codecBits );
> > encodedFrameByt...
2011 Nov 16
2
Just getting noise
...fer,size_t inputSize,
size_t& outputSize)
{
short *in=(short*)inputBuffer;
float *input = new float[(inputSize/2)]();
int nbBytes;
int i;
for (i=0;i<(inputSize/2);i++)
{
input[i]=in[i];
}
/*Flush all the bits in the struct so we can encode a new frame*/
speex_bits_reset(&mBits);
/*Encode the frame*/
speex_encode(mState, input, &mBits);
nbBytes = speex_bits_nbytes(&mBits);
char* cbits = new char[nbBytes]();
/*Copy the bits to an array of char that can be written*/
nbBytes = speex_bits_write(&mBits, cbits, nbBytes);
outputSi...
2005 Oct 04
1
Strange Problem
...speex_wb_mode" instead of "speex_nb_mode".
My encoding code:
bool
SPEEX16::Encode(const std::string& raw, std::string&
encoded)
{
speex_bits_reset(&bits);
speex_encode_int(state, (short*)raw.data(), &bits);
int nbytes = speex_bits_nbytes(&bits);
encoded.resize(nbytes);
speex_bits_w...
2005 Jul 20
1
Speex Windows from 1.1.6 source
...r and encoded audio
As input for decoder, instead of files input.
My Problem is the audio played on the receiving side after decoding
Is only a "hush" or it is pure noise.
Below is my code, that I have used for encoding and decoding.
/************** Encode ******************/
speex_bits_reset(&Encbits);
psInput = (short *)InputBuf;
iIndex = 80;
memset(OutputBuf,0,(200 * sizeof(float)));
/*Copy the 16 bits values to float so Speex can work on them*/
for (i=0;i<iIndex;i++){
/* float */pfEncBuf[i]=/* short */psInput[i];
}
/*Encode the fra...
2010 Apr 14
3
Decoded output buffer size
...0 bytes:
UINT CSpeexCodec::Encode( float *inBuff,
const char**outBuff,
UINT BufferFrames )
{
speex_encoder_ctl(spx_state_,
SPEEX_GET_FRAME_SIZE,
&spx_frame_size_);
while (BufferFrames>0)
{
speex_bits_reset(&spx_bits_);
speex_encode(spx_state_, inBuff, &spx_bits_);
nbBytes += speex_bits_write(&spx_bits_,
spx_enc_frame_,
spx_frame_size_);
inBuff+= spx_frame_size_;
BufferFrames -= spx_frame_size_;
}
..nbByte...
2004 Aug 06
2
encoder/ decoder sharing SpeexBits
>From the sample encoder/ decoder demo in the documentation it seems that I
only have to call speex_bits_reset before encoding a new frame. Is this
still the case if I reuse the SpeexBits to both encode and decode different
streams?
Thanks,
-- Daniel, Epic Games Inc.
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list,...
2010 Apr 13
1
Another newbie question on encoding
...w char[frameSize_];
speex_bits_init(&spx_bits_);
}
UINT CSpeexCodec::Encode( float *inBuff,
char **outBuff,
UINT BufferFrames )
{
INT nBytes = 0;
float *pBuff = inBuff;
if (!spx_state_) return 0;
while (BufferFrames>0)
{
speex_bits_reset(&spx_bits_);
speex_encode(spx_state_, pBuff, &spx_bits_);
nBytes += speex_bits_write(&spx_bits_, outBuffer_, frameSize_);
pBuff += frameSize_;
BufferFrames -= frameSize_;
}
// Point the outBuff to the internal buffer
*outBuff = outBuffer_;
return nBytes;
};
2010 Apr 15
2
Decoded output buffer size
...e manual) is how to
decode a multi-frame payload.
Once have called speex_bits_read_from, I need a way to know how many
speex frames there are, how can I do this?
I try to use speex_bits_remaining, but after some cycles it returns
always 4.
UINT DecodePayload( char* payload, UINT payload_len )
{
speex_bits_reset(&spx_bits_);
speex_bits_read_from(&spx_bits_, payload, payload_len);
UINT nbBytes = speex_bits_remaining(&spx_bits_);
while (nbBytes>0)
{
speex_decode(spx_state_, &spx_bits_, spx_dec_frame_);
nbBytes = speex_bits_remaining(&spx_bits_);
// Save the speex...
2004 Sep 12
2
Speex encoding/decoding producing garbled audio
...;
// Convert the audio to a short then to a float buffer
for (int i = 0; i < 160; i++)
{
memcpy(&speexShort, &buffer[i*2], sizeof(short));
speexFloat[i] = speexShort;
}
// Encode the sound data using the float buffer
speex_bits_reset(&mBits);
speex_encode(mEncode, speexFloat, &mBits);
encodeSize = speex_bits_write(&mBits, encodedBuffer, 160);
delete[] speexFloat;
// Return the encoded buffer
return encodedBuffer;
}
4) I immediately decode the encoded buffer. Encoded size is a...
2007 Apr 03
2
Please help, very important (not for fun)
...ence to `speex_nb_mode'
sampleenc.cc:(.text+0x1f): undefined reference to `speex_encoder_init'
sampleenc.cc:(.text+0x43): undefined reference to `speex_encoder_ctl'
sampleenc.cc:(.text+0x6f): undefined reference to `speex_bits_init'
sampleenc.cc:(.text+0xea): undefined reference to `speex_bits_reset'
sampleenc.cc:(.text+0x106): undefined reference to `speex_encode'
sampleenc.cc:(.text+0x123): undefined reference to `speex_bits_write'
sampleenc.cc:(.text+0x181): undefined reference to `speex_encoder_destroy'
sampleenc.cc:(.text+0x18c): undefined reference to `speex_bits_destroy&...
2009 Sep 03
0
voice sound like robot voice :)
...ate, SPEEX_SET_QUALITY,
> &encoderQuality );
> speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_VBR,
> &disabled );
> speex_encoder_ctl( pCodecEncoderState, SPEEX_SET_DTX,
> &disabled );
>
> // init encoder
> speex_bits_init( &codecBits );
> speex_bits_reset( &codecBits );
>
> // determine encoded bytes per frame with spx_int16_t type, speex can
> work with float;s, but not in this engine
> speex_encode_int( pCodecEncoderState, (spx_int16_t*)pCodecBuffer,
> &codecBits );
> encodedFrameBytes = (uint)speex_bits_nbytes(...
2011 Dec 22
2
Decoding only a certain frame results in different values than when decoding the entire file
...input[j] = sinBuf[inBufpos];
inBufpos++; j++;
}
while ((inBufpos % 160 != 0) && (inBufpos != (inlen/2)));
//fill the rest with null
if (inBufpos == (inlen/2))
for (j=(inBufpos%160); j<160; j++) input[j] = 0;
speex_bits_reset(&bits);
speex_encode(encstate, input, &bits);
/*Copy the bits to an array of char that can be written*/
speex_bits_write(&bits, cbits, MAX_FRAME_BYTES);
for (j=0; j<62; j++)
{
outBuf[outBufpos] = cbits[j];
ou...