[MOD] Codec-level Audio Mods for Pixel Devices: BiQuads, Stereo Capture and Playback - Google Pixel XL Themes, Apps, and Mods

Attached is an installer for up to three hardware-level audio mods that I've created over the last few years.
Important: This installer is not flashable via TWRP, but needs to be installed using an adb root shell as outlined below.
The three mods that can be installed in any combination are
The dual speaker playback mod as originally presented in this thread. When installing this mod, an app will also be installed that offers the following functionality:
when the screen is on, the main loudspeaker level is reduced significantly to bring down its volume to the one that is attainable with the earpiece speaker. The idea is that when the screen is on you may want to use it to watch a movie or play a game where the stereo effect may enhance the listening experience. This is a "personal" use-case where the lower overall volume may not be a huge problem
when the screen is off the main loudspeaker level is again raised to its maximum capability to not miss notifications and alarms, etc
There is an option offered to force maximum gain also in case the screen is on, for instance when sharing a YouTube video with friends or when using the speakers in the car in navigation mode
The above functionality can be controlled with a new permanent notification with three buttons: "stereo", "mono", and "mode", which can be "adaptive" or "stock". If you install the dual speaker mod, an accompanying app/service will be installed that automatically shows the above referenced permanent notification. This "app" has no UI other than the permanent notification. It is really a service that automatically starts upon boot. Keep in mind that you will need to unlock the phone twice after the boot process has been completed for the service to become active. The reason for this is that Android only makes most services available only after the initial unlock as a security feature. After that the screen needs to turn off at least once for the speaker control service to detect the screen state. Also, this service requires root privileges to function properly.
Stereo camcorder audio recording mod. Any app that uses the CAMCORDER device is now capable of recording stereo sound. Examples are Google's stock camcorder or "Easy Voice Recorder Pro".
Headphone biquad filtering for frequency response compensation as first made available here. This option will also install the accompanying biQuads app and relevant files. REQUIREMENTS: system-less root and @flar2 's excellent ElementalX kernel starting with version 1.02, with codec power gating option disabled in the installer.
There are actually two installer provided:
chdloc_hardware_audio_mods_pixel__ull.tar.gz : retains ultra-low latency (ULL) audio playback, but only supports the main loudspeaker to be active in cases where ULL is being asked for
chdloc_hardware_audio_mods_pixel__no_ull_*.tar.gz: allows both loudspeakers to be active even when ULL is being asked for by an app. However, under the hood ULL is converted to low-latency playback only.
I was unable to get both loudspeakers to play simultaneously in ULL mode on a stock system/kernel. ULL seems to invoke very different data handling code inside the kernel (from IRQ-based to non-IRQ-based). It appears that two backends (SLIMBUS_0_RX and QUAT_MI2S_RX) cannot be simultaneously active in non-IRQ mode. It is possible that this "problem" can be fixed with a custom kernel, but I really don't want to go that route. That's why I opted to re-route the ULL plumbing to make use of the low-latency path instead. According to the AOSP source code (platform.c), ULL promises 7 ms of latency while low-latency promises 13 ms. Whether that delta makes a difference in day-to-day use, particularly in VR mode, I don't know (yet).
To install, download the attached archive to your PC and push it to /data/local/tmp on your Pixel
Code:
adb shell rm -rf /data/local/tmp/chdloc* && adb push chdloc_hardware_audio_mods_pixel*.tar.gz /data/local/tmp/
Then enter an adb shell and copy the following string of commands into a root shell:
Code:
cd /data/local/tmp && gzip -d chdloc_hardware_audio_mods_pixel__*.tar.gz && tar -xf chdloc_hardware_audio_mods_pixel*.tar && gzip chdloc_hardware_audio_mods_pixel*.tar && chmod -R a+rw chdloc* && cd chdloc_hardware_audio_mods_pixel && chmod 744 install_chdloc_mods.sh
to install type
Code:
./install_chdloc_mods.sh
and select your install option, which also includes "revert to stock".
The following hidden text shows the original OP for reference:
It has been a tradition in the Android community to enable the earpiece speaker for multimedia playback to somewhat mitigate the drawback of having only one bottom-firing loudspeaker. I have been running a "true stereo" mod on my Nexus 5 for almost two years with great success.
The Pixel is a little bit different. Like some other phones with the SD820/821 it uses a separate speaker DAC/amp, which makes this mod quite a bit more tricky. Let me get this out of the way: the bottom speaker gets *much* louder than, for instance, the one on the Nexus 5. You cannot expect the earpiece to get this loud to create any form of "surround" effect. The only way to get there is to lower the volume of the main loudspeaker. This is what I'm describing below. This work is in no way, shape or form complete. For now, I'm giving here an outline on what needs to be done to enable dual-loudspeaker playback. I encourage others to try it out and chime in. So here it goes:
First of all you need to be rooted. Then modify the following /system/etc/mixer_paths.xml {...}.
The installation process is now described here
Now you need to save the file and reboot your phone. When you play audio you will notice that the earpiece is barely audible against the main speaker. The only way around this is to lower the speaker gain. This can be done by writing to a register in the amplifier which sits on the i2c bus:
Code:
echo 0xZZ0f > /sys/kernel/debug/tfa98xx-34/regs/06-AUDIO_CTR
where ZZ is the gain. By default, the speaker is set to 0 dB of gain with ZZ=00, i.e.
Code:
echo 0x000f > /sys/kernel/debug/tfa98xx-34/regs/06-AUDIO_CTR
Now each "tick" in the upper eight bits in this 16-bit number lowers the gain by 0.5 dB. The last two gain settings are FE which is -127 dB and FF which mutes the speaker.
In my short tests I have found the a gain of -16 dB for the main speaker, i.e.
Code:
echo 0x210f > /sys/kernel/debug/tfa98xx-34/regs/06-AUDIO_CTR
and a gain of +6 dB for the earpiece (see above) gives fairly balanced left-right volume. The speaker volume could be adjusted via an app depending on the use-case or upon boot via a script in /su/su.d
Note that the mod at this stage is dual-mono only.
Going forward I'll try to enable true stereo or something like the HTC10 tweeter-woofer arrangement.
I understand that all of this appears fairly complicated, so work needs to go into making this actually useful for others with flashable zip and control app. Any volunteers...?
Updates
November 9: first release of a speaker control app
November 7: the no-sound on the earpiece speaker during an incoming call has been fixed. For details, refer to this post. Please test and report back
November 3: stereo support, the left channel is played by the earpiece and the right channel is played by the main speaker. Note the updated "speaker" device above. The line in red (QUAT ...) tells the mixer to send two channels to the speaker dac/amplifier. By default, the dac/amp mixes the two channels into a mono stream. If you want stereo, then issue
Code:
echo 0x8093 > /sys/kernel/debug/tfa98xx-34/regs/04-I2SREG # right channel only
at any time on the command line or add to a script in /su/su.d so it gets applied on boot. If you want to go back to left+right on the main speaker then issue
Code:
echo 0x809b > /sys/kernel/debug/tfa98xx-34/regs/04-I2SREG # mono mix
. With the above changes the earpiece always plays the left channel.
November 2: Initial revision
Known limitations
Speakerphone telephony resets the DAC/amp of the main speaker and the above modifications get wiped. Hence, it would be ideal to control this mod with Tasker or some other native app.
There currently is an issue with RX audio on the earpiece with an incoming phone call. There will be nothing coming out of the earpiece. Switching to speakerphone works fine. Outgoing calls are fine. This has to do with the above (necessary) changes to mixer_paths.xml and the timing on how audio devices are set up and torn down in specific use cases. An explanation and possible solutions are given below. fixed (?)
So here is the problem: A call comes in and the system plays the ringtone using the "speaker" device. With the changes above, the speaker device now also activates the earpiece speaker by default. When you answer the call, the audio HAL switches the audio devices by activating the relevant capture and playback devices. The playback device is different from the "speaker" device, but it involves the earpiece unless the phone is connected to a (potentially bluetooth) headset. Unfortunately, the "speaker" device gets disabled last, which means that the earpiece gets disabled. Here is the sequence of events as caught by logcat:
Phone is RINGING
17:30:04.578 adev_set_mode: mode 1
17:30:04.904 out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
17:30:04.908 select_devices: changing use case low-latency-playback output device from(1: handset, acdb 7) to (2: speaker, acdb 15)
17:30:04.908 enable_snd_device: snd_device(2: speaker) {=> chdloc: this line enables the earpiece}
17:30:04.924 enable_audio_route: usecase(1) apply and update mixer path: low-latency-playback speaker
Phone is answered in HANDSET mode
17:30:11.020 adev_set_mode: mode 2
17:30:11.123 out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=1
17:30:11.126 enable_snd_device: snd_device(19: voice-handset-tmus) {=> chdloc: this line enables the earpiece}
17:30:11.128 enable_snd_device: snd_device(55: voice-dmic-ef-tmus)
17:30:11.153 enable_audio_route: usecase(15) apply and update mixer path: voicemmode1-call
17:30:11.220 select_devices: changing use case low-latency-playback output device from(2: speaker, acdb 15) to (19: voice-handset-tmus, acdb 88)
17:30:11.220 disable_audio_route: usecase(1) reset and update mixer path: low-latency-playback speaker
17:30:11.277 disable_snd_device: snd_device(2: speaker) {=> chdloc: this line disables the earpiece}
17:30:11.304 enable_audio_route: usecase(1) apply and update mixer path: low-latency-playback
17:30:14.058 disable_audio_route: usecase(1) reset and update mixer path: low-latency-playback
I see three options to fix the issue:
Have the earpiece constantly enabled. I'm currently testing this method to see whether there are any side effects. I would be in favor of this method if it works.
Use Tasker to detect an incoming phone call and have Tasker enable the earpiece. This is actually very doable, but kludgy. I'd use this approach if the first one proves problematic.
Mess with the audio HAL to disable the speaker *before* the voice-handset-*** device is enabled. As this involves source code changes and, therefore, a modified audio HAL (/system/lib/hw/audio.primary.msm8996.so), this would be my least favorite option.

