How do codecs work and why are they needed?

This leads us to the question, why do we need codecs at all? Due to the principles of the Bluetooth protocol, headphones cannot physically use the entire width of its bandwidth. Plus, other wireless gadgets like a fitness tracker can be connected to the smartphone, which also need time to transfer data. Therefore, even Bluetooth of the fifth version, which has a maximum bandwidth of 6.25 Mb/s, in fact hardly transmits an audio stream of 990 kbit/s.


The main list of Bluetooth codecs is quite large (Samsung and Huawei have their own solutions), so to simplify the material, we will go through only the most basic ones:

  • SBC is a standard Bluetooth codec that is supported by all devices
  • aptX are the most common codecs from Qulacomm, which are often found in Android smartphones
  • aptX HD is an updated version of aptX, which tightly clogs the Bluetooth channel, and with reservations is able to transmit audio in CD quality
  • AAC — to simplify it, it is an alternative to aptX, which is mainly used in Apple technology
  • LDAC is a new Hi—Res codec from Sony capable of transmitting audio with a bitrate of 990 kbit/s

The main indicator of codec quality is usually the bitrate, that is, the quality of the transmitted audio signal. The problem is that a high bitrate does not directly guarantee that codec A will be better than codec B. Rather, it looks like megapixels in smartphones, which marketers love to operate with. Therefore, next we will analyze how the top five popular codecs behave in reality and what parameters of the codec are important in addition to bitrate. But first we need a small educational programme on how audio compression works in general and what its bitrate means.

How Audio Compression works


Bitrate — the rate of transmission or processing of digital data over the channel. In audio, this usually means kilobits per second. The higher the bitrate of a track, the more space it will take up on your computer. Usually, audio CDs take up quite a lot of space, so it has become common practice to compress these files. For example, when converting MP3 files from WAV, the edges of the sound spectrum are cut off, which we perceive poorly and which are difficult for audio equipment to reproduce. Usually, this is the deepest bass in the region of 20 Hz and the very top of 20,000 Hz. And the stronger the compression ratio/lower the bitrate, the more these edges are clipped. If an MP3 with a bitrate of 320 kbit/s is often difficult to distinguish from the original, then a badly cut file with a bitrate of 128 kbit/s can sound as lousy as a song recorded from the radio on an old cassette.

And now, from the virtual physics classroom, let's fast forward to the Atlantic virtual studio and see how the modern recording industry works. Now almost all music is written with the expectation of streaming, spoiling speakers and airpods. The market dictates the rules, so in modern pop music it is important to have the density and maximum volume of sound so that it "rocks" from any trough. Therefore, few people will want to go to a desert island to record the conditional "Dark Side Of The Moon" now. This is both economically unprofitable and makes little sense: numerous details, references and subtle effects will simply drown in the rhythmic porridge that cheap portable speakers and headphones reproduce.

We will not open America by saying that there is a sense in high bitrate only if you listen to something tricky. For example, complex orchestrations, ornate jazz passages or rock rich in details. At the same time, you should have high-quality headphones that can reproduce the nuances of the composition, and a good player with a high-quality DAC that converts all this correctly. That's why audiophile technology is so expensive.

Detailed introduction to codecs


SBC

SBC is a standard bluetooth codec with a primitive psychoacoustic model and adaptive pulse-code modulation. On the one hand, it is a very flexible codec that allows you to adjust the optimal ratio between the sound quality and the amount of delay of the transmitted signal. It shows excellent audio quality at high bitrates (450 kbit/s and above) and outputs 328 kbit/s with a limit of 19 kHz in "high quality" mode. This is enough for most listeners who do not consider themselves audiophiles. Then why do people complain about SBC so often?

It supports dynamic change of the Bitpool parameter, which directly affects the bitrate. Initially, it was created for speech transmission, so its flexible nature made it possible not to interrupt communication if the distance between devices increased or the ether was clogged. Now manufacturers of wireless headphones usually set the Bitpool limit at 53 in order to get a bitrate of 328 kbit/s at the output. However, due to the established internal limitation of Bluetooth stacks and the lack of fixed profiles, developers can play with the Bitpool parameter as they like. And do not indicate this in any way in the characteristics of the device. As a result, some high-quality headphones with SBC play perfectly, others sound flat, muddy and at the same time noticeably noisy. As shown by the test of a wonderful amplifier FiiO BTR1K with headphones JBL Everest Elite 750NC , the sound quality between SBC, AAC and aptX is barely distinguishable if they are in equal conditions.

aptX and aptX HD


Invented in 1988, the codec, the main charm of which is simplicity. In fact, we only have a sampling rate parameter (16, 32, 44.1, 48 kHz), which directly affects the bitrate value. Unlike SBC, aptX will not "trim" the frequencies, but will add quantization noise to them, reducing the dynamic range of audio. When creating the codec, the authors calculated ADPCM coefficients on a set of musical audio files, so in reality (i.e. when listening to music) it shows itself better than in synthetic tests.


