nicokaiser/rpi-audio-receiver

HD audio codec instead of lossy SBC

saddy001 opened this issue · 1 comments

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

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:

  • export PKG_CONFIG_PATH=/home/pi/ffmpeg_build/lib/pkgconfig

  • sudo apt install libdbus-1-dev glib-2-dev libbluetooth-dev libasound2-dev autoconf libtool libsbc-dev libmp3lame-dev libavcodec-dev libsndfile-dev

  • ../configure --enable-aac --enable-msbc

  • https://github.com/Arkq/openaptx for aptx support

  • ../configure --enable-aac --enable-msbc --prefix=/usr/local --program-suffix=-debug --enable-mp3lame --enable-debug --enable-aptx --enable-aptx-hd

To check Hardware support for Codecs:

  • pactl list to get MAC
  • deconnect the device
  • avinfo 20:74:CF:36:C4:83 with own MAC

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 arkq/bluez-alsa#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.