6 ms·
Bluetooth stack modifications to improve audio quality on headphones without AA (2019)
- ValdikSS 3y agoDo anyone know whether the new LE Audio standard include high quality duplex audio (headphones + microphone)? Or is it still mSBC 16 kHz?
- luca020400 3y agoNot entirely sure what configuration you're looking for, but the one supported in Android can be found here https://android.googlesource.com/platform/packages/modules/Bluetooth/+/refs/heads/main/system/bta/le_audio/audio_set_configurations.json https://android.googlesource.com/platform/packages/modules/B... https://android.googlesource.com/platform/packages/modules/Bluetooth/+/refs/heads/main/system/bta/le_audio/audio_set_scenarios.json https://android.googlesource.com/platform/packages/modules/B...
- solarkraft 3y agoI actually dug through a lot of the spec to find this out - damn you, Bluetooth SIG. I think the answer is yes.
- noodlesUK 3y agoThis is great: SBC is widely supported and this seems like a natural extension of the existing standard. The issue I personally have is not about SBC vs LDAC or AAC, but that HFP is garbage. The moment the mic gets switched on, I’m transported back to the 90s. If someone wants to make bidirectional Bluetooth audio that doesn’t suck, I’d be thrilled.
- baxuz 3y agoI really don't understand why HFP is still the industry standard. Even devices within the same ecosystem, like MacBook / iPhone / AirPods seems to use it based on the audio quality. Or maybe it's AVRCP. Sounds horrible either way.
- jeroenhd 3y agoThere are simply no common successors to HFP. There are a few handsets that use two A2DP streams, but that requires a lot of bandwidth and I don't think support is anywhere close to universal. Bluetooth 5.2 adds BLE Audio which offers more flexibility. The LC3 codec is supported by Windows 11, Android 13, and Linux, and it significantly improves audio quality compared to the older codecs. I'm not so sure about hardware support in headphones, though.
- deleted 3y ago[deleted]
- vlovich123 3y agoAVRCP is the control protocol for BT media (e.g. when you volume up or play/pause from your headset). I’m assuming you meant A2DP which is the protocol for receiving audio. HFP is totally separate from A2DP in that it’s a bidirectional audio stream. That bidirectionality is the difficult part - you have in theory tight time bounds for transmitting the data for latency reasons + these cheapo headsets have 1 radio which means they’re nominally limited to tx or rx. Since the assumption for the design is voice calls, you severely clip the microphone audio into the frequency band for speech & transmit mono which is why the audio quality is so bad (+ you further lossy encode it but the frequency reduction is probably the biggest dip). All of this has to fit on top of the PHY packet transport that time-divides access to the channel + has to coex with other 2.4 GHZ radios like WiFi (at least historically). Now, could these designs be revisited? Probably. Maybe radios are small and cheap enough that we should have 2 and a protocol for bidirectional audio that allows independent streams over separate bands with software synchronizing and mixing audio. It’s also possible the audio encoders/decoders could be modernized with more modern compression techniques to improve audio quality without requiring changes to the bandwidth allocation. Bluetooth those is very ossified and the standards bodies move like molasses - most of the investment is in WiFi and radio vendors are more interested in milking what exists now (or coming up with proprietary solutions like aptx) than actually solving the problems.
- jeroenhd 3y ago
- HPsquared 3y agoIsn't it just the need for low latency? "Media" (music, videos etc) has good sound quality but significant latency. It gets compensated by delaying the video by an equal amount, but it's too much latency for phone calls.
- eptcyka 3y agoIt's Bluetooth not having enough latency.
- eptcyka 3y agoI meant to say bandwidth.
- therein 3y ago> It gets compensated by delaying the video by an equal amount Is this actually done? Who would be doing it, the OS? It just sounds like the separation of concerns and the design of the interfaces would make it pretty unlikely.
- explodingcamera 3y agoIt is absolutely done, mostly by the media player/library used, e.g exoplayer on Android has automatic lag compensation for that purpose.
- magicalhippo 3y agoNot always. Just got some wireless headphones at work, and now I can no longer enjoy YouTube videos (mostly KEXP) because of the 100ms audio delay. It's too disturbing even only in side view. So at least with a browser on Windows it's not done.
- lxgr 3y agoI’ve definitely noticed it on macOS. Videos in the browser will stall for a fraction of a second after pressing play to give the audio time to catch up.
- 3y ago
- zwirbl 3y agoIt's slowly entering the market as LE Audio / Auracast. Might be a while till good os support is available though
- Namidairo 3y agoWhile Windows technically supports LE Audio and the profiles required, the encoding and such are left up to the vendor driver to implement.[0] I'm not even sure if Intel's newer products will actually properly do BAP etc. on Windows because of driver support, despite them listing very windows looking software version numbers in the certification on the Bluetooth SIG site. (AX210 and newer should be capable and advertise proper isochronous channel support in their drivers. AX200 and AX201 are not capable, and but kinda sorta advertise isochronous channel support anyway because of a bug I believe. BE200 obviously capable but they have a separate driver on Windows and I have no idea how stable it is in Linux.) [0] https://learn.microsoft.com/en-us/windows-hardware/drivers/bluetooth/bluetooth-low-energy-audio https://learn.microsoft.com/en-us/windows-hardware/drivers/b...
- MonaroVXR 3y agoI can vote for that as well.
- btreecat 3y agoI have used this in LineageOS and honestly loved the feature. The ability to send higher quality audio to stuff like my car stereo where I don't have any support for 3P codecs. Also headphones can really benefit from this. The UX needs some work, but the feature is fantastic.
- rokweom 3y agoIt's gone from newer versions of Lineage, unfortunately. Right now the whole thing is basically forgotten.
- _c3ag 3y agoi didn't know i was using SBC (Lineage 18-1 doesn't show that UI checkbox when connecting devices with SBC capability) until this post! _magic_ *-*
- gchokov 3y agoI wish something like this existed on MacOs :/
- emilfihlman 3y agoThis artificial limitation sounds very much like a purposeful limitation to gather licensing fees.
- jeroenhd 3y agoPerhaps interesting to note: on Linux, you can also enable higher bitrate SBC audio (though something dubbed "SBC XQ"). Similarly, "mSBC" can be used for higher quality headset audio (still nowhere close to SBC or more APTX, of course). I hope someone over at Google merges this, or something like this, already. Better audio codec are supported by tons of headphones and such, but support is not universal and bidirectional audio improvements definitely aren't.
- krzyk 3y agoDo you know how to enable that on Linux? Or how to check what my current headset is using? I remember I had previously a patched pulseaudio that exposed appropriate settings, but later it got "merged into mainstream" - and I couldn't find the settings or information what is being used.
- abdullahkhalids 3y ago> Or how to check what my current headset is using? `pactl list` should show you all your input and output sinks and what profiles they are using. Even though, I think the pulseaudio Volume Control app also shows this graphically. Something like `pactl set-card-profile bluez_card.98_52_3D_7E_5D_DE a2dp-sink-sbc_xq` sets the profile to sbc xq. This is a bit old and I am not sure if newer versions of pipewire have better ways of doing it.
- viraptor 3y agoNot sure about Gnome, but in KDE you can select the codec from a drop-down in volume panel for a while now. I got high quality headset audio with low delay for at least 2 releases of Fedora.
- jeroenhd 3y agoI use Wireplumber+Pipewire on Ubuntu and Manjaro. I stuffed the following into /etc/wireplumber/bluetooth.lua.d/bluez_monitor.properties : bluez_monitor.properties = { ["bluez5.enable-msbc"] = true, ["bluez5.enable-sbc-xq"] = true, ["bluez5.enable-hw-volume"] = true, ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]", ["bluez5.codecs"] = "[ sbc sbc_xq aac ldac aptx aptx_hd aptx_II aptx_II_duplex faststream faststream_duplex ]", } Then from the GNOME audio settings I can pick the appropriate codec from the dropdown. I have a pair of Oneplus buds (the older ones, with a wire in between them) so I don't get any of the newer codecs, but SBC-XQ works well for reducing latency in a pinch. Pulseaudio also has support, but I don't know how to make that work. My last attempt led me to switch to Pipewire.
- velox 3y ago"Alternative A2DP Driver" offers this functionality on Windows. Lets you customize SBC parameters, use AAC, aptX (apparently, haven't tried). Works well in my experience, lets me use LDAC with my sony XM4's. It's trialware, but cheap. I have seen the bluetooth range drop off in higher quality modes, which seems to confirm it's actually changing the codec (or at least something) and not just a placebo. https://www.bluetoothgoodies.com/a2dp/ https://www.bluetoothgoodies.com/a2dp/ (i have no affiliation)
- Dwedit 3y agoWhat is this "Quality Loss" they speak of regarding downsampling from 48KHz to 44.1KHz? When resampling is done properly, you'd only lose very high frequency content (frequencies above 22050Hz). Human hearing range is usually documented as up to 20KHz, but some young people can slightly hear higher frequencies.
- Moldoteck 3y agoWasn't expecting a harb link getting to the front of hn. Congrats to the author
- capableweb 3y agoPretty common for habr.com :) https://news.ycombinator.com/from?site=habr.com https://news.ycombinator.com/from?site=habr.com
- londons_explore 3y agoIs it possible to measure the signal strength and auto-fallback to lower bitrates as the device starts to go near the edge of range? Random audio glitches are even more annoying than poor frequency response and robotic-sounding music to me...
- londons_explore 3y agoPlease can someone invent a bluetooth audio profile which allows buffering a long time in advance? Ie. if I'm playing a 1 minute song, the whole song should get buffered up. Obviously, if I click 'pause' or change the volume, the buffer should be discarded. But the long buffer should let my phone sleep more of the time (saving power), and survive poor radio connectivity.
- solraph 3y agoUnlikely to happen. I sincerely doubt most headphones would have the memory for that buffer. Sure, it's only a megabyte or two of ram, but your headphones would have to spend valuable battery on keeping that ram active. From my foray into audio app (quite a while ago, I admit), I imagine application support would be tricky as well.
- vlovich123 3y agoYeah, memory on these devices tends to be pretty tight. The other challenge with buffering ahead so much is that if you do skip, you’ve basically used your energy budget for 0 value. You’d have to make the argument that there’s net savings, but that would only materialize with predictions that are right enough that the savings outweigh the times you lose (e.g. a simplest heuristic would be if the audio stream has been live for 5 seconds without skipping, send the available buffer at faster than realtime).
- spockz 3y agoIIRC, Spotify applies a similar strategy also for deciding which music to already fetch from the servers when listening to a playlist to minimise the gap between pressing next song and actual playback. It seems like it should be exactly the same algorithm for sending it to the headset, with the exception of other sounds like notifications/calls.
- londons_explore 3y agoWell they can advertise how much memory they have... RAM uses less power than keeping a radio alive, so I suspect aggressive buffering is a net energy saver.
- JeremyNT 3y ago(2019)
- jwtorres 3y agoThis article is not about Bluetooth in general, it is a deep dive into the bugs buried within the Android Bluetooth stack. And what the writer is not acknowledging at all is that the underlying hardware being used is highly variable. Android runs on top of numerous Bluetooth chipsets. So when he gets a patch to seem to work on his hardware, there is no saying that it will work for a different Android phone. Furthermore, this all depends on what else the device is up to at the current moment. If you have shared BT+Wifi chipset and you are streaming a video over wifi, then streaming the audio to your headphones, the device is having to allocate resources based on wifi usage and BT. So playing audio stored locally and audio via a stream is not necessarily going to get the same CODEC parameters. There is so much nuance to this subject that the author just hasn't considered. Please be careful what you read.
- MonaroVXR 3y agoDidn't think about this, do you have more information about this?
- jwtorres 3y agoNot really. Just experience
- xchip 3y agoDo you have any links?
- jwtorres 3y agoNope
- AnggaSP 3y agoFormer custom ROM developer here who has reviewed and integrated valdikSS modification. It’s not a bug that the patchset is doing, but enables dual-channel SBC to be negotiated in the source and sink connection. This enables the higher bit-rate without exceeding the maximum bitpool both Android and BT receiver impose. There’s still negotiation occurs between the source and sink and if either one of them doesn’t support dual-channel SBc, it’ll fallback to whatever its supported. All the device that i had maintained supports it, while some cheap speaker that i test at that time doesn’t and able to negotiate joint stereo session.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- lawrenceyan 3y agoThis is exactly my vibe. Super cool, props to the author for improving things purely through software.
- viraptor 3y agoJumping on with a related question: Does anyone know of any way to improve the HFP on MacOS with Bluetooth? The same headset I'm using on Linux with mSBC and pretty good quality - on MacOS it completely sucks and switches to phone line / mono quality. Is there already any hack for Darwin to make it behave properly?
- freedomben 3y agoThis is about Android's Bluetooth stack. Is the Android Bluetooth stack usable on Linux in general? It seems to work a whole lot better and with more devices, so would be great if it was usable.
- xchip 3y agoWhat a week written article
- seba_dos1 3y agoWould be good to add (2019) to the title. It makes statements about "all current Bluetooth stacks", while these things have been implemented in at least PulseAudio and PipeWire for a while now.
- pavon 3y agoI'm a little skeptical that Dual Channel at 551 kbps results in noticeably better quality than Joint Stereo at 328 kbps as opposed to just using more bits encoding redundant information. At least for most music - eg stuff that isn't intentionally playing around with different recorded tracks on left and right.
- ValdikSS 3y agohttps://btcodecs.valdikss.org.ru/sbc-encoder/ https://btcodecs.valdikss.org.ru/sbc-encoder/
- rjmunro 3y agoI can't hear any difference. I think the sample music provided might not be the best - it's too electronic and processed already, my brain doesn't know what it's supposed to sound like.
- deleted 3y ago[deleted]
- MaryGab 3y ago[flagged]
- codewiz 3y ago> I tried to contact many Bluetooth stack developers from Google, asking them to consider including my patches to the main Android branch—AOSP, but did not receive a single answer. Very sad. Android is open source code with an closed development model. Most communication and design work happens behind closed doors, cutting off anyone who doesn't work at Google.