Available with rpi-update firmware is an experimental audio driver for the Raspberry Pi that should significantly increase the quality of sound produced by the 3.5mm audio jack.
The OP has reimplemented the original PWM-based 11-bit audio @48kHz as 7-bit 2nd-order Sigma-Delta modulated at 781.25kHz. The effective noise floor with this scheme approximates that of CD-quality audio DACs.
For more details see the following thread:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445
Implementation in LibreELEC is very simple:
- There has to be the latest firmware. The latest firmware does adress some problems with KODI. vcgencmd version tells me, that the Version on LibreELEC is older and has still this bugs.
- and two parameters in /boot/config.txt: