[Speex-dev] Noise problem while encoding and decoding

xiphmont at xiph.org xiphmont at xiph.org
Sat Jul 19 20:42:18 PDT 2008

On Sat, Jul 19, 2008 at 12:29 PM, 欧阳微微 <oovoov008 at gmail.com> wrote:
> Hi, everyone!
> I'm a newbie of speex develog. I tried to encode and decode with the
> sample program in the speex manual. I compile those program with
>    gcc sampleenc.c -o enc -lspeex
>    gcc sampledec.c -o dec -lspeex
> I run these two program in this way and then speak loudly:
>    ./enc /dev/dsp ¦ ./dec /dev/dsp

/dev/dsp is a raw device that does not include any format headers.
There's no way for the encoder to guess reliably the format of the
incoming data, and the defaults assumed by the two don't match.  Very
likely the same for playback; the playback device simply assumes some
input format and if you pipe data to it, there's no format setup at

All the settings have to agree, and you have to declare them
explicitly because you're using raw devices.  Or use actual programs
for record and playback that properly header their data.

> However, the voice  is very clear if I run the following command:
> cat from > /dev/dsp

Sure, because the input and output defaults from the raw devices
match.  If, however, you try to import that data in any audio editor
or manipulation program, it would say 'huh?'.

My guess: The default is 8000Hz mono no idea is 8 or 16 bit.


More information about the Speex-dev mailing list