Improve Bluetooth audio quality on headphones without aptX or LDAC

kamilchno

Senior Member
Feb 19, 2015
62
6
28
I try the music play on JBL Bar 3.1 with the "HD sound: SBC" codec (Xperia Z3C, Lineage 16) but the sound is distorted. From post
@grandgreed shows that my soundbar works with a maximum of 482 kbps. How to edit the bluetooth library to reduce the sound to 482 kbps?

Code:
Connection:
  bc:6e:64:bc:ad:2b (Xperia Z3 Compact) → 88:d0:39:07:20:2f (JBL Bar 3.1)

Supported codecs:
  Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..53)

Used for audio:
  Audio SBC (44100 | JointStereo | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)
  Audio SBC (44100 | DualChannel | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)


Latest SBC Bitpool value: 38
 

zyhk

Senior Member
May 9, 2020
84
26
18
Maximizing the audio quality of bluetooth

I have enjoyed SBC XQ on TWS earphones very much and find a mod to maximize the audio quality by reducing jitters.

DISCLAIMER: I am not responsible for any damage that may occur to your device, it is your own choice to attempt this mod.

1. No battery optimizations of apps
music players, licensing apps, bluetooth (system app), magisk, keyboard
app, kernel adiutor, etc.

2. No bluetooth absolute volume and setting -6dB gain level
In developer options, you can disable bluetooth absolute volume.
Reduce the sender side volume to -6dB gain level to avoid distortion of the
receiver side DAC. (DACs on portable devices are easily distorted by loudly
compressed music)

3. DRC disabled
In /vendor/etc/audio_policy_configuration.xml, there may be a line containing 'speaker_drc_enabled="true"'. This means that all audio output on your device is deeply compressed. Edit the line to replace "true" with "false" and reboot. Then, the DRC go away.
(Note: Pie GSI roms may have a bug that cannot disable DRC on bluetooth audio output.)

4. Using kernel adiutor to modify kernel settings
Change CPU governors to "performance". Change I/O schedulers to
"deadline" and set their parameters like:
fifo_batch:15, front_merge:1, read_expire:0, write_expire:464,
writes_starved:1, RQ_Affinity:2, read ahead buffer size:1792kB

In the virtual memory section, change the 'Laptop mode' on and swappiness
to be disabled. In the thermal control section, if there is core control then
set it off. If there is CPU hotplug (MPDecision), set it off too. If there is the
core control section, then set all values to their maximum.

5. for MediaTek CPUs
MediaTek is using the EAS+ scheduler that affects CPU governors. To let
really performance mode, edit /vendor/etc/init/hw/init.mt????.rc to replace
a line
'write /proc/cpufreq/cpufreq_sched_disable 0' with
'write /proc/cpufreq/cpufreq_sched_disable 1' .

6. Remove effects
In /vendor/etc/audio_effects.xml, remove effects relating to equalizing
(equalizer, reverb, base boost, virtualizer, etc.) and visualizer.

7. Reducing wifi jitter for streaming servcies and DLNA playback
settings put global wifi_suspend_optimizations_enabled 0

Enjoy.

Note: this mod can maximize also 3.5mm Jack and USB DAC audio quality.
 
Last edited:

zyhk

Senior Member
May 9, 2020
84
26
18
I try the music play on JBL Bar 3.1 with the "HD sound: SBC" codec (Xperia Z3C, Lineage 16) but the sound is distorted. From post
@grandgreed shows that my soundbar works with a maximum of 482 kbps. How to edit the bluetooth library to reduce the sound to 482 kbps?

Code:
Connection:
  bc:6e:64:bc:ad:2b (Xperia Z3 Compact) → 88:d0:39:07:20:2f (JBL Bar 3.1)

Supported codecs:
  Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..53)

Used for audio:
  Audio SBC (44100 | JointStereo | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)
  Audio SBC (44100 | DualChannel | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)


Latest SBC Bitpool value: 38
SBC Bitpool value 38 means your soundbar works at 452kbps bitrate. I think your problem
is caused by DRC. Edit /vendor/etc/audio_policy_configuration.xml to disable DRC unless your ROM is GSI. (Lineageos 16.0 GSI has a bug that cannot disable DRC on bluetooth audio output.)
 

d3vyarth

Senior Member
Jul 10, 2014
367
70
48
Looks like this issue is getting some traction in Google's issue tracker: https://issuetracker.google.com/issues/144517406

Perhaps everyone who's tried this patch can post a list of devices they've tested with to help ease Google's concerns about reliablity?
But this patch will affect aptx and ldac in terms of business, so will google help? It would be hard for them to implement directly but they can provide support for implementation of this as an independent module being harmless.
 

Skittles9823

Recognized Contributor
Jan 9, 2015
1,809
2,044
153
22
Sydney
But this patch will affect aptx and ldac in terms of business, so will google help? It would be hard for them to implement directly but they can provide support for implementation of this as an independent module being harmless.
Affecting aptX and LDAC on the business side is in the interests of Google. They could choose to not pay Qualcomm or Sony to use the codec in the pixel line.

