[Speex-dev] Question on speex_encode_int

Jim Crichton jim.crichton at comcast.net
Mon May 22 03:12:02 PDT 2006

----- Original Message ----- 
From: "Kevin Jenkins" <gameprogrammer at rakkar.org>
To: <speex-dev at xiph.org>
Sent: Sunday, May 21, 2006 11:17 PM
Subject: [Speex-dev] Question on speex_encode_int

> This is a simple question I hope someone can help with.
> speex_encode_int takes a short - which is two bytes.  Suppose I want to 
> record my data as 8 bit input.  Can I pass a char to speex instead, and if 
> so will this halve my bandwidth usage?  If I do pass a char, is there any 
> special data formatting I need to do so speex will understand it?

The Speex bandwidth usage depends on the sample rate (among other things), 
but not on the sample precision.  If you pass Speex samples in the 
range -127 to 127, you will get noisier results than if you pass samples in 
the range -32767 to 32767, but the Speex encoder will produce the same 
number of bits.

By the way, in the telephone world, where 8-bit samples are used, these are 
actually 13 or 14-bit samples encoded with the u-Law or a-Law algorithm. 
You would expand these samples back to the original 13 or 14-bit range 
before feeding them to Speex.

- Jim 

More information about the Speex-dev mailing list