I've had trouble getting a definitive answer to this one, so please forgive me for asking here. When converting between integer and float audio samples, what is the preferred scale factor? For example, if you were converting to signed 8-bit, the possible range is -128 to 127. Do you map float -1.0 to -127 or -128? Brendan
In the Opus API (which is different from Speex), the range of float PCM values is +/-1. For the integer API, it's +/- 32768. Jean-Marc On 01/20/2014 04:13 PM, Brendan Bolles wrote:> I've had trouble getting a definitive answer to this one, so please forgive me for asking here. > > When converting between integer and float audio samples, what is the preferred scale factor? > > For example, if you were converting to signed 8-bit, the possible range is -128 to 127. Do you map float -1.0 to -127 or -128? > > > Brendan > > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus >
On Jan 20, 2014, at 1:18 PM, Jean-Marc Valin wrote:> In the Opus API (which is different from Speex), the range of float PCM > values is +/-1. For the integer API, it's +/- 32768.Interesting. Even though SHRT_MAX is 32767? Does that mean you never get a +1.0 float result when using the integer API? I just noticed that SHRT_MIN for OS X is -32768, while this page says it would be -32767. http://www.cplusplus.com/reference/climits/ Brendan