Coder Social home page Coder Social logo

yzyhk904 / usb_samplerate_changer Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 9.0 371 KB

This script changes the sample rate of the USB audio class driver on Android devices on the fly like Bluetooth LDAC or Windows mixer

License: GNU Affero General Public License v3.0

Shell 100.00%
android dac on-the-fly sample-rate upto-768khz usbaudio

usb_samplerate_changer's People

Contributors

yzyhk904 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

usb_samplerate_changer's Issues

No sound in offload mode when sample rate is 44.1kHZ

Phone: Xiaomi mix2s with MIUI 12.5.1.
Plug-adapter: Original one with phone without DAC.
Problem: No sound through AUDIO_DEVICE_OUT_LINE when sample rate is 44.1kHZ(AKA 44k, even 88k and so on)

It works when sample rate is 48kHZ or 96kHZ and so on.
It also works through speaker when sample rate is 44.1kHZ.
Problem only exist in offload mode, bypass mode works fine(with Plug-adapter has DAC)

Attaching files show diff between them.
Line192.txt
Line441.txt

"audio_policy_configuration.xml doesn't exist!"

Device: OnePlus 9 Pro with crDroid 13 (LineageOS based). I'm also using 2 modules: "DRC remover" and "USB Samplerate unlocker"

For some reason executing the script with USB DAC connected only throws errors (With parameters it seems to also throw error)

~ $ sh /sdcard/script/USB_SampleRate_Changer.sh /sdcard/script/USB_SampleRate_Changer.sh: 7: /sdcard/script/functions3.shlib: Syntax error: "(" unexpected

~ $ su -c sh /sdcard/script/USB_SampleRate_Changer.sh overlaying target ("/vendor/etc/audio/sku_lahaina_qssi/audio_policy_configuration.xml") doesn't exist!

~ $ su -c sh /sdcard/script/USB_SampleRate_Changer.sh --usb-only target USB configuration file ("/vendor/etc/usb_audio_policy_configuration.xml") not found!

Errors didn't occur on Nameless AOSP

Audio correction

/sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh [--reset][--auto][--usb-only][--legacy][--offload][--bypass-offload][--bypass-offload-safer][--offload-hifi-playback][--safe][-safest] [--drc] [[44k|48k|88k|96k|176k|192k|353k|384k|706k|768k] [[16|24|32|float]

USB DAC device number switching?

Sorry if this is off-topic, but I can't find anything else about this online. The SteelSeries Arctis 7 headset transmitter, when connected over USB, shows a "Chat" device (shows up first, 16000hz max, only mono) and a "Game" device (shows up last, full quality audio, stereo). Android only lets me use the first device seemingly no matter what - the only thing that I've found works is running alsa_aplay as root with the "hw:0,1" syntax. Is there any alsa or prop tweak I could apply to let me use the other device?
IMG_20220913_233740_145
It shows up as this in /dev. pcmC0D0p is chat, pcmC0D1p is game (I need a way to switch the device number).

Bit Perfect?!

Hi. Thanks for your great script.
Having some trouble with my Hiby W3 Saber USB DAC, which somehow suddenly wont Play "bit perfect" in uapp anymore. This means that the Usb DAC only plays in 44.1/48 kHz, which really annoys me. Have been using All og your great magisk modules for a Long time, which really improves audio quality in my Samsung A53 5g.

I have been playing around with the Usb_samplerate_changer script now, to see, if there is any possibility to make my devices Play in bit perfect mode again/adaptive, so im not stuck in 44/48 kHz samplerate.
Could you help me, in figuring out which settings to use, in your script, if i would like this feature? Would really appreciate that.

(In Hiby Music app, it says that peripheals not support more than 48 kHz, which really hasnt been any problem before).

Questions about bluetooth headsets and ...

When I try to run
sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh --bypass-offload-safer 96k 24,
the Bluetooth headset no longer emits sound, but instead emits sound from the phone. What should I do?
My Bluetooth headset supports LHDC_V4 and has 24/96kHz turned on in the developer options, and is connected at the optimized audio quality (900kbps).
Another question, when I use a DAC connected to a wired headset and set to 384k 32, will there be a loss of audio quality when playing audio below 384k? For example 44.1 or 88.2kHz?
This question comes from previous knowledge , when playing audio, dumpsys media.audio_flinger log will appear in the corresponding sampling rate, that is, adaptive, in the Xiaomi device MIUI, Xiaomi gives a solution to avoid resampling, when playing music through the mediaplayer framework built player, MIUI will enable a separate OFFLOAD channel and adapts to the sampling rate. But unfortunately, the streamers don't use mediaplayer framework.
I'm sorry to ask you these questions, my English is not very good, maybe the readme mentions them and I may not understand them correctly.
Finally, thank you for your work.

LHDC

LHDC
Is it possible to use the script with a LHDC codec? When I use my oneplus buds 2 pro, I can only play sound under the AAC or SBC codec. Is there a way to do this?

Syntax error: "(" unexpected on termux.

~ $ sh /sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh --auto
/sdcard/USB_SampleRate_Changer/USB_SampleRate_Changer.sh: 7: /sdcard/USB_SampleRate_Changer/functions3.shlib: Syntax error: "(" unexpected
~ $

Echo during voice call using earpiece

Hi. Thanks a lot for this script.
Whenever I change the sample rate for usb, all phone calls have an echo on the other end .
I would appreciate it if this issue could be fixed cause I like this script.

galaxy S10+ audio mod

Hi I'm blown away by the difference in sound after using change-resampling-quality.sh with audio at 48kHz with 194dB 480 100%. I was impressed with S10 sound as the amplifier chip is very low distortion, with my studio spec headphones the change in the sound stage is huge at 194dB 480 100% compared to default settings which produced a lot of audable aliasing.
Currently viper4android fx V2.7.21 the default after install is legacy mode is enabled to fully activate viper4. I ran the above script with --status first to log my original values then with 194dB 480 100. The settings were changed and confirmed with --status, after the change I found legacy mode in viper4 was not default for activation. Is this what you would expect or do you think it's a setup/install issue of my mods.
Current setup is thunderstormS kernel with magisk SA root, Musicfx removed, Viper4, installed in magisk 1st but not driver, 2nd AML installed, then Viper4 driver then it reboots, 3rd ainur narsil set to 48kHz 32ohm MIMPEDANCE, hi pass filter on reboot, 4th audio compatability patch using new patch mode deep buff remove, notification listener library removed. The files attached are all post running the script, if you need them from prior I can upload.
Thank you so much for making the scripts.
UrbanDesimator

Sample rate is locked on 44.1kHz

Hello.
My device is Samsung Galaxy S10e and it is rooted with Magisk.

I executed this command in Termux:

su -c ./USB_SampleRate_Changer/USB_SampleRate_Changer.sh --auto

and the output was:

Can't find service: media.audio_policy
audioserver is not running!

The samplerate also didn't change when I checked it with dumpsys-filtered.sh

I know that your script works on other devices as I teseted it also on OnePlus 6. But what happend on this Galaxy?
Do you know what should I do to resolve it?
Thanks for the awsome module!

Requesting a acript to make 100 volume steps on the fly

Hello,

I was using your hifi-maximizer magisk module. I liked the performance boost it got me and the 100 volume steps. Now, I am just using this script for the performance boost but I need a way to change the volume steps to a 100. Is that possible with this scripts or do you have one just for that!?

You are very much appreciated!

Sintax error: unexpected 'fi'

I ran the script on smanager but what i get is this. Please help.
Magisk version: 25.2
OS: crDroid a11

# /system/bin/sh /storage/emulated/0/USB_SampleRate_Changer/USB_SampleRate_Changer.sh --auto /storage/emulated/0/USB_SampleRate_Changer/USB_SampleRate_Changer.sh[324]: exite6is_: inaccessible or not found /storage/emulated/0/USB_SampleRate_Changer/USB_SampleRate_Changer.sh[325]: syntax error: unexpected 'fi'

Possible to "deamplify" audio coming from the headphone jack?

Hey, I've been having this issue where the minimum volume coming out from my headphone jack while plugged in with iems is way too loud for a reasonable listening experience. Tried using a couple of system wide audio fx solutions (JamesDSP and V4A) which works fine until opening certain applications and games (would also like to avoid using this as a solution if possible). Attempting to increase the number of volume steps to anything larger then 30 leads to some of the steps to have no effect on the volume.

Had this issue for a while now and it's the only thing preventing me from using my iems on my phone any suggestions would be greatly appreciated.

Please add options like remote_submix and internal audio recording

Please add options like 'remote_submix' and internal audio recording(need root) with bit width and sample rate. Thus we can transfer whole system audio stream to our remote player by DLNA protocol when we playing hi-res audio in Apple Music.

I've tried but 'remote_submix' parameters in config files didn't work. Moreover, I don't know how to change internal audio recording's bit width and sample rate.

Sample rate changed at wrong device

Phone: Poco x3 nfc
ROM: Paranoid Sapphire Alpha 3
Plug-adapter: Hiby FC1
log.txt
This log includes dumpsys-filtered.sh result
My DAC show that it isn't outputting at 96 kHz
then I checked it seems like it changed the sample rate but on a different output device

cannot get the current directory!

Trying to run the script will always show "cannot get the current directory!".
Tried from internal storage and termux home directory.

Unzip Error: Trying to install module

Somehow your file won't install on magisks

Q: are you running the latest magisks:
A: Yes

Q: What device are you using and what OS?
A: Sony Xperia Z5 (Sumire DSDS) - Lineage OS 18.1 (11-R)

Q: DAC?
A: Avani ALC5686 384kHz

Error is on the title :D thanks!

Change SampleRate

Hi.
This is not specific for Usb sound.
I have a Qobuz subscription and want to use the android app from Qobuz, BUT, using another app like Airmusic to get the audio and send that to a upnp server (that have a good DAC).
I already make this but, im only getting in the DAC 24bit 44000khz.
I will like 192khz or at least 92000.
Did you know if i can change the rate of the audio in some manner.
Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.