Search code examples
unsignedsignedpcm

Convert 16-bit signed PCM to unsigned 16-bit


I have an audio wave file (*.wav) and I have the audio data formatted in signed 16-bit (from -32767 to +32768). I want to convert them to unsigned 16-bit (from 0 to +65535).

Is there any idea how to do that using Audacity, SoX or any other tool? Even a C program is welcome.

Thanks.


Solution

  • Add 32768 to each sample. Note that this is equivalent to inverting the MSB (most-significant bit) of each sample.