2020-09-04: The custom sox recipes patch has been accepted by MPD on the master branch!
2020-09-14: The custom sox recipes are part of the upcoming moOde 7.0.0 release. MoOde even provide a nice GUI for it.
MPD can use the famous soxr library for resampling. Soxr is very flexible with the configuration of the resampler. Only MPD only provide the default recipes with the quality
setting.
You can find a lot on internet about the usage of soxr or sox (the commandline version of soxr) , including a kind of measurements.
The patch mpd-0.21.x_soxr_customrecipe.patch (or for mpd-0.22~git) will add settings to MPD section of the resampler. In only unlock the already present settings in soxr, the functionality of sox is untouched.
Setting | Description | default |
precision | Number of used bits [16|20|24|28|32] | 20 (matches HQ) |
phase_response | 0 =MINIMUM_PHASE, 50=LINEAR_PHASE, intermediate is between those. | 50 |
passband_end | Original bandwidth of source used (%, < 100) | 95.0% |
stopband_begin | (% > 100) | 100.0% |
attenuation | Lowers the source to prevent clipping. Expressed in db. | 0 db |
flags | Bit fields: 01 ROLLOFF_SMALL 0.01 dB 01 ROLLOFF_MEDIUM 0.35 dB 02 ROLLOFF_NONE For Chebyshev bandwidth. 08 HI_PREC_CLOCK Increase `irrational’ ratio accuracy. 16 DOUBLE_PRECISION Use D.P. calcs even if precision <= 20 32 SOXR_VR Variable-rate resampling. | 0 |
To enable the custom recipe the quality
should be set to "custom"
. If another quality is selected and the custom settings are still present you will get warnings in the MPD log about unused settings.
Example MPD configuration:
resampler { plugin "soxr" quality "custom" threads "2" precision "24" phase_response "45" passband_end "95.0" stopband_begin "100.0" attenuation "1.0" flags "0" }