Great work mate!

YESSSSS!!!! Been waiting for this!! Excellent work!!

This mod plus viper4android is amazing! Sounds so good! Thank you!
Sent from my Pixel XL using XDA-Developers mobile app

Update: Full stereo support added to the OP. Note that for best stereo imaging, the gain for the main speaker needs to be reduced significantly. Stereo media playback is likely only useful for personal media consumption or gaming in a relatively quiet environment. This mod lends itself nicely to Tasker (or native app) integration with which stereo can be enabled on-demand.
Next, I'll look into an HTC 10 like setup where the earpiece is used as a tweeter. The idea is that the earpiece (and by extension the main speaker) gain can be kept higher because distortions that are caused by high frequency clipping are less audible than the ones that result from low-frequency clipping.
Update: There currently is a problem with this implementation in that there is, initially, no audio coming out of the earpiece when *receiving* a phone call. You can force audio to come out of the earpiece by quickly toggling to and from speakerphone mode. Outgoing phone calls are fine. Please keep this in mind when trying the mod. I'm currently investigating the exact cause.
Update 2: I think I'm understanding the problem. See the OP for an explanation and possible solutions

Edit: All working well.
So what you're saying is when answering a call, switch to loudspeaker then ear piece?

I'm a bit lost. 1. Do I need to change everything from "this" to " with" as above for the mod to work and 2. Once necessary files are replaced do I just save and let root create the XML.bak file or does the file I create go in su etc? Thanks
Sent from my Pixel XL using XDA-Developers mobile app

