[pulseaudio-discuss] Bluetooth A2DP aptX codec quality

ValdikSS iam at valdikss.org.ru
Fri Sep 14 12:28:55 UTC 2018

On 12/09/2018 13:42, Pali Rohár wrote:
> Hello!
> I would like to let you know that Serge from soundexpert.org did in last
> month some research on aptX and its quality. Detailed article is on the
> following website, specially see parts added around "August 2018":
> http://soundexpert.org/news/-/blogs/audio-quality-of-bluetooth-aptx
> ============
> Conclusions:
> aptX codec used in BT applications is no better than SBC at 328. Despite
> slightly lower algorithmic delay of aptX both SBC and aptX codecs
> provide the same 100-150ms latency in real-life BT applications.
> If you hear the difference between SBC and aptX in some BT product,
> there can be only two explanations - placebo effect or using SBC in
> Middle or Low Quality modes.

This is not exactly true. I believe Sergey's tests are not suited well for ADPCM codecs, since almost all modern phycho acoustic lossy codecs are trying to hide unhearable details while ADPCM works differently.
So I'm not sure if ADPCM (aptX) and SBC codecs should be compared with the waveforms, as SBC will introduce less distortion in most cases but aptX may be better for the ears, especially for the people who complain for the lack of high frequencies using SBC. For me, it's almost the same, but 2 of my friends differs aptX from SBC (Joint Stereo, 328 kbit/s) 100% of the time on certain due to lack of high frequencies. I personally can't hear more than 16.5 kHz, so I pitch-shift encoded audio down to hearable frequency to hear what my friends can hear.
SBC can provide better results than aptX. On average, compared to SBC 328k, aptX makes less distortion in music with a wide frequency range, but on music with a narrow frequency range and a wide dynamic range SBC 328k sometimes wins.

Here's Sergey's reply:

> Yes, in general case assessment of sound quality by comparing waveforms is a bad practice. In my research I contend that this could be done only in some special cases. When sound signatures (which are, in fact, artifact signatures) are close. Analysis of the codecs similarity showed that in this case sound quality can be judged by the level of the initial waveform distortion (provided that sufficient amount of music material is used). The criteria of similarity was taken from my earlier research which is still in progress. I don't know, whether there is some fundamental flaw in my approach or it is just a natural accuracy of the method (1.5dB is relatively small value of difference). Anyway, that are the results as they are, you may consider them with a grain of salt.

Here are my simple tests:
While they are also not great, I thought it's sane to compare encoding results with spectrograms of ADPCM/APCM codecs.
I tried to use EAQUAL software to compare SBC and aptX. Some results are very relevant (Noise-To-Mask-Ratio, Relative Disturbed Frames, various differences) but some are controversial (Objective Difference Grade).

Please also read other information in this link. I made a patch for Android LineageOS for Dual Channel support, and thinking on adding this functionality to Pulseaudio.

> AptX is just a copper-less overpriced audio cable.

aptX and aptX HD have a strictly defined profiles which could not be changed without encoder and decoder modifications. Neither headphone manufacturer nor Bluetooth stack manufacturer can change them. This is a strong side of the codec, you always know what audio quality you will get with them, no buts.
With SBC you don't know what audio quality you will get before trying. SBC can produce very low quality audio to very high quality audio (on par or better than aptX HD), but you'll almost never get very high quality audio without disabling or circumventing artificial limitations.

> aptX HD is high-bitrate version of aptX. It has clearly noticeable
> increase in sound quality (not dramatic though taking into account the
> increase in bitrate)
> ============
> And it just confirms my own testing. Whatever I did I was not able to
> either hear or see difference between aptX and SBC encoded-->decoded
> audio.
> I had discussion with Serge and there are some ideas which Linux
> Bluetooth A2DP software could supports:
> 1) Allow user to specify SBC codec quality. In most cases, including
> pulseaudio, SBC quality is chosen either to middle or low, not to
> maximum bitpool. In some cases SBC at high quality can provide better
> quality as aptX and more important -- SBC is supported by all headsets.
> 2) Show user current SBC codec quality. So user would know what was
> chosen and what should expect. I was told that Windows's Toshiba
> bluetooth stack has support for this indication.
> 3) In some cases SBC SNR bit allocation method can provide better
> quality as SBC loudness method.

I don't know why SNR method shows better results in Sergey's tests, but it's just not true in the real life.
Loudness is a "simple psycho acoustic model", while SNR mode is "no phycho acoustic model". SNR just uses maximum subband sample as a scalefactor, which then assigned for the "needed bits" variable of that subband.
Loudness uses coefficients for different subbands, so most hearable subbands get more bits and less hearable less bits, that's what they call "simple phycho acoustic".

Try to make test encodes for SNR and Loudness with medium bitrate, you'll hear cracklings on mid and high frequencies, and less audio quality in high frequencies. Loudness would be much better in this case.

> So then I could ask question:
> 1) What to do with aptX? It is really useful for users to have it in
> Linux & pulseaudio? Because it looks like that the only thing which it
> has better is lower latency. But can pulseaudio on Linux system really
> achieve it?

aptX is still useful. Some (at least my) headphones have additional signal processing for SBC, while nothing for aptX. For some reason, the headphones enable some kind of compressor + limiter for SBC, and audio is very compressed unless you decrease audio volume down to 2/3.
aptX sounds fine will full volume. And don't forget that aptX has strictly defined profiles.

> 2) Should we rather look at increasing quality of SBC codec in
> pulseaudio? And if yes, how should be quality of SBC configured? Via
> profiles? Or to invent some new protocol options? Can we increase
> default SBC bitpool allocation?
> 3) If aptX is decided as useless, what about aptX HD codec? aptX HD
> codec is supported by less products (currently I do not own any), but
> this one may provide better quality as SBC according to that research.
> PS: That aptX research is the first and the only one about which I know.
> All other information about quality or other details which I found on
> internet are just marking informations.> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180914/8f3e07ba/attachment.sig>

More information about the pulseaudio-discuss mailing list