MPD with custom Sox recipes

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.

SettingDescriptiondefault
precisionNumber of used bits [16|20|24|28|32]20 (matches HQ)
phase_response0- =LINEAR, 50-MINIMUM_PHASE, intermediate is between those.50
passband_endOriginal bandwidth of source used (%, < 100) 95.0%
stopband_begin(% > 100)100.0%
attenuationLowers the source to prevent clipping. Expressed in db. 0 db
flagsBit 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"
}

Leave a Reply

Your email address will not be published.