<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hi,<br><br>I've changed the m_waveFormatEx.wBitsPerSample for both record buffer and playSound buffer, changed my array from char to short and I'm still getting the same constant background noise. I notice that when I talk into the mike, I will get a slightly louder noise, can't hear any clear speech... Any idea what's wrong?<br><br>Regards,<br>Carine<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: John Miles <jmiles@pop.net><br>To: Carine Liang <carineliang@yahoo.com.sg>; speex-dev@xiph.org<br>Sent: Friday, 3 November 2006 12:32:43 AM<br>Subject: RE: [Speex-dev] Integrating speex with VideoNet application: Constantbackground noise<br><br>
<style type="text/css">DIV {
MARGIN:0px;}
</style>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2">Yes,
it's necessary; Speex will encode signed 16-bit PCM data and decode to
the same format. See the examples that come with
it.</font></span></div>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2"> </font></span></div>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2">8</font></span><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2">-bit audio is not something you would ever want to
use.</font></span></div>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2">--
john</font></span></div>
<div><span class="281512916-02112006"><font color="#0000ff" face="Arial" size="2">RAD
Game Tools</font></span></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px;">
<div class="OutlookMessageHeader" dir="ltr" align="left"><font face="Tahoma" size="2">-----Original Message-----<br><b>From:</b> Carine Liang
[mailto:carineliang@yahoo.com.sg]<br><b>Sent:</b> Thursday, November 02, 2006
12:18 AM<br><b>To:</b> John Miles; speex-dev@xiph.org<br><b>Subject:</b> Re:
[Speex-dev] Integrating speex with VideoNet application: Constantbackground
noise<br><br></font></div>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">Hi
John,<br><br>Thanks for your reply. <br><br>Yes, my output device is in 8-bit
mode, same as my input mode. I'm actually working in char (8 bit) arrays. Is
it necessary to work in signed short integers only? I changed all the short
arrays in the example to char. <br><br>Carine<br><br>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">-----
Original Message ----<br>From: John Miles <jmiles@pop.net><br>To:
carineliang@yahoo.com.sg; speex-dev@xiph.org<br>Sent: Thursday, 2 November
2006 2:04:39 PM<br>Subject: RE: [Speex-dev] Integrating speex with VideoNet
application: Constantbackground noise<br><br>
<style type="text/css">DIV {
MARGIN:0px;}
</style>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2">At
first glance it looks like you are opening the output device in 8-bit mode
<font face="Times New Roman"><font color="#000000" size="3">(m_waveFormatEx.wBitsPerSample =8;). <font color="#0000ff" face="Arial" size="2">You will need to use 16-bit mode if you expect to write
an array of signed short integers to the audio buffer.. 8-bit PCM
is an unsigned mode, no longer used much these
days.</font></font></font></font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2">Also, a good debugging trick is to include something like this in your
output sample processing loop:</font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"> static FILE *hack =
fopen("test.raw","wb");</font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"> fwrite(output, 2, FRAME_SIZE,
hack);</font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2">After your app is closed, there will be a file called "test.raw"
in its working directory, which you can load into Sound Forge or a similar
audio editing package for closer inspection without relying on your output
buffers and playback code to work properly.
</font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2">--
john</font></span></div>
<div><span class="828115605-02112006"><font color="#0000ff" face="Arial" size="2">RAD
Game Tools</font></span></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px;">
<div class="OutlookMessageHeader" dir="ltr" align="left"><font face="Tahoma" size="2">-----Original Message-----<br><b>From:</b> speex-dev-bounces@xiph.org
[mailto:speex-dev-bounces@xiph.org]<b>On Behalf Of </b>Carine
Liang<br><b>Sent:</b> Wednesday, November 01, 2006 9:40 PM<br><b>To:</b>
speex-dev@xiph.org<br><b>Subject:</b> Re: [Speex-dev] Integrating speex with
VideoNet application: Constantbackground noise<br><br></font></div>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">Hi,<br><br>Can
someone please help me with my problem below. Any suggestions is
appreciated. <br><br>thanks,<br>Carine<br><br>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">-----
Original Message ----<br>From: Carine Liang
<carineliang@yahoo.com.sg><br>To: speex-dev@xiph.org;
speex-dev@xiph.org<br>Sent: Tuesday, 31 October 2006 1:05:49 PM<br>Subject:
[Speex-dev] Integrating speex with VideoNet application: Constant background
noise<br><br>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div>Hi,<br><br>I am developing a peer-to-peer video conference application
which uses speex as a codec for the voice. <br><br>I am new to speex, so
please bear with me if I asked the obvious. After I added the encode and
decode function to my MFC app, I heard a constant background noise, even
when no one is speaking into the microphone. <br><br>#define FRAME_SIZE
160<br><br>The application is coded in MFC C++. The record buffer is set to
be the same as the FRAME_SIZE such that my callback function is called
everytime 160 bytes of data is recorded.<br><br>Here's what I did in the
initialisation (called only once).<br>m_waveFormatEx.wFormatTag
=WAVE_FORMAT_PCM;<br>m_waveFormatEx.nChannels
=1;<br>m_waveFormatEx.wBitsPerSample =8;<br>m_waveFormatEx.cbSize
=0;<br>m_waveFormatEx.nSamplesPerSec = 8000;<br>m_waveFormatEx.nBlockAlign
=1;<br>m_waveFormatEx.nAvgBytesPerSec = 8000;<br><br>int quality
=8;<br>speex_bits_init(&bits);<br>enc_state =
speex_encoder_init(&speex_nb_mode);<br>speex_encoder_ctl(enc_state,
SPEEX_SET_QUALITY, &quality);<br><br><br>In my recording callback
function<br>LRESULT RecordSound::OnSoundData(WPARAM wParam, LPARAM
lParam)<br>{<br> ....<br> dataPtr = (char *)lpHdr
->lpData;<br> dataSize = (int)lpHdr
->dwBytesRecorded;<br><br> for(int
k=0;k<FRAME_SIZE;k++)<br> input[k] =
dataPtr[k]; //input is
float[FRAME_SIZE]<br> <br>
speex_bits_reset(&bits);<br> speex_encode(enc_state,
input, &bits);<br> encByte =
speex_bits_write(&bits, cbits, 200);<br><br> //send
cbits to peer computer via sockets<br>}<br><br><br>In the receiver's
initialization function, I've initialized the
speex_decoder.<br>speex_bits_init(&bits);<br>dec_state =
speex_decoder_init(&speex_nb_mode);<br><br>In the receiver's socket
function, it reads from socket and store the data in cbits (char
array).<br>{<br> speex_bits_read_from(&bits, cbits,
retvalue); //retvalue is 38<br> speex_decode(dec_state,
&bits, output); //where output is float array<br><br>
for(int k=0;k<FRAME_SIZE;k++)<br> out[k] =
output[k]; //out is a char array<br>
<br> PostThreadMessage( WM_PLAYSOUND_PLAYBLOCK, FRAME_SIZE,
(LPARAM)out );<br>}<br><br><br><br></div></div><br>
<hr size="1">
What is the internet to you?<br>Contribute to the <a rel="nofollow" target="_blank" href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg">Yahoo! Time Capsule</a> and be a part of internet
history.
<div>_______________________________________________<br>Speex-dev mailing
list<br>Speex-dev@xiph.org<br><a rel="nofollow" target="_blank" href="http://lists.xiph.org/mailman/listinfo/speex-dev">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br></div></div><br></div></div><br>
<hr size="1">
What is the internet to you?<br>Contribute to the <a rel="nofollow" target="_blank" href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg">Yahoo! Time Capsule</a> and be a part of internet
history.</blockquote></div><br></div></div><br>
<hr size="1">
What will the world find in 2020?<br>Leave a part of your 2006 in the Yahoo!
Time Capsule. <a rel="nofollow" target="_blank" href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg">Contribute
now!</a></blockquote></div><br></div></div><br>
                <hr size=1>
What is the internet to you?<br>
Contribute to the <a href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg">Yahoo! Time Capsule</a> and be a part of internet history.</body></html>