Search code examples
caudiopcm

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 every unsigned byte so that 0 becomes -128 and 255 becomes 127? Or is it more complicated? Thanks!


Solution

  • 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.