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.
added on the 2017-05-16 14:37:40 by introspec introspec
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).
added on the 2017-05-16 14:42:10 by introspec introspec
FYI: http://www.audiocheck.net/audiotests_dithering.php
added on the 2017-05-16 15:06:48 by rp rp
If you get 8 kHz whine on a 8 kHz sample, you're breaking the laws of physics. Congrats ;-)
added on the 2017-05-16 15:42:54 by Sesse Sesse
Well, actually I don't.
added on the 2017-05-16 15:48:49 by introspec introspec
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.
added on the 2017-05-16 15:57:32 by Sesse Sesse
Thanks for the link Sesse!
added on the 2017-05-16 15:59:14 by trc_wm trc_wm
I forgot about this video; it's shorter and less math-heavy :-)
added on the 2017-05-16 16:26:39 by Sesse Sesse
Good presentation! but the beard distracts :)
added on the 2017-05-16 17:07:10 by trc_wm trc_wm
Sesse, thank you.
added on the 2017-05-16 17:21:18 by introspec introspec
Great topic, and thanks for AmigaPal. Didn't know it existed. Now we are just waiting for Hoffmans tools for pure 8bit mayhem.
added on the 2017-05-24 11:46:52 by mayor mayor
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.
added on the 2017-05-26 19:10:44 by 8bitbubsy 8bitbubsy
Sorry, that was supposed to be A#3 finetune -3 (or A-3 finetune +5).
added on the 2017-05-26 19:11:37 by 8bitbubsy 8bitbubsy