Bluetooth Audio Streaming Fix - Samsung Galaxy Nexus

I don't know if anyone else has had issues with streaming any kind of audio through Bluetooth but I found a fix for it without screwing up anything else audio-wise with the phone.
I just got a Mazda with Bluetooth audio built into the stereo and was completely underwhelmed with the quality of the Bluetooth audio compared to an aux plug. It sounded so poor as if the phone converted the high quality 320kbps files I uploaded to Google Play to a lower 64kbps.
I researched and found its in the coding of the audio_policy.conf in system/etc.
The file should contain the following...
# Global configuration section: lists input and output devices always present on the device
# as well as the output device selected by default.
# Devices are designated by a string that corresponds to the enum in audio.h
global_configuration {
attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER
default_output_device AUDIO_DEVICE_OUT_SPEAKER
attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC
}
# audio hardware module section: contains descriptors for all audio hw modules present on the
# device. Each hw module node is named after the corresponding hw module library base name.
# For instance, "primary" corresponds to audio.primary..so.
# The "primary" module is mandatory and must include at least one output with
# AUDIO_OUTPUT_FLAG_PRIMARY flag.
# Each module descriptor contains one or more output profile descriptors and zero or more
# input profile descriptors. Each profile lists all the parameters supported by a given output
# or input stream category.
# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
inputs {
primary {
sampling_rates 8000|11025|16000|22050|24000|32000|44100|48000
channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BACK_MIC
}
}
}
a2dp {
outputs {
a2dp {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_ALL_A2DP
}
}
}
usb {
outputs {
usb_accessory {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_USB_ACCESSORY
}
usb_device {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_USB_DEVICE
}
}
}
}
Click to expand...
Click to collapse
Let me know if anyone else had this problem and if it worked for you.
I just put the previous code in the file with nothing else and rebooted.
I have only tested this on MMuzzy 4.2.1

Didn't seem to be the source of the problem for me. I'm on stock (rooted) and the a2dp values are already what you posted. The a2dp quality has gone to crap since the 4.2 update. There is compression type distortion on all the music I stream from my phone to my car. Is there any 4.2 ROM that has fixed this issue yet? This was perfect up until 4.1.2.

ra990 said:
Didn't seem to be the source of the problem for me. I'm on stock (rooted) and the a2dp values are already what you posted. The a2dp quality has gone to crap since the 4.2 update. There is compression type distortion on all the music I stream from my phone to my car. Is there any 4.2 ROM that has fixed this issue yet? This was perfect up until 4.1.2.
Click to expand...
Click to collapse
Oh wow, didn't know it was a 4.2 problem at all. Makes sense though. I'm not sure of any Roms that work around this at the moment. Keep me posted if you do.

I'm also running stock (rooted) and my audio_policy.conf had the same values you posted. The terrible sound quality is driving me insane! Are you using Google Music on your device? I think there might have been a change in Google Music that caused the problem when they introduced gapless playback. On my Motorola Xoom, running stock (rooted) 4.1, it sounded great before I updated to the new Google Music. Ever since the update, it sounds like crap. Rolling back to the old version does nothing. Maybe since Google Music is a system file on Google Experience devices, the update modified something else on the system level.

Aw man you guys are lucky you can at least steam your music to your car I can never get it to work using my gnex streaming to a Fiat Punto which uses blue and me. I can connect for calls to be made and received but never can get music to work.
Do you have to use bluetooth tether or something?
What I tried was connecting to Bluetooth on the car and press play on Google play music and nothing happens on the cars speakers just music plays of the phone.
I also tried a 3.5mm - USB and plugged that into the car and same results as above. I think the car doesn't support the file system of gnex.
Can you explain to me how you guys are streaming as I'd love to use this feature
Sent from my Galaxy Nexus

Are you sure that ad2p is working with your radio? Check manual!
Used it with a lot of cars and adapters.
Never get problems with connections or quality.

FrankNS said:
Are you sure that ad2p is working with your radio? Check manual!
Used it with a lot of cars and adapters.
Never get problems with connections or quality.
Click to expand...
Click to collapse
Personally I really don't know, to sound extremely noobish could you explain exactly how you go about streaming to a car?
Sent from my Galaxy Nexus

MetalMessiah78 said:
I'm also running stock (rooted) and my audio_policy.conf had the same values you posted. The terrible sound quality is driving me insane! Are you using Google Music on your device? I think there might have been a change in Google Music that caused the problem when they introduced gapless playback. On my Motorola Xoom, running stock (rooted) 4.1, it sounded great before I updated to the new Google Music. Ever since the update, it sounds like crap. Rolling back to the old version does nothing. Maybe since Google Music is a system file on Google Experience devices, the update modified something else on the system level.
Click to expand...
Click to collapse
Sorry for replying so late...
I'm experiencing the same issue as you but I can't say it was better on 4.1 because I only got my car at the beginning of December. I initially found Google Music to have this problem but since I have learned that Pandora is the same result.
My code fix did not fix it after I upgraded my ROM even after changing the code again in the new ROM. Not sure where the problem lies.
Any luck from anyone else?

I'm on 4.2.1 (CM10.1 M1), and I haven't had too many problems with bt streaming. I do think the quality use to be better on CM10, and a few times its paused itself randomly, but not so bad I want to connect a cable. I'm using PowerAmp as my music player, and the XtremeMac InCharge Auto BT.

It has been fixed in the latest nightly
Sent from my Nexus 4 using Tapatalk 2

