3 ms·
Suppose you have an unsigned 16-bit integer signal of [0, 1, 3, 2000]. You want to multiply every value by some scaling constant so that the maximum value is 65
by nayuki 4y ago
Suppose you have an unsigned 16-bit integer signal of [0, 1, 3, 2000]. You want to multiply every value by some scaling constant so that the maximum value is 65535.
So the multiplier is 65535/2000, and the intermediate result is [0, 32.7675, 98.3025, 65535]. But because the output must be integers, so decimals will get rounded off.
It is possible to restore the original numbers exactly if you know the scaling factor, but it's an extra complication that is not worth the hassle. It's better not to burn the normalization into the CD rip; it's better to do normalization on the fly at playback time.