[Speex-dev] Noise problem while encoding and decoding

OuyangWW oovoov008 at gmail.com
Tue Jul 22 23:17:51 PDT 2008


Thank you for your reply! But the problem has not been solved yet.

I thought these two programs are designed for raw devices. In Page36
of "TheSpeexCodecManual Version1.2Beta3", it sais:
"
This section shows sample code for encoding and decoding speech using
the Speex API. The commands can be used to encode
    and decode a file by calling:
    % sampleenc in_file.sw | sampledec out_file.sw
    where both files are raw (no header) files encoded at 16 bits per
sample (in the machine natural endianness).
"
Because the programs don't work, so I modify part of the code. I
change the type of "in " and "out" from "short" to "char". The reason
i make this modify is that i found /dev/dsp encoded at 8 bits per
sample. I also modify relevant file operation. But the problem is
still there. I also tried "unsigned char", but still the same.



2008/7/20, xiphmont at xiph.org <xiphmont at xiph.org>:
> 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.
>
> 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.
>
> Monty
>


More information about the Speex-dev mailing list