以 pc 为例:
设: 转换 的值为 X_short_sample;
因为: n_int_sample / int_Max = X_short_sample / short_Max;
所以: X_short_sample = ( n_int_sample * short_Max ) / int_Max ;
其它相关格式转换,原理应该一样;
float 转换稍微麻烦,可以简化,如: float to short :
> 0 : 取整;
<0 : 取0;
如果想要精确参考如下:
webrtc 提供的 short 和 float 的转换:
// The conversion functions use the following naming convention:
// S16: int16_t [-32768, 32767]
// Float:&nb