nicokaiser / rpi-audio-receiver

Raspberry Pi Audio Receiver with Bluetooth A2DP, AirPlay 2, and Spotify Connect
MIT License
1.36k stars 150 forks source link

HD audio codec instead of lossy SBC #141

Open saddy001 opened 1 year ago

saddy001 commented 1 year ago

It would be nice if an HD audio codec would be used instead of the lossy SBC. If the source material is lossy too (mp3) the overall quality doesn't improve ;-) I have tested AAC myself and it works, although I have tested with alsa, not pulseaudio. Even better would be aptX HD.

Resources: https://codeberg.org/epinez/raspi-bt-hd-audio-receiver https://forums.raspberrypi.com/viewtopic.php?t=283158

rriemann commented 3 months ago

Back in December 2020, I changed the rpi-audio-receiver to cover aptX. I do not have the device in my home, but these are my notes from back then:

To check Hardware support for Codecs:

Back then, I did not know yet about SBC-XQ:

Looking at Df medians we can safely conclude that audio quality of SBC XQ is comparable to aptX HD. And for BT EDR3 devices SBC XQ slightly surpasses aptX HD. It will be impossible to tell them apart in a blind listening test. SBC codec uses primitive psychoacoustic model for encoding and aptX does not use it at all, so their perceived audio quality is determined mostly by bitrate. Different settings of SBC, including SBC XQ, can be compared to aptX and aptX HD aurally with the help of Bluetooth A2DP SBC/aptX online encoder [5].

All current BT stereo devices could use this higher quality encoding. It just suffices to modify BT stack of sending device. Receiving BT devices that support only mandatory SBC codec will benefit most from this trick.

At the moment the required patch is included into LineageOS, Resurrection Remix and crDroid forks of Android. The patch for Linux PulseAudio from Pali Rohár besides SBC XQ also adds support for aptX, aptX HD and FastStream codecs [6]. This extra quality is for free. It's hard to imagine any objection to including this option into all BT stacks and the main Android branch.

I invite you to read the entire article at: http://soundexpert.org/articles/-/blogs/audio-quality-of-sbc-xq-bluetooth-audio-codec

Does blueALSA has support for SBC-XQ? There is a related issue in their Github https://github.com/Arkq/bluez-alsa/discussions/548 which suggests that it is just a matter of proper configuration.

In any way, I suggest to mention the currently supported audio codecs in the README.md and if need be, add documentation of how more audio codecs can be enabled. I will do some tests myself in the next days and report back.