<FONT size=2>  <div>Hi everyone,</div>  <div>&nbsp;</div>  <div>Our team&nbsp;is working on a realtime voice communication application.&nbsp;We are using openAL 1.1 to capture the samples and then encode them using speex. On the remote machine&nbsp;we decode the samples and play them using openAL again. Capture and play formats for the samples is AL_FORMAT_MONO16 and frequency is 22050.&nbsp;we are&nbsp;using wide band encoding/decoding. </div>  <div>&nbsp;</div>  <div>The encoding sample frame buffer size is returned by speex as 320, on both ends ( </FONT><FONT face="Courier New" size=2>speex_encoder_ctl(m_poSpeexState, SPEEX_GET_FRAME_SIZE, &amp;nFrameSize) ).</FONT></div>  <div><FONT face="Courier New" size=2>&nbsp;</div></FONT><FONT size=2>  <div>Coming to the problem, when I play the sound I get a high picthed noise in the background. I do hear my voice with a decreased quality but the noise keeps running in the background whether I talk or not.</div> 
 <div>&nbsp;</div>  <div>&nbsp;</div>  <div>Here are the two main encoding/decoding function I am using</div>  <div>&nbsp;</div>  <div>//------------------------------------------------------------------------------------------</div>  <div>&nbsp;</div></FONT><FONT color=#0000ff size=2>  <div>void</FONT><FONT size=2> OALCapture::Compress(ALchar* pData, </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> *iFrameSize, </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2>* cComFrame)</div>  <div>{</div>  <div></FONT><FONT color=#008000 size=2>// Reset speex bits before frame encode</div></FONT><FONT size=2>  <div>speex_bits_reset(&amp;m_oBits);</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nFrameSize = 0;</FONT></div>  <div><FONT size=2>speex_encoder_ctl(m_poSpeexCompressState, SPEEX_GET_FRAME_SIZE, &amp;nFrameSize);</FONT></div>  <div><FONT size=2>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Our samples are 2
 bytes each so number of samples is actually</div></FONT><FONT size=2>  <div></FONT><FONT color=#008000 size=2>// have the buffer size</div></FONT><FONT size=2>  <div></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nBuffSize = BUFFERSIZE / 2; </FONT></div>  <div><FONT size=2>&nbsp;</div>  <div></div>  <div></FONT><FONT color=#008000 size=2>// Now copy the samples into the float array that we will encode</div></FONT><FONT size=2>  <div></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = 0; i &lt; nBuffSize; i++)</div>  <div>input[i] = ( (pData[(i*2) + 1] &lt;&lt; 8) | (pData[(i*2)] &amp; 0xff) ) / 32768.0f;</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Provide speex with the float array pointer to compress</div></FONT><FONT size=2>  <div>speex_encode(m_poSpeexCompressState, input, &amp;m_oBits);</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Write the
 encoded bytes into our array</div></FONT><FONT size=2>  <div>speex_bits_insert_terminator(&amp;m_oBits);</div>  <div>nbBytes = speex_bits_write(&amp;m_oBits, cbits, BUFFERSIZE);</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Set the number of bytes of encoded message</div></FONT><FONT size=2>  <div>*iFrameSize = nbBytes;</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Copy encoded bytes into return array</div></FONT><FONT size=2>  <div>memcpy(cComFrame, cbits, nbBytes);</div>  <div>}</div>  <div>&nbsp;</div>  <div>//------------------------------------------------------------------------------------------</div>  <div>&nbsp;</div></FONT><FONT color=#0000ff size=2>  <div>int</FONT><FONT size=2> OALCapture::Decompress(ALchar* pDecomData, </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> iFrameSize, </FONT><FONT color=#0000ff size=2>char</FONT><FONT size=2>* cComFrame)</div>  <div>{</div>  <div></FONT><FONT color=#008000
 size=2>// Set the decompress bits</div></FONT><FONT size=2>  <div>speex_bits_read_from(&amp;m_oDecompressBits, cComFrame, iFrameSize);</div>  <div>&nbsp;</div>  <div></div>  <div></FONT><FONT color=#008000 size=2>// Decode the bits into an output float array</div></FONT><FONT size=2>  <div>speex_decode(m_poSpeexDecompressState, &amp;m_oDecompressBits, output);</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>// Get the number of samples returned by the decoder</div></FONT><FONT size=2>  <div></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nSamplesDecoded = 0;</div>  <div>speex_decoder_ctl(m_poSpeexDecompressState, SPEEX_GET_FRAME_SIZE, &amp;nSamplesDecoded);</div>  <div>&nbsp;</div>  <div></FONT><FONT color=#008000 size=2>//nSamplesDecoded /= 2;</div></FONT><FONT size=2>  <div></FONT><FONT color=#008000 size=2>// Now we have to convert the floats back into our AL sample format</div></FONT><FONT size=2>  <div></FONT><FONT color=#008000 size=2>//
 which takes 2 bytes integer value for each sample</div></FONT><FONT size=2>  <div></FONT><FONT color=#0000ff size=2>short</FONT><FONT size=2>* pALBuffer = (</FONT><FONT color=#0000ff size=2>short</FONT><FONT size=2>*) pDecomData;</div>  <div></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> i = 0; i &lt; nSamplesDecoded; i++)</div>  <div>{</div>  <div>pALBuffer[i] = output[i] * 32768.0f;</div>  <div>}</div>  <div>&nbsp;</div>  <div>nSamplesDecoded *= 2;</div>  <div></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> nSamplesDecoded;</div>  <div>}</div>  <div>&nbsp;</div>  <div>//------------------------------------------------------------------------------------------</div>  <div>Here are the issues I can think of</div>  <div>&nbsp;</div>  <div>1.</div>  <div>My buffer size is 640 bytes as each sample is of 2 bytes and the frame buffer size if 320 samples as required by speex. I have tried changing
 this buffer size and the result is a different type of noise, much worse then what I currently get. </div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div>Speex returns the same frame size for non-compressed and decompressed data although the quality of decompressed data has reduced.</div>  <div>&nbsp;</div>  <div>2. </div>  <div>Should we get a smaller frame size for low quality decoded data ?</div>  <div>&nbsp;</div>  <div>3. </div>  <div>Is the sound format the same (AL_FORMAT_MONO16, 22050) for both data ?</div>  <div>&nbsp;</div>  <div>We are in a critical development period, so any quick response will be really helpful to me. </div>  <div>&nbsp;</div>  <div>Thanks,</div>  <div>&nbsp;</div>  <div>Ali Khan.</div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div>&nbsp;</div></FONT><p>&#32;
                <hr size=1>Yahoo! Messenger with Voice. <a href="http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com">Make PC-to-Phone Calls</a> to the US (and 30+ countries) for 2¢/min or less.