So, I started dabbling with the SBC quality option.
[Aside: is there a better way to determine the quality actually negotiated in a connection? What I'm doing works but seems nerdy. bluealsa-cli and bluealsa-aplay are useful but AFAICT don't drill down to this level of detail.]
Test host: 64-bit moOde 8.3.3 on RPI3B+
Test speakers: JBL Flip2 BT speaker (includes SBC codec only), Sennheiser HD4.50BTNC headphones (includes SBC, aptX codecs)
First, stock moOde (e.g., high quality SBC) with the JBL paired, connected, selected as output device, and while playing a track
Code:
pi@moode:~ $ sudo service bluealsa status
...blah blah blah...
Jul 06 10:07:57 moode bluealsa[1462]: bluealsa: [5148] D: codec-sbc.c:262: SBC setup: 48000 Hz JointStereo allocation=SNR blocks=16 sub-bands=8 bit-pool=51 => 345000 bps
...blah blah blah...
So, we have 48kHz sampling frequency and the 345kpbs stereo bitrate stated in the bluealsa docs for high quality SBC.
Second, add the --sbc-quality=xq option to the service file, reboot, reconnect, etc.
Code:
pi@moode:~ $ sudo service bluealsa status
...blah blah blah...
Jul 06 09:45:31 moode bluealsa[1454]: bluealsa: [238436] D: codec-sbc.c:262: SBC setup: 44100 Hz DualChannel allocation=SNR blocks=16 sub-bands=8 bit-pool=38 => 452
025 bps
---blah blah blah...
Yup, the sampling frequency has been forced to 44.1kHz and the bitrate has increased to 452kbps. Can I hear the difference? Ha ha ha, not with this speaker and my ears, but playback certainly isn't worse, and seems stable.
Third, rinse and repeat with --sbc-quality=xq+. The relevant line from the service status request is now
Code:
Jul 06 09:55:53 moode bluealsa[1456]: bluealsa: [3501] D: codec-sbc.c:262: SBC setup: 44100 Hz DualChannel allocation=SNR blocks=16 sub-bands=8 bit-pool=47 => 551250 bps
So, sampling frequency is again 44.1kHz while the bitrate increases to the documented 551kbps. Tracks are playing through the speaker fine.
What about the headphones and their aptX codec?
In all three cases---none, xq, xq+---I see the same two lines (not necessarily in the same order) in the service status concerning the aptX codec:
Code:
Jul 06 10:10:38 moode bluealsa[1462]: bluealsa: [1462] D: ba-transport.c:1949: Created new IO thread [ba-a2dp-aptx]: A2DP Source (aptX)
Jul 06 10:10:38 moode bluealsa[1462]: bluealsa: [6911] D: a2dp-aptx.c:135: IO loop: START: a2dp_aptx_enc_thread: A2DP Source (aptX)
This is what I would expect since we're now not using the SBC codec. However, the sampling frequency does change---which seems to contradict a statement made by @
jenzd . For stock moOde, the negotiated sampling frequency is 48kHz. OTOH, with either --sbc-quality=xq or --sbc-quality=xq+ option set
Code:
pi@moode:~ $ bluealsa-aplay -L
bluealsa:DEV=00:16:94:29:7F:10,PROFILE=a2dp,SRV=org.bluealsa
HD 4.50BTNC, trusted audio-card, playback
A2DP (aptX): S16_LE 2 channels 44100 Hz
I can't hear the difference. In all cases, playback through the Sennheisers sounds good and is stable.
Note that AFAIK the A2DP spec writers choose 44.1kHz and 48kHz simply because those two frequencies were commonly used in CD and TV audio production and not because they had any thoughts that 48kHz would result in better quality sound. As a practical matter, the resampling which takes place seems to have minimal if any audible effect if done competently (obviously opinions on this differ and I'm just as opinionated as the next person, if not more so).
Regards,
Kent