Skip to content

USB (HAL) Audio Class drivers on Android have a limiter of sample rates at 96kHz. This magisk module unlocks the limiter.

License

Notifications You must be signed in to change notification settings

Magisk-Modules-Alt-Repo/usb-samplerate-unlocker

Repository files navigation

Unlocker for the USB (HAL) audio class driver's limitation (up to 96kHz lock) on Android devices

This magisk module has been developed for recent music streaming services which output greater than 96kHz high resolution sound, and behaves as follows:

  1. Hexdump "/vendor/{lib, lib64}/libalsautils{,v2}.so" to "tempfile{,v2}-{lib, lib64}"

  2. Edit "tempfile{,v2}-{lib, lib64}" to replace

hexdumped "std_sample_rates[]={96000, 88200, 192000, 176400, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000}" (up to 96kHz lock)

  with

hexdumped "std_sample_rates[]={192000, 176400, 96000, 88200, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000}" (up to 192kHz lock)	

  or

hexdumped "std_sample_rates[]={384000, 352800, 192000, 176400, 96000, 88200, 48000, 44100, 32000, 24000, 16000, 12000, 8000}" (up to 384kHz lock)

  or

hexdumped "std_sample_rates[]={768000, 705600, 384000, 352800, 192000, 176400, 96000, 88200, 48000, 44100, 24000, 16000, 8000}" (up to 768kHz lock).
  1. Revert "tempfile{,v2}-{lib, lib64}" to each binary file "$MODDIR/system/vendor/{lib, lib64}/libalsautils{,v2}.so".

  2. Overlay "$MODDIR/system/vendor/{lib, lib64}/libalsautils{,v2}.so" onto "/vendor/{lib, lib64}/libalsautils{,v2}.so"


  • Remark: This module unlocks up to 384kHz unless you have modified "post-fs-data.sh" in its zip file (or "post-fs-data.sh" installed in its "$MODDIR" on your device) except some known devices which don't stutter at 768kHz & 32bit mode. Up to 768kHz unlocking may stutter sound on your device. If you need to automatically connect 192kHz (instead of 384kHz) to your USB DAC, please modify the "post-fs-data.sh" (in this file, "max", "full" and "default" mean "up to 768kHz", "up to 384kHz" and "up to 192kHz" unlocking, respectively).

  • Note: This module unlocks the limiter of Tensor device's USB offload driver from 96kHz to 192kHz by modifying "/vendor/etc/audio_platofrm_configuration.xml".

  • This module has been tested on LineageOS based ROMs (Android 10 ~ 14) and crDroid (Android 11 ~ 14). See also my companion script "USB_SampleRate_Changer" to change the sample rate of the USB audio class driver and a 3.5mm jack on the fly like Bluetooth LDAC or Windows mixer.

  • In details, see "modules/usbaudio/audio_hal.c", "alsa_utils/alsa_device_profile.c" and "alsa_utils/alsa_device_proxy.c" in AOSP sources.

  • If your device uses (USB) audio hardware offloading, its UAC driver is capable of outputting up to 384kHz for Qcomm devices and 96kHz for MTK and Tensor devices. So you may not need this magisk module for Qcomm devices unless considering jitter distortion. Try "USB_SampleRate_Changer".


DISCLAIMER

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

About

USB (HAL) Audio Class drivers on Android have a limiter of sample rates at 96kHz. This magisk module unlocks the limiter.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages