[Speex-dev] Regarding problem with encoding / decoding
vijender at adrin.res.in
Mon Apr 19 22:20:05 PDT 2010
I got the following problem with speex. Could you help me to resolve the following issue.
Description: I am taking speech input from MIC storing in a buffer after that i will encode by using speex then decoding and sending to output(speakers).
it is small demo project of speech encoding/decoding in VC++.
I am reading the data from buffer in the following way where data is short type and buffer is char.
for(int j=0;j < 160;j++)
speex_encode_int(state, data, &bits);
nbBytes = speex_bits_write(&bits, cbits, 200);
outbuffer[k]= (char) nbBytes; // Storing length of encoded data first in outbuffer
int writ= k+nbBytes,m=0;
for(k=k+1;k<= writ; k++) // storing the encoded data in outbuffer
I am repeatedly doing until the input buffer is over. The encoded data is storing in outbuffer.
I am reading first byte stored in size variable then reading the data.
psize = buffer[i]; //size of the encoded data frame
for(int k=i+1; k <= i+psize;k++)
cbits[j++]= buffer[k]; //Reading encoded data
speex_bits_read_from(&bits, cbits, psize);
/*Decode the frame*/
speex_decode_int(state, &bits, data);
for(k=0;k< 160; k++)
outbuffer[m++]= data[k]; //Storing the decoded frame in char outbuffer
After completion of all encoded data. If i play the outbuffer
i am getting full noise. I am hearing voice with very low sound, noise is dominating the speech.
I didn't talk also i am hearing lot of noise from speakers after decoding. I used following preprocess functions also but no use.
int noise_sup=2; // from 2 to 40 and -ve numbers also no use
int noise= 1;
speex_preprocess_ctl(preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &denoise);
Please help me.
Thanks and Regards,
Advaced Data processing Research Institute,
#203,Akber Road,Manovikas nagar,
Ph. no: (040) 27781232
More information about the Speex-dev