Sent from my Pixel 3a XL using XDA Labs
 

arunsai123

Senior Member
Aug 16, 2012
223
122
73
26
chennai
How to get this working on AOSP based Q custom ROMS? My daily driver ROM(StagOS) doesn't have HD SBC option. Is there any guide/instruction to patch ROM libraries of android 10?
 

d3vyarth

Senior Member
Jul 10, 2014
367
70
48
How to get this working on AOSP based Q custom ROMS? My daily driver ROM(StagOS) doesn't have HD SBC option. Is there any guide/instruction to patch ROM libraries of android 10?
Only option is to flash a ROM patched with this module, major ROMs like Lineage and RR have it. OP has mentioned a list having this feature, go check it and choose one.
Or you can try magisk module first, but it's not guaranteed to work on Q.
 

Skittles9823

Recognized Contributor
Jan 9, 2015
1,809
2,044
153
22
Sydney
Only option is to flash a ROM patched with this module, major ROMs like Lineage and RR have it. OP has mentioned a list having this feature, go check it and choose one.
Or you can try magisk module first, but it's not guaranteed to work on Q.
Lineage hasn't merged in SBC xq in A10, and RR is dead.

Sent from my Pixel 3a XL using XDA Labs
 

joedajoester

Senior Member
Aug 11, 2012
744
100
0
Lineage hasn't merged in SBC xq in A10, and RR is dead.

Sent from my Pixel 3a XL using XDA Labs
I also have a pixel 3a and was thinking about getting galaxy buds or something similar and now I'm wondering if it's even worth it since the quality is significantly worse on non-samsung phones due to the lack of their proprietary codec. Is there any way to get SBC dual channel on a 3a today if lineage hasn't merged it? I'm not sure what to do but I'd really try anything to get it working.
 
Last edited:

Skittles9823

Recognized Contributor
Jan 9, 2015
1,809
2,044
153
22
Sydney
I also have a pixel 3a and was thinking about getting galaxy buds or something similar and now I'm wondering if it's even worth it since the quality is significantly worse on non-samsung phones due to the lack of their proprietary codec. Is there any way to get SBC dual channel on a 3a today if lineage hasn't merged it? I'm not sure what to do but I'd really try anything to get it working.
No Q ROMs have it merged in. If you're on Pie you should be able to find one though.

Personally the Bluetooth audio quality is fine enough if you have a decent pair of TWEs with at least aptX. I've been using a pair of the liberty 2 pros for a little under a year now and they've been great.

Sent from my Pixel 3a XL using XDA Labs
 

zyhk

Senior Member
May 9, 2020
84
26
18
I also have a pixel 3a and was thinking about getting galaxy buds or something similar and now I'm wondering if it's even worth it since the quality is significantly worse on non-samsung phones due to the lack of their proprietary codec. Is there any way to get SBC dual channel on a 3a today if lineage hasn't merged it? I'm not sure what to do but I'd really try anything to get it working.
I've heard that Google's devices are set DRC on all audio output while Samsung's are not.
Please check if 'speaker_drc_enabled' is true or false in /vender/etc/audio_policy_configuration.xml. (Don't use Pie GSIs, they may have a bug that cannot disable DRC on bluetooth audio output)
 

joedajoester

Senior Member
Aug 11, 2012
744
100
0
I've heard that Google's devices are set DRC on all audio output while Samsung's are not.
Please check if 'speaker_drc_enabled' is true or false in /vender/etc/audio_policy_configuration.xml. (Don't use Pie GSIs, they may have a bug that cannot disable DRC on bluetooth audio output)
DRC is enabled on my 3a. What does this mean?
 

Attachments

joedajoester

Senior Member
Aug 11, 2012
744
100
0
See #283 in detail. In short, 'DRC enabled' means that your device is not for Hi-Fi audio listening and your have listened to distorted music till now on the device.
I'll try to disable it and see if there's any difference. When you say distortion, what do you mean? I'm really into audio and I don't notice any bit of distortion or clipping in my audio. I even have my media player gain set negative to avoid any sort of distortion.
 

zyhk

Senior Member
May 9, 2020
84
26
18
I'll try to disable it and see if there's any difference. When you say distortion, what do you mean? I'm really into audio and I don't notice any bit of distortion or clipping in my audio. I even have my media player gain set negative to avoid any sort of distortion.
As you may know soon, the DRC (Dynamic Range Control or Compression) is used to force music under a limited loudness (-15dB or so) while losing audio quality (liveliness or clearness).
 
Last edited:

AndUser254

New member
Jul 11, 2020
1
0
0
It said i need to have a root privilege if i want to do this by android but i dont want to root my devices.Is there any other ways to unlock this sbc xq? Via adb or anything?