Juzman said:
So what you're saying is when answering a call, switch to loudspeaker then ear piece?
Click to expand...
Click to collapse
Yes, that is the current workaround. I'm currently testing additional mixer_path.xml mods that may address this issue.
treIII said:
I'm a bit lost. 1. Do I need to change everything from "this" to " with" as above for the mod to work and
Click to expand...
Click to collapse
Yes
2. Once necessary files are replaced do I just save and let root create the XML.bak file or does the file I create go in su etc? Thanks
Click to expand...
Click to collapse
Well, to stay in the spirit of system-less root, you don't want to modify /system. Instead, copy the modified mixer_paths.xml file to /su/etc
and create a file (bind mount) called 10mixer_paths in /su/su.d/
Code:
#!/su/bin/sush
mount -o bind /su/etc/mixer_paths.xml /system/etc/mixer_paths.xml
change the permissions to 700 (rwx------), and reboot.

chdloc said:
Yes, that is the current workaround. I'm currently testing additional mixer_path.xml mods that may address this issue.
Yes
Well, to stay in the spirit of system-less root, you don't want to modify /system. Instead, copy the modified mixer_paths.xml file to /su/etc
and create a file (bind mount) called 10mixer_paths in /su/su.d/
change the permissions to 700 (rwx------), and reboot.
Click to expand...
Click to collapse
Does I need to make a file bind mount inside of su/su.d/ thanks

treIII said:
Does I need to make a file bind mount inside of su/su.d/ thanks
Click to expand...
Click to collapse
Yes, you need to bind mount the 10mixer_paths file I quoted above in /su/su.d and simply copy the modified mixer_paths.xml to /su/etc

from what i read, the mod seems applicable on the OP3 as well, or is the S821 having a different hardware setup than the S820 ?

Mostafa Wael said:
from what i read, the mod seems applicable on the OP3 as well, or is the S821 having a different hardware setup than the S820 ?
Click to expand...
Click to collapse
The main codec is identical, but they may have a different speaker DAC/amp. As root run the following two shell commands
Code:
ls /sys/module | grep snd_soc
and
Code:
find /sys -name '*AUDIO_CTR*'
and post the result.

chdloc said:
The main codec is identical, but they may have a different speaker DAC/amp. As root run the following two shell commands
and
and post the result.
Click to expand...
Click to collapse
Here are my results. I guess it could not be applicable here

Are there any chances this mod becomes available as a script or zip eventually?

airmaxx23 said:
Are there any chance this mod becomes available as a script or zip eventually?
Click to expand...
Click to collapse
Yes

Update: The procedure described below is outdated. See this post for the new method.
I think I found a way to fix the silent earpiece speaker when a call comes in. It requires additional mixer_paths edits. I have attached an archive with three files:
mixer_paths.xml.stereo: copy (and rename!) to /su/etc/mixer_paths.xml; I dialed the earpiece gain back to 84 dB to get rid of distortions.
20speakerctrl: copy to /su/su.d and make executable (700, rwx------). This script is executed on boot and sets the speakers for stereo and lowers the level of the main speaker by around 18 dB.
mixer_paths.xml.stock: this is the stock mixer_paths file; if you want to go back to stock behavior, copy this file to /su/etc/mixer_paths.xml and delete /su/su.d/20speakerctrl
Please test this setup and report back. Note that you can currently only modify the main speaker gain and have it "stick" with the 'echo' command as described in the OP. To play around with the earpiece volume while media is playing you can use the following command in a root shell
Code:
tinymix "RX0 Mix Digital Volume" X
where X={0,1,...,84,85,...,124}. The default is X=84 which applies 0 dB of gain. Each "tick" up or down changes the gain by 1 dB. Add gain very carefully. At maximum volume, I would highly advise not to go beyond 90. Note that changing the earpiece volume this way does not "stick" and it defaults back to 84 as soon as you change the media stream (skip, different app, etc). You will need to run a custom kernel with sound control to be able to fully control the volume of the earpiece speaker.
There is still the issue that a speakerphone call resets the main speaker's volume to default. Over the next couple of weeks, I'll come up with a Tasker app -- which means you do not need to have Tasker installed -- which initially
re-applies the currently chosen gains after a phone call
lets you quickly toggle between the low-volume stereo setup and the high-volume stock setup
Other things this app could do is go back to stock behavior when the screen is off, so you won't miss notifications and/or alarms due to the lower overall volume of the stereo mod.

chdloc said:
There is still the issue that a speakerphone call resets the main speaker's volume to default.
Click to expand...
Click to collapse
So, after each call, we have to run the script in /su/su.d to reapply the volumes correctly? If that's the case, can always use Script Manager, and set a widget icon on home screen. After a call, tap the widget to execute the script again.

Juzman said:
So, after each call, we have to run the script in /su/su.d to reapply the volumes correctly? If that's the case, can always use Script Manager, and set a widget icon on home screen. After a call, tap the widget to execute the script again.
Click to expand...
Click to collapse
Correct. The idea, though, is to eventually have this done automatically by a Tasker app.

chdloc said:
Correct. The idea, though, is to eventually have this done automatically by a Tasker app.
Click to expand...
Click to collapse
Sweet as. Question two:
mixer_paths.xml.stock: this is the stock mixer_paths file; if you want to go back to stock behavior, copy this file to /su/etc/mixer_paths.xml and delete /su/su.d/20speakerctrl
Could we not just delete /su/etc/mixer_paths.xml instead? Since we will still have original in /etc/

