<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=281512916-02112006><FONT face=Arial color=#0000ff 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 face=Arial color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=281512916-02112006><FONT face=Arial color=#0000ff
size=2>8</FONT></SPAN><SPAN class=281512916-02112006><FONT face=Arial
color=#0000ff size=2>-bit audio is not something you would ever want to
use.</FONT></SPAN></DIV>
<DIV><SPAN class=281512916-02112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=281512916-02112006><FONT face=Arial color=#0000ff size=2>--
john</FONT></SPAN></DIV>
<DIV><SPAN class=281512916-02112006><FONT face=Arial color=#0000ff size=2>RAD
Game Tools</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid">
<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 face=Arial color=#0000ff 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 face=Arial
color=#0000ff 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 face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff
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 face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff
size=2> static FILE *hack =
fopen("test.raw","wb");</FONT></SPAN></DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff
size=2> fwrite(output, 2, FRAME_SIZE,
hack);</FONT></SPAN></DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff
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 face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff size=2>--
john</FONT></SPAN></DIV>
<DIV><SPAN class=828115605-02112006><FONT face=Arial color=#0000ff size=2>RAD
Game Tools</FONT></SPAN></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,255) 2px solid">
<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
href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg"
target=_blank rel=nofollow>Yahoo! Time Capsule</A> and be a part of internet
history.
<DIV>_______________________________________________<BR>Speex-dev mailing
list<BR>Speex-dev@xiph.org<BR><A
href="http://lists.xiph.org/mailman/listinfo/speex-dev" target=_blank
rel=nofollow>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
href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg"
target=_blank rel=nofollow>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
href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://timecapsule.yahoo.com/capsule.php?intl=sg">Contribute
now!</A></BLOCKQUOTE></BODY></HTML>