yzyhk904 / USB_SampleRate_Changer

This script changes the sample rate of the USB audio class driver on Android devices on the fly like Bluetooth LDAC or Windows mixer
GNU Affero General Public License v3.0
146 stars 9 forks source link

Bit depth and sample rate won't change #33

Closed xiiyuki closed 2 weeks ago

xiiyuki commented 3 weeks ago

Hi, I will try to explain it briefly

For some reason, while using Moondrop Dawn Pro on OnePlus 9 Pro (Nameless AOSP, android 14, KernelSU with Global inheritance for script manager and termux), in apps like Spotify or MPV, Android chooses some format that in combination with it's resampling, causes very noticeable sound cut-off when it's near silent. Poweramp has Hi-Res Output, that is able to change sampling rate and bit depth of the DAC (which it indicates with RGB LED), which mitigates the issue instantly, by setting proper bit depth and sample rate manually.

I tried to resolve it:

  1. By installing Audio misc. settings and DRC remover, the issue remained
  2. By installing USB samplerate unlocker, and trying to change DAC's sample rate and bit depth.

On the second step, attempt to change sample rate and bit depth was not successful. I've verified it with Poweramp's AAudio output, Spotify, MVP and LED on the device itself (Changing to 192 Khz switches LED colour; I changed sample rate in script manager to 192khz 24bit, reconnected DAC, upon connecting it automatically switched to 44.1/48khz. In Poweramp I've switched Hi-Res output to 192khz 24bit, started playback, and DAC signaled the change by changing LED colour from red to blue. Mid-playback, I tried to play Spotify/MPV, and it automatically switched back to 44.1/48 Khz).

I might not understand how the script, or how does OS work in regard to switching audio format modes, but it all boils down to the issue with low volume cut-off still being there, essentially making any audio outside Poweramp's Hi-Res output sound like shit.

I can provide any logs, console outputs, anything if it will/may help towards resolving my issue, because I basically don't know where to go from there.

EDIT: sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh --usb-only 192k 24 outputs:
target USB configuration file ("/vendor/etc/usb_audio_policy_configuration.xml") not found! with DAC connected

yzyhk904 commented 3 weeks ago

First of all, I think KernelSU dosn't have the global mount mode, but does have "su --mount-master" option. Please use scripts under "Usage_samples" with "mixplorer" or something.

Poweramp uses only "direct_pcm" modes of the default audio policy on your phone, but spotify app does a usual "deep_buffer" mixer whose sample rate is fixed at 48 kHz.

I guess you could change the sample rate and bit depth of the default mixer by scripts under "Usage_Samples/USB".