开发者

Converting 8bit unsigned PCM into 8bit signed PCM

How can I convert an unsigned 8bit PCM stream (0-255) into a signed 8bit PCM stream (-128-127). Is it as simple as subtracting 128 from ever开发者_如何学Goy unsigned byte so that 0 becomes -128 and 255 becomes 127? Or is it more complicated? Thanks!


Why dont you try it? In my opinion it should suffice but I don't know what language you are using.

When working with signed and unsigned integer/char bear in mind that the internal representation for negative values is the two's complement. Safest would be to calculate in signed int size to avoid overflows.


For the code you posted in your comment, subtracting 128 will reverse the previous operation and will give you the signed data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