Juzman said:
Sweet as. Question two:
mixer_paths.xml.stock: this is the stock mixer_paths file; if you want to go back to stock behavior, copy this file to /su/etc/mixer_paths.xml and delete /su/su.d/20speakerctrl
Could we not just delete /su/etc/mixer_paths.xml instead? Since we will still have original in /etc/
Click to expand...
Click to collapse
Sure, but then you probably also may want to delete the bind mount in /su/su.d as I'm not sure what would happen if the file the mount points to has been deleted.
In addition, there are a few more mods I'm going to release soon that some folks may want to play with (stereo camcorder recording and hardware audio filtering), so keeping that file around may come in handy.

Related

Having problems with A2DP? I can help.

A couple nights ago, I was intent on getting my A2DP to work perfectly. I wanted clear, crisp, skip free music coming from my phone. Using this method, I have done just that. I'm not 100% sure all of the steps I'm including are necessary, but I've done this twice and it worked perfectly both times. Here goes!
Short way, But I'm not 100% sure it will work as well
1. Navigate to "LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings" in the registry.
2. Set BitPool to 48, MaxSupportedBitPool to 56, and Use Joint Stereo to 0.
3. Exit, soft reset
4. Tell me if it works well for you or not...
Long but guaranteed way
1. Download HTweakC, install
2. Go to bluetooth tweaks, set audio quality as "Excellent"
3. Install Sleuth255's A2DP Fix cab then soft reset
[By this point, the A2DP is crackly and may skip...so continue]
4. With the registry editor of your choice, navigate to the following:
LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings
5. Change the value of "Bitpool" to 56
6. Change the value of MaxsupportedBitPool to 56
7. Change "Use Joint Stereo" to 1
8. Soft Reset
9. Uninstall Slueth's A2DP fix
10. Soft Reset
11. Once again, open HTweakC
12. Change the A2DP quality to "High"
13. Soft reset
14. Enjoy crystal clear, skip free streaming music.
Also, if anyone can help me with an issue I've been having...Is there a quick way to set a pair of bluetooth headphones to automatically set itself as as wireless stereo without applying it each time in bluetooth options? I have a pair of BT620's if that makes any difference.
And
Is there a way to have WMP startup with my storage card's library by default? If not, is there a way to delete the library from My device?
Thanks! Hope this helps!
Has this technique eliminated the hissing aswell dude?
(No A2DP hardware to test sorry )
I have now done exactly as the "long" way said, and it did not take away the hizzing sound, (not with my plantronics pulsar 260 anyway)
so it is back to the drawing board!
thanks for sharing this Centurion, it is always nice to hear success stories..
but I would believe that the last step is the only one neccessary (htweakC)
too bad it didn't work for me.
The hissing on mine is definitely gone...I wish I could share it with you.
Hi, I just got my X01HT last week. May I ask which Windows Media/MP3 player program are you using to listen with stereo bluetooth?? I can't find the function in Windows media Player.
Thank you very much!
Hi, Pingubest
You can not use the function of stereo bluetooth on the default OS of X01HT.
In this case, you must apply cab files for the A2DP function or install WM6.
Using WMP...I've tested this 3 times on my phone now after 3 different flashes and it worked each time.
Centurion said:
Short way, But I'm not 100% sure it will work as well
1. Navigate to "LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings" in the registry.
2. Set BitPool to 48, MaxSupportedBitPool to 56, and Use Joint Stereo to 0.
3. Exit, soft reset
4. Tell me if it works well for you or not...
Long but guaranteed way
1. Download HTweakC, install
2. Go to bluetooth tweaks, set audio quality as "Excellent"
3. Install Sleuth255's A2DP Fix cab then soft reset
[By this point, the A2DP is crackly and may skip...so continue]
4. With the registry editor of your choice, navigate to the following:
LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings
5. Change the value of "Bitpool" to 56
6. Change the value of MaxsupportedBitPool to 56
7. Change "Use Joint Stereo" to 1
8. Soft Reset
9. Uninstall Slueth's A2DP fix
10. Soft Reset
11. Once again, open HTweakC
12. Change the A2DP quality to "High"
13. Soft reset
14. Enjoy crystal clear, skip free streaming music.
Also, if anyone can help me with an issue I've been having...Is there a quick way to set a pair of bluetooth headphones to automatically set itself as as wireless stereo without applying it each time in bluetooth options? I have a pair of BT620's if that makes any difference.
QUOTE]
I don't see any logic for the steps 9-14?? Maby you soft reset to quickly or didn't save registry values properly. I usually wait a little the use the powerbutton to close down phone.
Step 5-6 I set to 52 (decimal!) and sound is great on HBH-SD970 and skipping never happens as long as there's not an object between the phone and headset. I'm running Black 2.5 on a Tytn.
Regarding the problem with the BT620, this seem to be ralated to that headset, I don't have that problem with HBH-SD970. Maby there is some firmware upgrade for your headset?
Click to expand...
Click to collapse
I think the stereo thing has to do with your headset also since my BT8010 works correctly also..
I concur Jompao, no problems with HBH-DS970's... no hiss and clicks nearly eliminated with Custel's latest 1236 build v1.2. Also sound with this latest release seems louder than the previous 968 builds. Save some battery power on my DS970's... sweet!
Cheers
A2DP
I followed the "long steps" and it doesn't work for me. I am using Samsung WEP200.
doesn't work on mt 8525. It just makes the skips worst!!!!!!
the new lwsv rom is quite intresting seen from a a2dp level, it made my headset work almost as good as widcomm stack, although with the advantages of ms stack !
a2dp
Hi just to let you know "your way" - works BUT only if you DONT remove sleuth's fix - take it out and its all miss and no hits but leave it runnin and its gr8 .
ps running Moto HT820
regards
jon
mrvanx said:
Has this technique eliminated the hissing aswell dude?
(No A2DP hardware to test sorry )
Click to expand...
Click to collapse
I have perfect stereo sound! It's all in the BT headsets you use.
I use the Nokia HS-12W and HTC BH S100 and the sound is as good as it gets. NO BACKGROUND NOISE AT ALL.
It's about matching the A2DP specs of the headsets to the M$ software, and not the other way around.
My opinion only, for what it's worth.
Can anyone explain what the values of MaxsupportedBitPool and BitPool stand for? Are they kbps or decibles or something else? I understand changing the UseJointStereo to 0 turns off Joint Stereo, but i want to know what the BitPool stands for.
I have a Motorola HT820 and can play music through it with no problems. I changed the 2 bitpool settings to 48. This definately improved the quality, but occasionally it skips (very rarely). So are these higher numbers causing too much data to stream and you get a "buffer" type pause.
Also if I convert back to Joint Stereo, will that cause 1/2 of the data stream, since its basically mono. If I could stream at 96 kbps in mono, compared to 48 kbps in stereo, I would choose the mono. Mainly because of the sounds of the high frequencies. The bass and mids sounds great.
On a side note I found that turning my phone's and windows media players volume all the way up improves the sound. I use the volume controls on the HT820 to control volume.
Ok, I didn't get very far with this fix...
I downloaded and installed HTweakC, but when I run it I get an error; HTweakC.exe "Argument out of range Exception". I am assuming that the bluetooth tweaks are in this proggy?
I also tried the shortcut way, but I don't have "LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings" in the registry.
WTF did I do wrong here??
Any ideas?
I have
Cingular 8125 Wizard
G3 CID/SIM Unlocked
Rom Version: WM5SE rev 4.0 - WM5 without stylus but style!
2.26.10.2 WWE
IPL: 3.08
SPL: 3.08
Ok, One more thing...
I just went to my vehicle to play around some more and I found that when I have the BT stereo playing and a call comes in, the stereo is paused until the call is done and when it starts back up I either have no sound at all or it's skipping badly, but I went to the bluetooth device settings and held the click for the sub menu and then selected Set as wireless stereo, the audio straightened out and started playing fine again.
Could this mean the processor is too slow in the Wizard? Maybe if I overclocked it a bit that might help or am I just doomed to never have this work correctly?
Thanks again!
Can NO ONE answer my question above?
It looks like this thread is dead??
I really want to solve this audio skipping problem if posible!
Thanks
ITAdmin
Centurion said:
Short way, But I'm not 100% sure it will work as well
1. Navigate to "LOCAL_MACHINE/Software/Microsoft/Bluetooth/A2DP/Settings" in the registry.
2. Set BitPool to 48, MaxSupportedBitPool to 56, and Use Joint Stereo to 0.
3. Exit, soft reset
4. Tell me if it works well for you or not...
Click to expand...
Click to collapse
Magic!!!!
I have been battling with this for weeks. Finally something that works.
Many thanks for sharing that.