Well I don't think it will fix audio streaming because I have tested it with CyanogenMod's audio_policy.conf!
At least I got it better a little bit and that file is included in my ROM, but that won't fix the audio streaming quality completely,I have also added CM's Bluetooth files ("/system/etc/bluetooth/") but still pretty same result..
Then I sent message to Cm dev team and I got reply that the Bluetooth files are incompatible with stock android ROM so it's not possible to fix A2DP streaming with CM's files!
But yeah, I know that audio_policy.conf is one of the files that affects to A2DP streaming quality..

manumanfred said:
Well I don't think it will fix audio streaming because I have tested it with CyanogenMod's audio_policy.conf!
At least I got it better a little bit and that file is included in my ROM, but that won't fix the audio streaming quality completely,I have also added CM's Bluetooth files ("/system/etc/bluetooth/") but still pretty same result..
Then I sent message to Cm dev team and I got reply that the Bluetooth files are incompatible with stock android ROM so it's not possible to fix A2DP streaming with CM's files!
But yeah, I know that audio_policy.conf is one of the files that affects to A2DP streaming quality..
Click to expand...
Click to collapse
Yes I was assuming everyone would understand you need to flash CM to get this fix....
Sent from my Nexus 4 using Tapatalk 2

FYI, i tested the BT Audio quality in my car tonight and it is MUCH MUCH better =) Cymbals are crisp!

Vanhoud said:
FYI, i tested the BT Audio quality in my car tonight and it is MUCH MUCH better =) Cymbals are crisp!
Click to expand...
Click to collapse
Are you using a new ROM? After flashing Aroma's, I have no issues with Bluetooth at all. He raised the streaming quality so its perfect now. Give it a try!

gfro9191 said:
Are you using a new ROM? After flashing Aroma's, I have no issues with Bluetooth at all. He raised the streaming quality so its perfect now. Give it a try!
Click to expand...
Click to collapse
yes im using the latest CM 10.1 nightly

Related

A2DP bluetooth quality?

Hi,
Anyone that knows at which settings A2DP is operating by default?
Bitpool?
Samplerate?
Where could those settings be altered? "\system\etc\bluetooth"?
jmelhus
I'd be interested in improving A2DP audio quality as well - some tracks really suffer via bluetooth.
It'd be nice if there was a way to play mp3 files directly, rather than having to transcode them to SBC first...
ClarkyCat said:
It'd be nice if there was a way to play mp3 files directly, rather than having to transcode them to SBC first...
Click to expand...
Click to collapse
directly via a2dp compatible headsets?
le3ky said:
directly via a2dp compatible headsets?
Click to expand...
Click to collapse
Yes.
There's another post about this here.
thanks for the info, didn't know about that
Thought it was just me!
Yeah - the high frequencies like cymbal crashes are distorted.
Nice I'm not the only one then
Gave a try looking into the source code, but were'nt able to clarify it... Maybe someone else that's more experienced?
Sorry folks, but I were'nt able to post a URL in this forum because I'm a new user (half a year) and my account is not reviewed yet
Snapshot of / platform/external/bluetooth/bluez.git:
android.git.kernel.org/?p=platform/external/bluetooth/bluez.git;a=snapshot;h=3a8a13d6ce59205d0a68bdee4835fded32042791;sf=tgz
BTW, here is the problem reported to Google (please star this one)
code.google.com/p/android/issues/detail?id=9888&q=bitpool&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