Despite the huge prevalence of aptX, it was by no means perfect, so a few years ago the main manufacturer of mobile processors Qualcomm presented an improved version of the codec, aptX HD. The main changes affected the number of bits needed to encode frequency ranges, the bit depth increased to 24 bits, and the maximum bitrate is limited to 576 kbit/s. Its development was stimulated by the growing popularity of mobile Hi-Res audio. In general, this is the most optimal Bluetooth codec that allows you to transmit sound in a quality close to CD. However, it is not as widespread as its younger brother yet, due to the need for additional licensing from Qualcomm.


In addition, aptX has several variations. Low Latency is an aptX version with a minimum buffer delay of 30 – 40ms, which is almost invisible. A useful thing if you often use a headset. And the brand new aptX Adaptive essentially combines the current aptX HD and aptX Low Latency codecs, trying to find the optimal balance between the amount of delay and audio quality.

AAC

From a technical point of view, AAC is a rather complex codec with a serious psychoacoustic model. Usually, it transmits sound with a maximum bitrate of 320 kbit/s, less often 256 kbit/s. In both cases, excellent quality is provided. At a lower bitrate, it gives a quality similar to aptX. But there is one caveat.


AAC is usually used in Apple technology (although it does not belong to it), but it can often be found in Android smartphones. But if Apple uses the same high-end Apple AAC encoder, then there can be anything on Android: from the Fraunhofer FDK AAC encoder to hardware SoC solutions with unknown encoding parameters. The output is a situation like SBC — the letters on the box are the same, but the sound is noticeably different.

LDAC


A widely-advertised super-codec from Sony, capable of doing the hitherto impossible — transmitting loseless audio via Bluetooth. Supports 96 kHz discrediting frequency, 24-bit bit rate and adaptive bitrate up to 990 kbit/s. It would seem that at this place you can smoke and relax and look into the distance. Humanity has solved another important problem, wireless headphones with LDAC now play as audiophile wired models. But not everything is so smooth. Sony does not disclose details about the software decoder and codec specifications, which complicates the analysis. Specialists from SoundGuys.com We have unearthed that the structure of LDAC strongly resembles the codec from PS4 with MDCT and Huffman compression algorithm.

Due to the adaptive structure and floating bitrate, LDAC works in three different modes: ideally, it is loseless-quality with a bitrate of 990 kbit/s, if there are problems with the connection, it resets the bitrate lower. In this case, the quality does not go far from the usual aptX HD. For example, the noise level at 15 kHz in the 660 kbit/s mode is too high even for a 16-bit signal, which is to say 24 bits. And in the priority connection mode, LDAC shows an even higher noise level than the standard SBC. Moreover, in the "high quality" mode, LDACS begin to lose packets at the level of -60 dB (versus -70 dBm for aptX HD), which indicates not the highest stability.


Therefore, LDAC does not particularly like to work at the maximum of its capabilities, resetting to simpler modes so that you do not get nervous due to delays and loss of communication. All this suggests an analogy with a sports car, which is forced to drive at a speed of 50 km/h because the road is broken.

What else affects the sound quality?


If you have a couple of minutes of free time, then follow the link https://btcodecs .valdikss.org.ru/sbc-encoder / to the service to compare the quality of codecs and try to download a well-known song. Then you can switch between several profiles and make sure that there is not much difference in quality between SBC, aptX and aptX HD. And SBC really starts to crack if you lower the Bitpool value to 37 and below.

So what's the trick? And why are people ready to break spears on any forum, proving that LDAC is much cooler than aptX? It's about the hardware, namely the digital signal processor (DSP). Manufacturers of Bluetooth equipment can configure the DSP for each codec separately, changing the settings of the equalizer, compander, compression and stereo. Because of this, when switching between codecs, the listener will think that he hears the differences between them, although in fact these are DSP differences.

Conclusion


What conclusion can be drawn from all this? The level of technology and quality of wireless headphones has dramatically increased over the past year and a half. If earlier audiophiles bypassed such equipment, and true wireless headphones were bought mainly in the gym, now we see how an increasing number of well-known manufacturers are producing Rolls-Royce wireless headphones. For example Beyerdynamic Amiron Wireless Price from 26 910 up to 45 115 ₴ from Beyerdynamic, which cost a lot of money and are designed for serious studio work. And that's great news.

The bad news is that fate cannot be deceived and you will have to pay well for the top quality of wireless audio. Therefore, you should not chase codecs in the hope that an inexpensive smartphone and headphones with LDAC will play like audiophile equipment. And in no case do not buy absolutely penny equipment with questionable Bluetooth certification and incomprehensible codec integration. She'll be nothing but trouble.

If we return to the codecs considered, the following conclusion suggests itself.

  • If you just need music in the background while riding a bike or cooking lunch, a regular SBC is enough. If you are lucky with the quality of headphones and a smartphone, you will get a sound at the level of AAC and aptX.
  • AAC, aptX and aptX HD look like the optimal choice in terms of quality, stability and variability of equipment with their support. Both have fixed bitrates and encoding coefficients, so you always know exactly what quality you will get. It makes sense to use AAC only on Apple devices, and limit yourself to aptX on Android.
  • And LDAC is designed for demanding listeners with well-trained hearing and a tight wallet.