[Q] Tough question: sound types

Here's a tough question - not necessarily difficult to answer, but difficult to ask correctly.
Is there any possibility to change the "sound type" of a particular program without actually having access to the program source code (e.g. via an external application/setting)?
By "sound type" I mean the value which is shown when you use the side volume keys while the program is running. E.g. when playing music and you use the vol+/-, it will display "Media volume", when in the Home screen and you use the vol+/- it will say "Ringer volume" etc.
I'm using the Desire as my main in-car device. The sound goes over Bluetooth to a Motorola T505 handsfree/FM transmitter and from that one to the car radio via FM (yes, old car radio, no built-in Bluetooth).
The reason for which I need to change the sound type is because if they sound types are different, they can be adjusted independently - i.e. music volume to 50% and ringer volume to 30%, so that I don't get a heart attack when the phone rings.
The problem is that my navigation software (iGo Amigo) and HTC Media player both seem to use the "Media volume" designation for their sound output, so I cannot adjust them separately. This results either in listening to a very loud navigation or to low volume music. Other navigation software have their sound type as "Alert volume", so they can be set separately.
Any idea how/if this can be changed somehow? The Desire is completely stock, unbranded, running 2.2 and the latest OTA updates.
Thanks!
LE: in more elevated terms, this is the thing (well, the other way around) - http://stackoverflow.com/questions/2744752/enable-media-volume-slider-in-android-application
airwave88 said:
Here's a tough question - not necessarily difficult to answer, but difficult to ask correctly.
Is there any possibility to change the "sound type" of a particular program without actually having access to the program source code (e.g. via an external application/setting)?
By "sound type" I mean the value which is shown when you use the side volume keys while the program is running. E.g. when playing music and you use the vol+/-, it will display "Media volume", when in the Home screen and you use the vol+/- it will say "Ringer volume" etc.
I'm using the Desire as my main in-car device. The sound goes over Bluetooth to a Motorola T505 handsfree/FM transmitter and from that one to the car radio via FM (yes, old car radio, no built-in Bluetooth).
The reason for which I need to change the sound type is because if they sound types are different, they can be adjusted independently - i.e. music volume to 50% and ringer volume to 30%, so that I don't get a heart attack when the phone rings.
The problem is that my navigation software (iGo Amigo) and HTC Media player both seem to use the "Media volume" designation for their sound output, so I cannot adjust them separately. This results either in listening to a very loud navigation or to low volume music. Other navigation software have their sound type as "Alert volume", so they can be set separately.
Any idea how/if this can be changed somehow? The Desire is completely stock, unbranded, running 2.2 and the latest OTA updates.
Thanks!
LE: in more elevated terms, this is the thing (well, the other way around) - http://stackoverflow.com/questions/2744752/enable-media-volume-slider-in-android-application
Click to expand...
Click to collapse
does igo not have an internal volume adjustment? i know copoilot does, so i can set my media volume to full and then adjust the actual volume level off the app independently
None that I could find, it seems to be stuck with some default values (iGo MyWay 2009).
Wondering if in Android there's an iGo configuration file similar to sys.txt on WinMo... might be able to set it there.