My whole (HE-AAC v2) music collection is screwed after Froyo update :(

I've encoded all my music that I use on the phone into .m4a (HE-AAC v2) format. It had very nice quality in Android 2.1...
But after the 2.2 update I've noticed it sounds terrible, it's not even stereo anymore, I guess it's not decoding the parametric stereo correctly
Any ideas how to fix this?? This has to be a bug since I doubt I'm the only one with this problem...

[Q] Nex7/2 (stock Android) very bad audio quality

Having been almost in some sort of heaven with this new tab the last days. However one big problem I just noticed when today bringing the device outdoors for music-listening: the audio quality is terrible.
Now tested with different flac's, 320 kbps MP3's and mp4-video's with sound from the internal speaker or connected to headphones (Sehnheisser and Philips), Technics amplifier, Logitech PC-speakers (two different types,one cheap other expensive). Sound quality is bad on all of them. Compared to my Galaxy phone it is like the difference between a Rols Royce and a Trawant car. Very unnatural metallic sound. And also very quickly (hardly extra bass and/or gain) distrorting. While bass of equalizer (different apps) and not too loud volume one speaker-side of my Sehnheiser headphone blew out..
Anyone else also not happy about audio-quality? Or is there a solution? And what is a good audio-manager for rooted stock Android 4.3? On my phone DSP-Manager for instance works perfectly, but that is not avaible for Nexus 7/2.
Thanks in advance,
Juul
I rooted my n7.2 2 days after getting it. But didn't get a chance to try out the audio quality until I flashed AwesomeBeats. With correct parameters for my satisfaction, the sound quality was awesome, more than my ol HTC Desire. So the suggestion is to flash an audio mod, and see to the parameters for better audio results. The best profile for internal speakers is higher treble, and low, or almost no bass.
I am a huge fan of sound, and have extensively customised all my audio devices, from my pc's internal speakers, to my home-made amplifier and woofer system. ViperFX seems better for my external speaker system, due a larger equalizer, while AwesomeBeats is better for my earphones(also my own)
Another suggestion is to tweak all audio parameters for the audio mod you flash.
try fauxsound app to make it LOUDER, i know it works good but it distorts the sound
or try that viper4 mod for headphone sound quality
The DAC is perfectly fine. The headphone amp has a very high output impedance (38 Ohm), so you may get frequency shifts with headphones. I have a Galaxy S i9000 with Voodoo sound and IMO, the difference between the DACs is very small (there is a big difference driving headphones directly).
You may have a mixer/equalizer setting somewhere that causes clipping and the metallic sound.
The Cyanogenmod based ROMs should come with DSP Manager. I'm fairly sure the CM10.2 nightlies include it; Slim Bean definitely does.
Thanks for reply's.
I have i9000 too and sometimes use DSP other times I activate Voodoo. With eather one, but also with both turned off the sound of the i9000 is very superior. On the Nexus I have only tried equalizer within music player apps and without. Also I read a lot more complaints about dissappointing audio quality of new Nexus around the web and also on some reviews and included discussions on major tech-sites.
I am plannimg on adding DSP to my rooted Nexus 7 Flo with original bootloader. Topic about adding DSP is here: http://forum.xda-developers.com/showthread.php?p=45638957#post45638957 . I also asked a question there concerning keeping OTA-functionality after adding DSP.
Same here, it just doesnt sound as good as my nexus 10 from samsung. Im using earphone audeo 323 something like that. But did u try with poweramp, works for me at least. This is making me less likely to listen to music lol. Getting nexus 5 to replace it for music.
I have tried a lot of music players, PowerAmp Trial included. Not any (or that big) difference in quality compared to different other music players as far I can remember. The user interface is great, but PowerAmp and almost very other music players lack one for me very important feature: samba (smb) support to stream music from my NAS/WDTV Live and Windows Shares.
Found only three musicplayers with very stable smb-stream support: Neutron (trial), XenoAmp and ArmAmp. All the only few other music players with smb were not good enough because of unstable stream or missing features such as lockscreen-support, etc. Neutron and especially XenoAmp are terrible to use concerning their user interface.
ArmAmp is not as fancy as some other music players, but it excels in user friendlyness. Has the for me major important features such as eq and lockscreen-support. And last but not least outstanding quality of smb-streaming from my NAS/WDTV Live. So I bought the ad remover from that app. It streams my music from my Google Drive also perfectly by the way.
(BS Player not so nice interface and misses lockscreen and equalizer (eq) but streams smb great also. Media Players of ES Explorer and Total Commander stream smb-shares also very good but are way too limited in options also).
But I have tried a lot of music players with only local play-support on my Nex7/2. Even too much to mention. They don't fix poor audio quality of device.
A reason to buy PowerAmp by the way might be if stock Android 4.3 had Cifs-support, so you can open all files of NAS/Windows Shares as if they were locally on Android device. Works great on my Galaxy S1 with Slim Bean 4.2.2. Google however broke support for Cifs in recent Android version(s). How I miss that...Looking forward to someone having a solution for that. It makes me even consider a custom rom while one of the major great things of the Nexus is the possibility of OTA-updates.

Modify audio_policy.conf to force passthrough AC3

So I am contemplating rooting my Shield TV, but wanted to seek some guidance first from those more knowledgable than me.
I am using my shield with the stock firmware, but am having issues getting DD to passthrough when playing videos in the many video player apps, Kodi, VLC e.t.c
I think the problem is that the EDID for my TV does not report it supporting AC3/DD to the shield, so the system is down sampling everything to stereo, and I have no way of overriding it. Problem is my TV does in fact support DD fine as I am sending it via ARC to an audio receiver, I can test this with a Raspberry Pi/Apple TV where I can force the box to send the DD over HDMI.
No I can't plug the Shield TV directly into my AVR as it doesn't not support HDMI 2.0a, which is needed for [email protected]/HDR.
So, I'm wondering if I can force the shield to stop listening to the HDMI sink and output what I tell it to.
No I have found some information about editing the audio_policy.conf file, and changing the passthrough mode from dynamic to something manually specified, problem is I have no idea what the ENUM should be for DD, and also what other formats I should specify to make sure things like Stereo audio still get passed correctly, similarly I probably need to override the channel mask, but again not entirely sure whether I need to still include 2.0 channels for stereo audio to work.
I would just pile in and see what works, but as the box isn't rooted yet as I haven't needed to, I'm loathed to spend the time doing that if it's not going to achieve anything.
Here's the part of the file I think needs to be changed:
outputs {
primary {
sampling_rates 48000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET|gamecast_out
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
multichannel {
sampling_rates 8000|16000|32000|64000|128000|11025|22050|44100|88200|176400|12000|24000|48000|96000|192000
channel_masks dynamic
formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED
devices AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_DIRECT
}
passthrough {
sampling_rates dynamic
channel_masks AUDIO_CHANNEL_OUT_MONO|AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_QUAD|AUDIO_CHANNEL_OUT_SURROUND|AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_7POINT1
formats dynamic
devices AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_DIRECT
}
hr_audio {
sampling_rates 96000|192000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_24_BIT_PACKED
devices AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_DIRECT
}
}
Click to expand...
Click to collapse
Anyone got any experience with this?
Thanks
Gareth
I have never experience any problem with shield tv in regards to ac3 nor dts . My shield tv is connected to Sony bravia directly via hdmi and then the sound is forwarded via optical s/pdif to the sound system. I am using mx player...

Avoiding Android Mixer/48Khz upsampling of 44.1/16 audio

Is anybody aware of a system-wide solution to avoid the upsampling of 44.1KHz / 16-bit music to 48KHz?
With system-wide, I mean a solution that does not rely on certain player apps such as UAPP or Neutron, which we know can do it, but only when playing from inside that app. A solution which works with all (or most) audio sources and apps, modifying the default system behavior of upsampling 44/16 to 48KHz when playing to the Quad DAC.
Personally, I am looking for solutions to work with Tidal offline tracks. Others are looking for solutions to Qobuz, Spotify, Google Play Music or other apps.
Do some of the custom ROMs have fixes for this? Are there policy file or build.prop changes that are proven to fix it?
Googling and searching on XDA finds many references to Android's infamous 48KHz upsampling/re-sampling (SRC) but none that look to be actual, working solutions for our phones. I hope I am wrong and that there is a simple fix which I overlooked.
Background
The LG V series and G series (most models) are appreciated by audiophiles for their excellent ESS Sabre DAC (ES9218P, branded Quad DAC by LG). It can deliver amazing sound quality when paired with good headphones or IEMs (In-Ear-Monitors, earphones). (And no, that doesn't necessarily mean High-Impedance headphones/IEMs, but that's a whole other discussion.)
V30 in particular has gained a rather large following among audiophiles, many of whom congregate on head-fi.org, where you will find a huge V30 thread, a growing V40 thread and a dedicated V30 Music apps, tricks and tips thread.
When it comes to HiRes music (anything higher than 48KHz sample rate and anything 24-bit) most music apps play it correctly: Bit-perfect, without any processing or re-sampling, directly to the DAC -- exactly as audiophiles want it. A few apps are known to downsample HiRes music to Android's default sample rate of 48KHz, but those are the exception.
However 44.1KHz / 16-bit music is always routed through Android's Mixer, which upsamples it to 48Khz. This causes artifacts that are audible to good ears, particularly when played on sensitive IEMs. Since 44/16 includes anything CD quality (whether compressed or uncompressed) that means most music in the world gets molested before it reaches the DAC.
For whatever reason, LGs implementation of the ESS DAC throughout the V and G series have suffered from this inability to play 44/16 music without upsampling. It is the one thing that truly hampers their reputation among audiophiles (arguably even more so than the inability to select between gain modes, which is annoying, but not a deal breaker for most).
This can be verified by inspecting the Output Thread of audio_flinger dumps, showing whether an output stream is played through the DIRECT path (not the MIXER path) and with the offloadable flag (sent straight to the DAC for decoding and rendering). Of course it can also be verified by listening for those artifacts.
The last 1.5 years, audiophile V30 users have relied on UAPP or Neutron as music players because they are able to work around this upsampling. They do so by converting 44/16 format music to 44/24 on the fly, adding zero bits to convert 16-bit to 24-bit. Different from the 48KHz upsampling, this is a harmless conversion which doesn't affect audio quality. (Of course it's also much faster, requiring no interpolation.) And once music is in 44/24 format, it is no problem sending it directly to the DAC, as described above.
We recently confirmed that PowerAmp also is able to do this correctly now (which wasn't always the case). But only if you configure it to convert all music to 44/24, which obviously isn’t desirable for HiRes.
UAPP is my personal favorite, as it also supports streaming services Tidal, Qobuz and Google Play Music, in addition to network services and any PCM or DSD file you can throw at it. All of it pristinely bit-perfect. But it cannot support Tidal or Qobuz offline, which means when playing offline you are limited to HiRes music (only a small part of their catalog) unless you can tolerate the 48KHz upsampling of CD quality tracks in the Tidal/Qobuz apps.
Head-Fi titan @csglinux and I have set out looking for a solution to this, along with other interested head-fi members. csglinux has been testing various policy and build.prop edits (so far no cigar), while I have been digging through the ESS driver source code from the kernel (but I am not set up to actually build the kernel).
More background and discussion can be found in csglinux' V30 Music apps, tricks and tips thread on head-fi. I also recently had a brief (and more technical) discussion with @ctheanh about this over in the XDA V40 forum, starting here. Arguably those posts would be more suited here.
We have several ideas, but it is a steep hill to climb, as none of us are Android developers. But before posting pages of what we have already tried, or dozens of audio_flinger dumps from various setups, we wanted to throw the topic out there for input. Again, maybe there is already a solution we have overlooked.
Any input is much appreciated!
TL;DR
I personally recommend UAPP as the best $8 anybody can spend if they care about sound quality on their V30. This is not about avoiding that. But UAPP doesn't cover all scenarios, in particular offline Tidal and Qobuz.
That's why we're looking for a system-wide fix (mod or custom ROM) that avoids the upsampling.
Reserved (more technical background and evidence to come)
TheDannemand said:
Is anybody aware of a system-wide solution to avoid the upsampling of 44.1KHz / 16-bit music to 48KHz?
With system-wide, I mean a solution that does not rely on certain player apps such as UAPP or Neutron, which we know can do it. A solution which works with all (or most) audio sources and apps, changing the default behavior of upsampling 44/16 to 48KHz (when playing to the Quad DAC).
Personally, I am looking for solutions to work with Tidal offline tracks. Others are looking for solutions to Qobuz, Spotify, Google Play Music or other apps.
Do some of the custom ROMs have fixes for this? Are there policy file or build.prop changes that are proven to fix it?
Googling and searching on XDA finds many references to Android's infamous 48KHz upsampling/re-sampling (SRC) but none that look to be actual, working solutions for our phones. I hope I am wrong and that there is a simple fix which I overlooked.
Background
The LG V series and G series (most models) are appreciated by audiophiles for their excellent ESS Sabre DAC (ES9218P, branded Quad DAC by LG). It can deliver amazing sound quality when paired with good headphones or IEMs (In-Ear-Monitors, earphones). (And no, that doesn't necessarily mean High-Impedance headphones/IEMs, but that's a whole other discussion.)
V30 in particular has gained a rather large following among audiophiles, many of whom congregate on head-fi.org, where you will find a huge V30 thread, a growing V40 thread and a dedicated V30 Music apps, tricks and tips thread.
When it comes to HiRes music (anything higher than 48KHz sample rate and anything 24-bit) most music apps play it correctly: Bit-perfect, without any processing or re-sampling, directly to the DAC -- exactly as audiophiles want it. A few apps are known to downsample HiRes music to Android's default sample rate of 48KHz, but those are the exception.
However 44.1KHz / 16-bit music is always routed through Android's Mixer, which upsamples it to 48Khz. This causes artifacts that are audible to good ears, particularly when played on sensitive IEMs. Since 44/16 includes anything CD quality (whether compressed or uncompressed) that means most music in the world gets molested before it reaches the DAC.
For whatever reason, LGs implementation of the ESS DAC throughout the V and G series have suffered from this inability to play 44/16 music without upsampling. It is the one thing that truly hampers their reputation among audiophiles (arguably even more so than the inability to select between gain modes, which is annoying, but not a deal breaker for most).
This can be verified by inspecting the Output Thread of audio_flinger dumps, showing whether an output stream is played through the DIRECT path (not the MIXER path) and with the offloadable flag (sent straight to the DAC for decoding and rendering). Of course it can also be verified by listening for those artifacts.
The last 1.5 years, audiophile V30 users have relied on UAPP or Neutron as music players because they are able to work around this upsampling. They do so by converting 44/16 format music to 44/24 on the fly, adding zero bits to convert 16-bit to 24-bit. Different from the 48KHz upsampling, this is a harmless conversion which doesn't affect audio quality. (Of course it's also much faster, requiring no interpolation.) And once music is in 44/24 format, it is no problem sending it directly to the DAC, as described above.
We recently confirmed that PowerAmp also is able to do this correctly now (which wasn't always the case). But only if you configure it to convert all music to 44/24, which obviously isn’t desirable for HiRes.
UAPP is my personal favorite, as it also supports streaming services Tidal, Qobuz and Google Play Music, in addition to network services and any HiRes PCM or DSD file you can throw at it. All of it pristinely bit-perfect. But it cannot support Tidal or Qobuz offline, which means when playing offline you are limited to HiRes music (only a small part of their catalog) unless you can tolerate the 48KHz upsampling of CD quality tracks in the Tidal/Qobuz apps.
Head-Fi titan @csglinux and I have set out looking for a solution to this, along with other interested head-fi members. csglinux has been testing various policy and build.prop edits (so far no cigar), while I have been digging through the ESS driver source code from the kernel (but I am not set up to actually build the kernel).
More background and discussion can be found in csglinux' V30 Music apps, tricks and tips thread on head-fi. I also recently had a brief (and more technical) discussion with @ctheanh about this over in the XDA V40 forum, starting here. Arguably those posts would be more suited here.
We have several ideas, but it is a steep hill to climb, as none of us are Android developers. But before posting pages of what we have already tried, or dozens of audio_flinger dumps from various setups, we wanted to throw the topic out there for input. Again, maybe there is already a solution we have overlooked.
Any input is much appreciated!
Click to expand...
Click to collapse
Erm i suggest bit perfect mode on USB audio player pro
Mrxyzl said:
Erm i suggest bit perfect mode on USB audio player pro
Click to expand...
Click to collapse
Thank you. Again, I already use that, and have for the last 1.5 years. But UAPP doesn't cover all scenarios, in particular offline Tidal and Qobuz, nor Spotify and other popular streaming services.
That's why I'm asking if anybody knows of a system-wide fix (mod or custom ROM) that avoids the upsampling.
I seem to recall that you did some work into this in a custom ROM, right?
Edit: It's a long opening post, so maybe I should state this briefly:
1) This is about a system-wide fix to avoid the Mixer and upsampling of 44/16 audio when playing through the Quad DAC.
2) This is not about avoiding UAPP or Neutron. I personally recommend UAPP as the best $8 anybody can spend if they care about sound quality on the V30.
So my settings sucks?
TheDannemand said:
snip.
Click to expand...
Click to collapse
Sent from my LG-H932 using XDA Labs
BROKEN1981 said:
So my settings sucks?
Click to expand...
Click to collapse
Well, yes and no
Personally I wouldn't do it. I would set PowerAmp to output at 44.1KHz and 24-bit, which should avoid any re-sampling and just convert to 24-bit. Make sure you disable Dither (somewhere else in those Settings) so that it just adds zero bits in that 16-to-24-bit conversion. That way your 44/16 music should be sent unchanged to the DAC in 44/24 format.
But then you need to change your settings when you play HiRes music in PowerAmp, since otherwise it will be downsampled to 44.1KHz.
That said, as a fixed setting you are much better off letting PowerAmp upsample to 352Khz than letting the Android Mixer upsample to 48Khz. 44-to-352KHz is a harmonic upsampling (8x44=352) so it can be done perfectly, whereas 44-to-48KHz is just ugly. And when playing HiRes 88KHz and 176KHz music, it will be harmonically upsampled to 352Khz as well.
Ideally, PowerAmp would have had a way to only convert 44/16 to 44/24 and pass everything else through untouched. That's what UAPP does when it detects that it's running on a V30.
Another benefit of UAPP is it understands MQA and knows how to set a flag to enable the V30's hardware unfolding and rendering. (Note that you don't have to buy UAPP's optional MQA decoder for this.) With PowerAmp, the MQA will either be lost (if you re-sample or process the stream in any way) or ignored because the flag to enable MQA decoding won't be set.
Disclaimer: I don't use PowerAmp myself, so I cannot say if it it does something other than what those settings imply. I am completely open to corrections if any of my assumptions about it are wrong.
The DAC itself will upsample internally as part of so-called "noise shaping" to minimize the rounding errors that occur when trying to fit a digital sample into an analog sine wave. But we want to leave this process just to the DAC, and not add another step of upsampling (or any other digital modification) before sending music to the DAC. And particularly not an ugly upsampling like 44-to-48KHz, which simply cannot be done in a pretty way.
TheDannemand said:
snip.
Click to expand...
Click to collapse
Thanks for that detailed answer man, I appreciate it!
I tried neutron, hated the UI. I'll try out USB audio pro. Looks like it's a bit updated to MD. It's not as nice looking as PA, but that's ok lol.
Sent from my LG-H932 using XDA Labs
BROKEN1981 said:
Thanks for that detailed answer man, I appreciate it!
I tried neutron, hated the UI. I'll try out USB audio pro. Looks like it's a bit updated to MD. It's not as nice looking as PA, but that's ok lol.
Click to expand...
Click to collapse
I am the same: I tried Neutron and absolutely could not stand that UI. But I know some who love it. And they deserve credit for being first to crack the 48KHz upsampling on V30 (as I understand).
With UAPP I was instantly comfortable with its UI, features, and of course the sound quality -- the latter being as good as it can get, since it plays everything bit perfect and even supports MQA. If it could handle Tidal offline, I wouldn't even need a solution to bypass the Android Mixer, as that is the only big thing missing for me. Again, with others it's Qobuz offline or Spotify or some other music service.
TheDannemand said:
I am the same: I tried Neutron and absolutely could not stand that UI. But I know some who love it. And they deserve credit for being first to crack the 48KHz upsampling on V30 (as I understand).
With UAPP I was instantly comfortable with its UI, features, and of course the sound quality -- the latter being as good as it can get, since it plays everything bit perfect and even supports MQA. If it could handle Tidal offline, I wouldn't even need a solution to bypass the Android Mixer, as that is the only big thing missing for me. Again, with others it's Qobuz offline or Spotify or some other music service.
Click to expand...
Click to collapse
Trying it out, I like it but have a few issues that are getting on my nerves.
1) no cross fade into the new track.
2) It separates my albums for whatever reason. PowerAmp will not do this. My tags are the way I want them. I did my own edits.
Edit, the EM album that's solo is also in the EM album collection. Just chose to list it 2 times.
Sent from my LG-H932 using XDA Labs
BROKEN1981 said:
Trying it out, I like it but have a few issues that are getting on my nerves.
1) no cross fade into the new track.
2) It separates my albums for whatever reason. PowerAmp will not do this. My tags are the way I want them. I did my own edits.
Edit, the EM album that's solo is also in the EM album collection. Just chose to list it 2 times.
Click to expand...
Click to collapse
I apologize for the tardy response. Swamped these days.
1) Ahh. I don't use cross fading myself, but I see what you mean, it's a valid request.
2) My entire music collection is carefully curated as well (manually edited tags) and I've never seen any problems with UAPP handling albums correctly. You could try Clearing the database and Scan again. But you probably already did...
I suggest you write to the Dev about both issues. You can either email [email protected] or post in their support thread on Head-Fi. I've found them very response to user requests and issues.
BTW, also check this recent Head-Fi post by @csglinux: It appears LG really screwed up the Quad DAC in Pie, so it now re-samples even some HiRes files (which all play perfectly on Oreo from most apps). It also sabotages UAPP in the process.
I don't know why LG is so hellbent on messing up music playback, when they spend good money putting a high-end audiophile grade DAC in their phones
TheDannemand said:
I apologize for the tardy response. Swamped these days.
1) Ahh. I don't use cross fading myself, but I see what you mean, it's a valid request.
2) My entire music collection is carefully curated as well (manually edited tags) and I've never seen any problems with UAPP handling albums correctly. You could try Clearing the database and Scan again. But you probably already did...
I suggest you write to the Dev about both issues. You can either email [email protected] or post in their support thread on Head-Fi. I've found them very response to user requests and issues.
BTW, also check this recent Head-Fi post by @csglinux: It appears LG really screwed up the Quad DAC in Pie, so it now re-samples even some HiRes files (which all play perfectly on Oreo from most apps). It also sabotages UAPP in the process.
I don't know why LG is so hellbent on messing up music playback, when they spend good money putting a high-end audiophile grade DAC in their phones
Click to expand...
Click to collapse
I did send an email to the Dev. We tested a few things and then I guess he quickly made a newer version of the app and gave me a download link. It's a beta but he seen what the issue was and fixed it. Total time with emails and download link took about 30 minutes. I never expected the guy to reply so fast that a few minutes would go by with me not seeing his new email.
Awesome support! Just wish the UI would be gesture-based. Having to back out of a current playing album is a pain in the butt. PowerAmp definitely did this correctly.
Sent from my LG-H932 using XDA Labs
I've edited three config files from US998 30b which I attached to this post. With this mod I always get 24bit and 44.1kHz output through Mixer. Now I can't hear the noise, but I'm curious if anyone can so please test it after making a system backup in TWRP. The mod contains the files without any script.
@TheDannemand and everyone who is interested.
I was trying to get direct output, but it's maybe impossible. I tried to have direct output instead of deep_buffer, but only UAPP wanted to use direct and other apps "moved" to primary output. Also the primary output does not tolerate any messing cause it's a p...y. So I'm not able to do what even @csglinux couldn't.
Solutions:
1) It's not possible due to most apps just don't support direct output even if we convert it to 24bit on the fly. Apps can use primary output instead of deep buffer but direct is like an isolated thing lol. I did enough tests with policy files to get bored of it.
2) Maybe I can try replacing or somewhat in mixer_paths_tavil.xml in vendor/etc to get the direct output. (?)
3) We need to do hard modifications in source codes and codec driver. Or just accept this Mixer and use it with some mod. So sad.
DooMLoRD77 said:
I've edited three config files from US998 30b which I attached to this post. With this mod I always get 24bit and 44.1kHz output through Mixer. Now I can't hear the noise, but I'm curious if anyone can so please test it after making a system backup in TWRP. The mod contains the files without any script.
@TheDannemand and everyone who is interested.
I was trying to get direct output, but it's maybe impossible. I tried to have direct output instead of deep_buffer, but only UAPP wanted to use direct and other apps "moved" to primary output. Also the primary output does not tolerate any messing cause it's a p...y. So I'm not able to do what even @csglinux couldn't.
Solutions:
1) It's not possible due to most apps just don't support direct output even if we convert it to 24bit on the fly. Apps can use primary output instead of deep buffer but direct is like an isolated thing lol. I did enough tests with policy files to get bored of it.
2) Maybe I can try replacing or somewhat in mixer_paths_tavil.xml in vendor/etc to get the direct output. (?)
3) We need to do hard modifications in source codes and codec driver. Or just accept this Mixer and use it with some mod. So sad.
Click to expand...
Click to collapse
Huge thanks to you, DoomLoRD77, for your efforts on this. Major props also to TheDanemmand, who has been relentlessly pursuing this little problem with LG's phones.
So, I took your config files, and voila, they work as promised, at least according to audio_flinger:
Output thread 0xeb1034c0, name AudioOut_15, tid 1804, type 0 (MIXER):
I/O handle: 21
Standby: no
Sample rate: 44100 Hz
HAL frame count: 1792
HAL format: 0x6 (AUDIO_FORMAT_PCM_24_BIT_PACKED)
HAL buffer size: 10752 bytes
Channel count: 2
Channel mask: 0x00000003 (front-left, front-right)
Processing format: 0x6 (AUDIO_FORMAT_PCM_24_BIT_PACKED)
That's the good news. The bad news... for reasons I don't completely understand, all the exact same re-sampling artifacts are there, just as audible as before. (I think most of us are using the same test track here - Speak to Me, from The Dark Side Of The Moon.) Either audio_flinger is misreporting, or being fooled, or there's something else going on here that I don't understand.
I'd mentioned to some of the other headfi folks that Amazon's new lossless streaming service doesn't display these digital artifacts (it still doesn't sound quite as good as Tidal to my ears, but the SQ gap is much closer). Amazon re-samples everything on Android to 48 kHz using 32-bit float. I would have thought doing no resampling at all and shifting to 24-bit for the digital volume control would be enough, but apparently not. My best guess is those extra zeros we're packing into those remaining 8 bits aren't actually being used by the digital volume control.
DooMLoRD77 said:
I've edited three config files from US998 30b which I attached to this post. With this mod I always get 24bit and 44.1kHz output through Mixer. Now I can't hear the noise, but I'm curious if anyone can so please test it after making a system backup in TWRP. The mod contains the files without any script.
@TheDannemand and everyone who is interested.
I was trying to get direct output, but it's maybe impossible. I tried to have direct output instead of deep_buffer, but only UAPP wanted to use direct and other apps "moved" to primary output. Also the primary output does not tolerate any messing cause it's a p...y. So I'm not able to do what even @csglinux couldn't.
Solutions:
1) It's not possible due to most apps just don't support direct output even if we convert it to 24bit on the fly. Apps can use primary output instead of deep buffer but direct is like an isolated thing lol. I did enough tests with policy files to get bored of it.
2) Maybe I can try replacing or somewhat in mixer_paths_tavil.xml in vendor/etc to get the direct output. (?)
3) We need to do hard modifications in source codes and codec driver. Or just accept this Mixer and use it with some mod. So sad.
Click to expand...
Click to collapse
Thanks a ton for your efforts here and for sharing these modified files!
Unfortunately I won't be able to test them myself, both because my V30 is still on Oreo (and I have no plans to update it yet) and because I am currently unrooted, waiting for LG to approve a warranty claim (at which they're dragging their feet).
I think with your work and @csglinux' feedback we have established that there is something going on beyond just the re-sampling of the Mixer. The fact your changes eliminated the noise you were hearing, but NOT the artifacts csglinux has reported, would indicate that maybe we have two different problems going on. And so far only playing DIRECT (bypassing the Mixer) solves both problems.
Re your point (3) I did actually spent quite a bit of time studying the source code for the ESS codec driver for the various LG models (es9218p.c and es9218p.h in the kernel source code). Interestingly, 44100 is NOT one of the sample rates listed in there as being supported. The rates and formats listed below are references in the snd_soc_dai_driver structure towards the end of the driver, with which the codec driver declares its capabilities. I've been puzzled how DIRECT play of 24/44 is even possible given this fact. But audio_flinger claims to do it -- and it sounds great when it does.
Code:
#define ES9218_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | \
SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 | \
SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_384000 ) //|SNDRV_PCM_RATE_352800 TODO for dop128
#define ES9218_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | \
SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE | \
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE | \
SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE)
I am completely swamped with work at the moment, so I have no time at all to play (neither play music NOR tinker with my phone). I promise I will contribute more actively again once I have more time AND once I have a phone I can root.
Once again thanks a lot for your contribution! :good::good::good:
csglinux said:
*
Click to expand...
Click to collapse
You're welcome. Yes, I played the Speak To Me song at the volume level of 10/75 from about 0:14 to 0:40. It can be possible that it's just misreporting, but it's weird that you hear the same artifacts and I hear just very very little noise instead of big. So we hear 2 different thing separately. From my experience it seems that the extra 8 bits are used for volume control. Or 24bit is more accurate for interpolating as you wrote something on head-fi. I will see more results later with GR09.
Also, thank you for the efforts and for this test!
I can mention an app for 16/44.1 lossless it's called D**zl#ad*r (replace "*" with "e" and "#" with "o"). I know it's not great to get files for free but I can play it offline through direct. It's for Android too and there are some funny facts how it can work.
TheDannemand said:
*
Click to expand...
Click to collapse
You're welcome, too. Something is really weird about the Mixer as there is 2 kind of issue, indeed. I will just probably give up this soon for now, but I'm thankful for the support as I could achieve a small improvement.
If it's really a declaration as you said and I looked a bit into it then it's also weird how it can support 44.1 without resampling.
To replace Tidal offline there is an app above but it requires re-downloading everything. I solved it by automation. Life is just short to be always a good boy:silly:
Looks like deep-buffer is used for high latency low power output and this is ok for music. As I'm new I can't post proper link here, but googling "android audio deep buffer" gives answer.
To enable deep-buffer for music we need:
adb shell setprop audio.deep_buffer.media 1
So it looks like without it android is still using 48kHz from primary output and still resamples internally or I'm missing something. I own V30 but I'm not rooted yet so can't test this.
In the meantime I've looked into policy and there's additional MQA policy available. Maybe UAPP is using it to play MQA on LG?
I've also tried to use 16bit direct output from UAPP and there's noise on all recordings when V30 volume is low and I set my amplifier to almost full. This is unrealistic scenario but easily shows 16bit limitation. @DooMLoRD77, @TheDannemand could you check this UAPP setting if it plays through mixer or directly: MQA enabled and 16 bit hi-res driver audio format. Could tou also check if setting mixer into 32bit float mode works? This setting works for UAPP.
Eneen said:
*
Click to expand...
Click to collapse
You are right that mixer is using 48khz upsampling either through deep buffer or primary output or call it whatever. Deep buffer for music is by default. Where did you found that MQA policy?
I can't help you now as my V30's motherboard is dying and it will take some time to replace it, but I can tell you that modifying the mixer to give 32bit output gives nothing just mute sound and lagging youtube playback maybe because of buffer size or idk.
You can have 32bit with direct, of course. Anyway, what recordings are giving noise? Vinyl? 16 bit does not have limitations like that. I guess you hear the noise generated by AVC in the Quad DAC. It has a high SNR but not enough if you amplify it with don't know what at max volume. I just assume that. I appreciate your interest.
DooMLoRD77 said:
You are right that mixer is using 48khz upsampling either through deep buffer or primary output or call it whatever. Deep buffer for music is by default. Where did you found that MQA policy?
I can't help you now as my V30's motherboard is dying and it will take some time to replace it, but I can tell you that modifying the mixer to give 32bit output gives nothing just mute sound and lagging youtube playback maybe because of buffer size or idk.
You can have 32bit with direct, of course. Anyway, what recordings are giving noise? Vinyl? 16 bit does not have limitations like that. I guess you hear the noise generated by AVC in the Quad DAC. It has a high SNR but not enough if you amplify it with don't know what at max volume. I just assume that. I appreciate your interest.
Click to expand...
Click to collapse
Recordings from Tidal app (except MQAa) and when UAPP is set into 16bit mode inside "HiRes driver audio format" give noise. When I change this option to "Auto" then noise is gone. To hear it I just set sound level to 1/70 (lowest possible) and amplify rest on my amp. I'm not sure it's due to digital volume control or something else, but noise is there and I'm still above my NAD C372 noise level (100dB). How to check output path? I can do it myself but haven't found how...
If music is using deep buffer then your solution is very elegant IHMO and should work. Is youtube also using deep_buffer? Is deep_buffer always used or only when phone is sleeping?
MQA policies are inside /vendor/audio_output_policy.conf: direct_pcm_16_mqa and direct_pcm_24_mqa. As I see /etc/audio_policy.conf is depreciated but looks like /vendor/etc/audio_output_policy.conf is used and there are two different audio_policy_configuration.xml files. Is there documentation for android audio available?
Eneen said:
*
Click to expand...
Click to collapse
I think direct does not support 16bit. It can be DVC or just the not really perfect mixer makes noise or what kind of interpolation error. You should have SDK platform tools to check it. Start inside an adb connection in cmd. Command: "adb shell" or "./adb shell" then "dumpsys media.audio_flinger" and it should read much thing about path and so on.
YouTube uses deep_buffer if it's available. It's used when music is played not only when sleeping. Primary is more like for notifications maybe some games. Sorry, what solution? LoL. 24bit modification?
I will check that policies again, thanks.

Categories

Resources