Open DavidKnight247 opened 6 years ago
Additionally Dither applied to the 16bit signal may improve sound quality at 8 bits.
The quantization is already taking place.
Since we are dealing with 2 bits of audio at lower volume levels, I do not think dithering would improve it. Feel free to conduct experiments and report your findings.
Ok, I’ll try dithering the LSB with pseudorandom noise and report back.
I added pseudo-random noise by changing the LSB of the variable dac0. The effect is hard to quantify and I don't feel there is much difference between the dither and no-dither settings. For those wishing to replicate my experiment I include the modified files to test. If anyone can suggest an improvement to my code please let me know.
What about using the 'remaining error' method? If you want to output value A, but, when truncated it is B, record the difference A-B and apply it to the next A sample before truncation. Keep doing that. It only involves a few simple operations and very little storage. @DavidKnight247 can you try this? I don't yet have a build environment set up.
I'm uncertain as to how much processing power this would require but it should help to improve sound quality to a degree at reduced bit depth.
Sample C++ code is available here though there are probably many other examples available online.