volumio / Volumio2

Volumio 2 - Audiophile Music Player
http://volumio.org
Other
1.37k stars 315 forks source link

improve softvol quality #1323

Open balbuze opened 7 years ago

balbuze commented 7 years ago

softvol is often not used because it reduces the sound quality. It is true as it use a basic linear interpolation to change the volume. And in general, each time you use a plug in alsa (plughw) a resample is done with the default resampler. But it can be improved using a other resampler. One of the most interessant is speexrate, better and no to much cpu eater. To use it we need to install libasound2-plugins and then add in asound.conf a line defaults.pcm.rate_converter "speexrate_best". source https://github.com/Themaister/alsa-plugins-rsound/blob/master/doc/speexrate.txt

nilsbecker commented 7 years ago

I would add that this setting could obviate the need for any sampling rate conversion in mpd. In my opinion, alsa is a better place to do resampling than mpd -- for example, input from shairport-sync can be resampled as well, if this is required. there is no significant loss of quality compared to the current way of resampling, since speexrate is of similar quality to soxr.

it seems to me that the best solution is still no resampling and hardware volume control. second best if that is not possible -- resampling by speexrate within alsa; removal of resampling within mpd.

for some discussion, see the resampling in section here: https://wiki.archlinux.org/index.php/Talk:Advanced_Linux_Sound_Architecture

and for raw results: https://lastique.github.io/src_test/ or this page: http://src.infinitewave.ca/ (choose SoX VHQ and Xiph.org speex quality 10)

nilsbecker commented 7 years ago

i just saw that for some reason speex at quality 10 is much slower than soxr at vhq setting in the tests on lastique.github.io . this is surprising to me. all i can say is that if i configure my rpi3 to use speexrate_best, there are no problems doing realtime sample rate conversions from various original rates to 88.2 in stereo.