## Converting samples to 8 bit

**category:**music [glöplog]

I know experimentally that truncating lower 4 bits in unsigned 8-bit samples produces a lot more noise compared to the proper rounding. I am keen to learn why, because it surprised me too.

The statistical mean error is higher for truncation. Maybe the easiest way to visually imagine this is that for truncation, the maximum "distance" a sampling point has to "move" is almost 1, while for rounding, it's 0.5.

The problem was not the noise, now that I think of it. It was the addition of discretization noise (i.e. you take properly filtered 8KHz sample, truncate to 4 bits - and it sounds ok, just quantized, but if you try rounding to 4 bits, you get a bonus: 8KHz whine).

FYI: http://www.audiocheck.net/audiotests_dithering.php

If you get 8 kHz whine on a 8 kHz sample, you're breaking the laws of physics. Congrats ;-)

Well, actually I don't.

For those who want to understand the ins and outs of dithering, and are not afraid of a long read, I can recommend this thesis. It's primarily about 2D dither, but it starts off in 1D (ie., audio) to explain the basics.

Thanks for the link Sesse!

I forgot about this video; it's shorter and less math-heavy :-)

Good presentation! but the beard distracts :)

Sesse, thank you.

Great topic, and thanks for AmigaPal. Didn't know it existed. Now we are just waiting for Hoffmans tools for pure 8bit mayhem.

Actually, A#3 finetune +3 (period 123 - 28836Hz) is the highest safe rate for the Amiga DMA at normal video modes, so I'd stick with that if you aim for a sample that is supposed to be played at one rate (note) only. Going higher than that will actually still result in 28836Hz, but with gaps/cracking noises.

Anyways as said before, normalize samples (max gain without clipping) before downsampling to 8-bit, to get less quantization errors. If your sample is supposed to be played at a set of different rates, then I'd not recommend adding dither. In fact, dither can still sound bad even if you play the sample at only one rate, as 28836Hz is quite low.

Anyways as said before, normalize samples (max gain without clipping) before downsampling to 8-bit, to get less quantization errors. If your sample is supposed to be played at a set of different rates, then I'd not recommend adding dither. In fact, dither can still sound bad even if you play the sample at only one rate, as 28836Hz is quite low.

Sorry, that was supposed to be A#3 finetune -3 (or A-3 finetune +5).