README.md

December 31, 2025 ยท View on GitHub

A Magisk module resampling for cheapies

This module has been developed for casual users to overide re-sampling parameters of AudioFlinger (the system-wide mixer) in my other modules ("Audio misc. settings" and "Hifi Maximizer") so as to significantly improve audio quality of LDAC Bluetooth earphones and DAC's under $30 (probably) especially when replaying 48 kHz tracks up-sampled over or equal to 96 kHz & 24 or 32 bits by AudioFlinger except the quality of internal speakers and a 3.5 mm jack receiving 48 kHz audio data without re-sampling by AudioFlinger. If you are an audiophile expert, please use "extras/change-resampling-quality.sh" in "USB SampleRate Changer" which can change the parameters on the fly flexibly.

By the way, although most people might wonder how this module improve the audio quality of such devices, it is accomplished by very long filter length re-sampling near ideally (almost without pre-echo, ringing (post-echo) and aliasing noise) cutting off a frequency zone from just above 20 kHz filled with ultrasonic noise (although most people believe part of natural sound) generated by high frequency dithering (also called delta-sigma modulation, noise-shaping, super bit-mapping, etc.) at recording time and even 16 bits noise-shaping rounding output time (e.g., Opus decoders), and deteriorating audible sound like a thin veiling smokescreen by intermodulation significantly amplified by large amplification non-linearity of LDAC Bluetooth earphones and DAC's under $30. Furthermore this can be considered to be a kind of decimation filtering from 48 kHz & 16 bits samples (having dynamic range larger than usual 16 bits limit with ultrasonic noise) to 40 kHz & 24 or 32 bits ones except the ultrasonic noise by hight frequency dithering. So it has little effect when using AAC and SBC codecs which transmit audio data by 44.1 kHz & 16 bits.

However, as the noise has a merit adding mellowness into audible sound in the case of none cheap DAC's having very small amplification non-linearity, please use this module only when using LDAC Bluetooth earphones (any devices, as far as I know) and DAC's under $30 (typically using DAC chip CX31993, ALC5686, KT0210, etc.).

Finally, this module is designed to override re-sampling parameters set by my other modules, but can be used by itself only. You can install this module and enjoy its effect whether you are using one of them together or not.

Notes:

  • If you feel your LDAC earphones or "cheapie" DAC wouldn't become to sound good at all, try editting "service.sh" script in the installed place or its ZIP archive so as to replace "83" in it with "84" or "85" for appropriately cutting off ultrasonic noise causing intermodulation.
  • This module doesn't have the effect for Hires. tracks (greater than 48 kHz sample rate) which not having large pre-echo and ringing, and high frequency dithering noise, except ultrasonic noise added on purpose for mellowness. Anyhow, if you want to improve the quality of only Hires. tracks on "cheapie" devices, edit "service.sh" script in the installed place or its ZIP archive as described in the script.
  • LDAC earphones and DAC's deteriorate the quality more or less by their internal over-sampling filtering when receiving low sample rate data.
  • Don't forget disabling "A2DP hardware offload" on Snapdragon devices (if you can), because it forces post re-sampling (48 kHz to 96 kHz) and it is so much worse than this re-sampling.
  • Also don't forget disabling "Absolute Volume" of Bluetooth devices in developer settings and setting a volume at the device side to be maximum for the best audio quality by avoiding analog low-pass filtering on portable devices having very large input parasitic capacitance.


  • Appendix A. Examples of Re-sampling Parameters :

    Stop band attenuation (dB)Half filter lengthCut-off (%)Stop band (%)Memo
    AOSP parameters:----
    9032100Default Quality
    8016100LOW Quality
    8416100MED Quality
    9832100HIGH Quality
    Parameters of Audio misc. settings:----
    15948092Old devices of A11 and earlier
    165360104Low performance devices of A12 and later with audio ones having small amp. non-linearity
    17940899General purpose on A12 and later for audio devices having small amp. non-linearity
    19452098Ultra Hi-Fi for audio devices having small amp. non-linearity
    Parameters of this module:----
    19452091 ~ 94AAC or Flac 44.1kHz; for LDAC BT earphones and DAC's under $30 both having large amp. non-linearity
    19452083 ~ 86Opus 48kHz; for LDAC BT earphones and DAC's under $30 both having large amp. non-linearity
    19452042,43Hires. 96kHz; for LDAC BT earphones and DAC's under $30 both having large amp. non-linearity
    External examples:----
    10029(91)109AK4493 (Sharp roll-off N-fold over-sampling)
    15042(91)109AK4191EQ (Sharp roll-off N-fold over-sampling)
    12035(97)110ES9038PRO (Fast roll-off N-fold over-sampling)
    vary 50 ~ 1183496(398)ES9039PRO (Fast roll-off N-fold over-sampling)
    11040(96)109CS43131 (Fast roll-off N-fold over-sampling)
    11040(96)109CS43198 (Fast roll-off N-fold over-sampling)
    9813098.5MacOS Leopard (guess)
    15924099iZotope, No-Alias (guess)
    1006499SoX HQ linear phase (guess)
    17052099SoX VHQ linear phase (guess)
    • % in "Cut-off" and "Stop band" (starting from) fields means the proportion to the Nyquist frequency.
  • Appendix B. Characteristics of Re-sampling Parameters :

    CategoryBackground opaqueness (aliasing noise)Pre-echo and ringingMellowness (intermodulation)Memo
    DAClightheavyheavyAK4491EQ Sharp roll-off
    DACmediummediumlightES9039PRO Fast roll-off
    Mastering toolslightslightlightiZotope, No Alias (guess)
    Audio misc. settingsalmost nonealmost nonelightUltra Hi-Fi
    Audio misc. settingsvery slightvery slightmediumfor low performance devices
    Audio misc. settingsslightalmost nonealmost nonefor old devices
    This modulealmost nonealmost nonevery slightfor LDAC BT earphones and DAC's under $30


DISCLAIMER

  • I am not responsible for any damage that may occur to your device, so it is your own choice whether to attempt this module or not.