Bluetooth LE Audio - STM32WBA LC3 Codec

Revision as of 10:04, 26 July 2023 by Registered User (→‎STM32WBA LC3 Codec)
Under construction.png Coming soon

1. STM32WBA LC3 Codec

The LC3 codec is an algorithm allowing to compress audio data for transmitting over the air.

This codec must be supported by any application build over the Generic Audio Framework and BLE 5.2 isochronous feature. It runs channel independently, has a complexity similar to Opus, and can be used for either voice and music with a better quality.

1.1. LC3 configuration

BLE profile configures the LC3 session defined by:

  • The sampling frequency : 8, 16, 24, 32 ,44.1 or 48 kHz
  • The frame duration : 7.5 or 10ms

The frame duration varies a little with 44.1 kHz, refers to LC3 specification for details

Then it also configures each channels referring to the session with additional information:

  • The mode : encoding or decoding
  • The PCM sample width : 16, 24 or 32 bits
  • The bitrate within a list of recommended bitrates

The LC3 supports bitrate updates, but BLE profiles don't use this feature

Also, the ST LC3 codec embed a Packet Loss Concealment algorithm based on the annex B of the LC3 specification. This algorithm ensure signal continuity and reduced glitches in cases of corrupted/missing packet and is triggered by either an external indicator BFI or an internal frame analysis.

Picture data flow

At the encoder side, the data flow if the following

  • Data Input
    • PCM signal buffered into an Nf samples per channel, this size is linked to the frame duration and frequency.
    • For example, 10ms frame at 32kHz leads to 320 samples
  • Data Output
    • An encoded buffer per frame per channel of size Nbytes, this size is directly linked to the bitrate and is withing the range of [20 : 400] bytes.
    • In our example, 64kbps leads to 80 bytes, so compression factor of 8 for 16bits/sample