[GUIDE][MAGISK]Apple USB-C to 3.5mm DAC dongle and Android - remove the power limit

(basically a small fine tuning of my previous guide)
Mi A3 doesn't have powerfull headphone amplifier, so for "hifi" headphones it's necessary to use external DAC. The first obvious choice would be a Pixel dongle, but for some reason Apple is selling a better performing dongle. Being cheaper and available in a mortar store, it was a no brainer purchase. I can definitely say that it works great and sound is crystal clear. However for yet another reason, Apple dongle is by default quite limited in power, being usable mainly by sensitive IEMs. After several attempts of various methods, I found a reliable way of removing this limit.
Ingredients needed:
1. Apple DAC dongle
2. Tasker
3. Magisk
4. AlsaMixer app (https://apkpure.com/alsamixer-root/com.skvalex.alsamixer)
Recipe:
1. Extract AlsaMixer app and locate "assets\alsa\system" folder
2. Create a Magisk module from this folder (mount everything under "system" to "system") with 755/755 rights
3. Install Magisk module
4. Create a Tasker event "headphones connected", task "shell script", run as root, command "alsa_amixer -c 1 sset PCM 120"
5. Connect Apple dongle
Voila, you suddenly moved from -40dB limit to 0db for max volume. Limit is automatically reset on each DAC re-connection, so Tasker intent is mandatory.
Verification:
1. In terminal write as root "alsa_amixer -c 1" to see the current playback limit. It obviously works only with DAC connected.
Note: this method works only for USB-C DACs, not for analog audio jack.
Default:
Code:
# [B]alsa_amixer -c 1[/B]
Simple mixer control 'PCM',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 120
Mono:
Front Left:[B] Playback 80 [67%] [-40.00dB][/B] [on]
Front Right:[B] Playback 80 [67%] [-40.00dB][/B] [on]
Headphones with no mic:
Code:
# [B]alsa_amixer -c 1 sset PCM 120[/B]
Simple mixer control 'PCM',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 120
Mono:
Front Left: [B]Playback 120 [100%] [0.00dB][/B] [on]
Front Right: [B]Playback 120 [100%] [0.00dB][/B] [on]
Headset with a mic:
Code:
# [B]alsa_amixer -c 1 sset Headset,0 120[/B]
Simple mixer control 'Headset',1
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 120
Mono:
Front Left: [B]Playback 120 [100%] [0.00dB][/B] [on]
Front Right: [B]Playback 120 [100%] [0.00dB][/B] [on]
How does one make a magisk module?
Edit: figured it out , had to use new template
How do you create the Magisk Module please ?
And where do you put the code displayed under
Default:
or
Headset with a mic:
what dongle u use then
Lalulilelo said:
How do you create the Magisk Module please ?
And where do you put the code displayed under
Default:
or
Headset with a mic:
Click to expand...
Click to collapse
1. how to create a Magisk module - https://topjohnwu.github.io/Magisk/guides.html
(or download some module and adapt it to your needs)
2. command needs to be used in Terminal emulator app to verify that it's working, after that you need to either type it manually every time you connect the dongle or use an automation app (Tasker)
Sami Devo said:
what dongle u use then
Click to expand...
Click to collapse
None at the moment, dongle was needed for Mi A1 phone as it had very bad headphone output. On Mi A3 it isn't so essential and since I moved to Mi 10T lite phone, I don't need the dongle at all.
_mysiak_ said:
1. how to create a Magisk module - https://topjohnwu.github.io/Magisk/guides.html
(or download some module and adapt it to your needs)
Click to expand...
Click to collapse
Thanks for the documentation.
At the time, I did not get it, got discouraged and gave up.
I am trying again since today.
You said in your first post :
mount everything under "system" to "system"
Click to expand...
Click to collapse
Does this mean copy the content of "assets\alsa\system" in "adb/modules/alsa_mixer/system" ?
Lalulilelo said:
Thanks for the documentation.
At the time, I did not get it, got discouraged and gave up.
I am trying again since today.
You said in your first post :
Does this mean copy the content of "assets\alsa\system" in "adb/modules/alsa_mixer/system" ?
Click to expand...
Click to collapse
Basically yes, you want to have folder "system" in your module with the content of "assets\alsa\system". My old Magisk module attached - no idea if it still works as I don't use it anymore, but it might help you.
_mysiak_ said:
Basically yes, you want to have folder "system" in your module with the content of "assets\alsa\system". My old Magisk module attached - no idea if it still works as I don't use it anymore, but it might help you.
Click to expand...
Click to collapse
Thanks !
I managed to make it work (for a short time ).
I had a problem in my tasker profiles.
I have 1 profile for headset with mic and 1 profile for headset without mic.
But, when I put my earpiece with mic, both profiles were activated causing both "alsa_amixer -c 1 sset PCM 120" and "alsa_amixer -c 1 sset Headset,0 120" to be sent.
Desactivating the "no mic" profile allowed the proper script to work.
BUT !
I updated my Oneplus 7T to Android 11 and the script doesn't work anymore
Maybe the audio system has changed ?
I will try to uninstall and reinstall everything.
Lalulilelo said:
Thanks !
I managed to make it work (for a short time ).
I had a problem in my tasker profiles.
I have 1 profile for headset with mic and 1 profile for headset without mic.
But, when I put my earpiece with mic, both profiles were activated causing both "alsa_amixer -c 1 sset PCM 120" and "alsa_amixer -c 1 sset Headset,0 120" to be sent.
Desactivating the "no mic" profile allowed the proper script to work.
BUT !
I updated my Oneplus 7T to Android 11 and the script doesn't work anymore
Maybe the audio system has changed ?
I will try to uninstall and reinstall everything.
Click to expand...
Click to collapse
I haven't noticed any problem when sending both commands to alsa_amixer, one will just fail to execute because of missing audio device (PCM or Headset) - I used only one Tasker profile to send both commands (in Tasker tasks mark checkbox "continue task after error" and it will work fine).
Android 11 might have changed audio device names - keep the module installed and headset/headphones connected and from terminal emulator type "alsa_amixer -c 1". You should see currently active device and corresponding limit.
_mysiak_ said:
I haven't noticed any problem when sending both commands to alsa_amixer, one will just fail to execute because of missing audio device (PCM or Headset) - I used only one Tasker profile to send both commands (in Tasker tasks mark checkbox "continue task after error" and it will work fine).
Android 11 might have changed audio device names - keep the module installed and headset/headphones connected and from terminal emulator type "alsa_amixer -c 1". You should see currently active device and corresponding limit.
Click to expand...
Click to collapse
Well even on Android 10 Termux returned "alsa_amixer : command not found"
It's weird because it was working, i even had tested different values after PCM and had settled for 105.
Update :
I don't know why but the script works well in Android 11 now.
It still says "alsa_amixer : command not found" in terminal but whatever.
Thanks for your time @_mysiak_
thanks for the guide.
For anyone who having issues installing alsa,
I have updated this magisk module so that it can work with latest Android.
Works on my OnePlus 7 Pro running oos11
So should also would on other devices.
For headset (with mic)
Run this
Bash:
alsa_amixer sset Headset 120
And for Headphones (without mic)
Run this
Bash:
alsa_amixer sset Headphone 120
bubundas17 said:
thanks for the guide.
For anyone who having issues installing alsa,
I have updated this magisk module so that it can work with latest Android.
Works on my OnePlus 7 Pro running oos11
So should also would on other devices.
For headset (with mic)
Run this
Bash:
alsa_amixer sset Headset 120
And for Headphones (without mic)
Run this
Bash:
alsa_amixer sset Headphone 120
Click to expand...
Click to collapse
Hi, I know nothing about android development, I am just an audiophile that wants good audio quality and have an apple dongle and can't get full power with it. I can't spend money to get UAPP.
I wanted to follow along and do what this guide says, but I am completely lost and have no clue what any of any of this means.
No idea what a Magisk is, can't find it in the app store, or alsamixer...
I'm just an average android user and want to fix my apple dongle to work fully.
Any possibility to get instructions for someone that doesn't know anything about this?
I would be extremely grateful, and there's several others like myself in the r/audiophile and r/headphones subreddits as well that want to fix this issue.

HIFI DAC Help( Audio Experts needed! )

Hi guys. I downloaded an app called Android hidden settings from the play store. I already use settings database editor as well as the hidden settings magisk module, but I saw if one thing inside this app I haven't seen anywhere else. There is a setting called Hi Fi DAC pop up. When you click on it floating window opens and it gives you the option to turn on DTS x and the hi-fi quad DAC. you can toggle the switch is regardless of whether or not you're playing music so I figured this wouldn't do anything. This is what I noticed:
When the floating window first appears, DTS is already enabled, I disabled it and toggled the DAC switch to the on position and proceeded to open my music player. From here I opened the full settings menu and clicked on the sound effects section to check if the DAC was switched on in the phones full menu and the toggle is actually still set to the on position. Figuring there would be no change in sound, I messed with the left and right channels anyway as well as the sound preset and digital filter. Before I go further I forgot to mention that I do not have headphones plugged in, I am playing music directly through the phone speaker. To my surprise, the audio quality does change and the volume is limited to 75 as if a headset was plugged in.
I opened up the Flinger Dump app to check audio output details but it is very limited to what it shows. I'm wondering if anyone with more knowledge on the topic and the proper tools could do some further testing and see what changes actually occur. I use UAPP, and its output is showing differently then flinger dump is. Could be a complete waste of time, could lead to something further...
If I have not misunderstood, what you mean is that with that app, you inadvertently activated the dac or the dts for the speaker's sound channel, right? If so, it would be amazing to be able to modify how the dac behaves without headphones. Perhaps it could be activated for the speaker, perhaps not, but what you propose is very interesting.
I'm honestly not sure. I don't believe so, but it's definitely done something and I don't have the knowledge or the software to see exactly what has changed. Basically, unless you have headphones or an auxiliary cord plugged into the phones Jack, you can't toggle the Hi-Fi DAC button to the on position as I'm sure you're fully aware of. This hidden shortcut allows it to be toggled on without anything plugged in to the headphone jack. I played some tracks thinking that there is a 99.9% chance that the audio quality wouldn't change ( or the sound wouldn't change, I don't know about quality ) but to my surprise it did change the sound. As long as the DTS:X is turned off, all of the other options had some sort of effect on the audio. The sound preset, the digital filter and the left and right channel knobs all had some sort of effect on any audio I played through the phone's internal speaker, and the volume limit changed from 100 down to 75, exactly how it would behave if headphones were plugged in.
I just need someone to help figure out exactly what this is changing, because my music app is showing 16bit and various Khz from the 300 range to over 1000...and as you can see from the screenshot the FlingerDump app is showing 24bit to 32bit and depending on the track but the KHZ remains the same.
It may be a dead end, but I figured that since there is an actual change in sound.... there may be a possibility for someone with more knowledge than me to take this and run with it and see where it leads. I removed all of my audio mods except for JamesDSP and John Fawkes DTS tuning because every other mod made my phone upsample everything from 44.1 to 48 and it was pissing me off. The results above were with USB Audio Player Pro, but I disabled bit perfect mode when I tested this out in order to avoid interference with the results.
I'm on stock android q (through fota) and out of curiosity i tried that. Nothing happened. I can tap it and nothing. The same with dts settings. Turning quad dac to small speaker for me have no sense. Idk how circuits looks, but i think system itself don't let reroute signal through dac to speaker. BUT if ypu want to check then try that.
Open terminal app and type
su -c tinymix
And look for what is on screen.
If it's state is closed then quad dac is not working. If state is hifi, then it's working.

Audio Gain Trick (need others check)

Pls, let me know if this work 4 u in speaker/headphones
Call *#546368#*710*
Hiddenmenu>devicetest>saat>manualtest>loopback test.
Scroll the trigger to other possition.
Wait 2 sec
Scroll the 2nd trigger
Wait for noise and them scroll again to disable.
Now play music or like to high volume.
Did increased? Idk if my volumes are down due to modifications and modules, and it reset the levels. Or if this enables a free gain mode for all of us.
Pls feedback, i need to know.
After reboot this gain disables for me. This "new" gain, will be the normal volume, and i ****ed up my mediaserver and its under-gained for any reason??
Or is a trick that i have discovered, and really gain the volume without any reason?
If is normal volume, i wish to know what i did for get an under-gain in my sound ... Is curious
for now, my headphones on dac, are beating up my Sennheiser Momentum like a 999Ohm auric. Really, for me is a huge gain.
OK. First thing to check: Which headphones are you using to tests? Are they over 50 ohm impedance?
If you can call hidden menu, then i assume that you have stock system.
EDIT:
I checked that. Volume is exactly like AVC = 0 (high impedance mode). For me it looks like forcing High Impedance Mode (HIM).
But if you have root you can manually set AVC like whatever you want forever
This phone according to mixer_paths_tavil.xml have three modes of analog gain: Normal mode (AVC = 14 or 15), AUX Mode (AVC = 6) and High Impedance Mode (AVC = 0)
By default HIM turns on headphones which have more than 50 ohm impedance, and it unleashes all power of amplifier in that DAC.
ShadoV90 said:
OK. First thing to check: Which headphones are you using to tests? Are they over 50 ohm impedance?
If you can call hidden menu, then i assume that you have stock system.
EDIT:
I checked that. Volume is exactly like AVC = 0 (high impedance mode). For me it looks like forcing High Impedance Mode (HIM).
But if you have root you can manually set AVC like whatever you want forever
This phone according to mixer_paths_tavil.xml have three modes of analog gain: Normal mode (AVC = 14 or 15), AUX Mode (AVC = 6) and High Impedance Mode (AVC = 0)
By default HIM turns on headphones which have more than 50 ohm impedance, and it unleashes all power of amplifier in that DAC.
Click to expand...
Click to collapse
I know that bro, thanks for ur info, but i already installed a magisk module dualspeaker, and ive edited the tavil file, setting all Hifi-dac avc to 0. This mean that i have an issue with the module or like, did not activated properly.
Because everytime stock system runs even with module, you need to kill audioserver at the start to make things work.
For some reason system loads default values instead of modded. After type in terminal
su -c killall audioserver
you will notice the difference. I made file in module "service.sh" and only command there is killall audioserver. With that every modification of audio is working properly due to restarting audioserver after start system.
ShadoV90 said:
Because everytime stock system runs even with module, you need to kill audioserver at the start to make things work.
For some reason system loads default values instead of modded. After type in terminal
su -c killall audioserver
you will notice the difference. I made file in module "service.sh" and only command there is killall audioserver. With that every modification of audio is working properly due to restarting audioserver after start system.
Click to expand...
Click to collapse
Man, i love u, thanks. U fixed my headaches of months with audio in one post. Really, thanks, i remember days with 10-15 kdz flashes, every time triying one different trick for make this module and others (killed my sound) work properly. Thank u again.
it really feels like a great change tested on a kz zsn pro, is there a way to maintain that volume level? i am on android 10 stock with root
Ricky Almonte said:
it really feels like a great change tested on a kz zsn pro, is there a way to maintain that volume level? i am on android 10 stock with root
Click to expand...
Click to collapse
It can be mantained if u do no reboot, but I memorized the code, and now, on reboots, other than accepting the system error message at startup, I also have to do the test loopback hahah (my kernel gives Android error at startup, it was just a joke). Finally after doing that at every start, I have the power of the speakers in stock as if I hadn't rooted. It's a shame to have to do all that in the stock rom, but Dad LG shielded his cell phone like a nuclear shelter.
manuhuelva said:
Man, i love u, thanks. U fixed my headaches of months with audio in one post. Really, thanks, i remember days with 10-15 kdz flashes, every time triying one different trick for make this module and others (killed my sound) work properly. Thank u again.
Click to expand...
Click to collapse
@manuhuelva please check your pms, thanks
kadyt said:
@manuhuelva please check your pms, thanks
Click to expand...
Click to collapse
Here is ur request bro
I do the workaround of "Loop Test" every reboot for properly start the module

Categories

Resources