fold function
Shifts int x
of bit width bits
up by half the total range, then wraps
any overflowing values around to maintain the bit width. This is used to
convert between signed and unsigned PCM.
Implementation
int fold(int x, int bits) => (x + (1 << (bits - 1))) % (1 << bits);