dofuuz / python-soxr

Fast and high quality sample-rate conversion library for Python
Other
75 stars 6 forks source link

Fix dithering of 16bit output #12

Closed dofuuz closed 1 year ago

dofuuz commented 1 year ago

For Reproducible Science™

Fix periodic 0s in dithering

Fix https://github.com/dofuuz/python-soxr/issues/11 https://sourceforge.net/p/soxr/discussion/general/thread/5d68180432/

Make 16bit dithering deterministic for reproducibility

Fix https://github.com/dofuuz/python-soxr/issues/10

dofuuz commented 1 year ago

Further thoughts

libsoxr's dithering uses LCG random and its multiplier(1664525) may not be sufficient for 64bit int. Good(and larger) multipliers are available, but it may slow down processing. Related paper: https://arxiv.org/abs/2001.05304

libsoxr uses triangle dither and it may be improved by adding HPF. Implemention of Audacity

Anyway, impact of dithering is not big. So I'll just fix bug and make it deterministic for now.