Audio

Bluetooth, Unleashed: Classic, BLE and LE Audio in the Browser

The Web has evolved into a powerful platform for hardware interaction, yet Classic Bluetooth and LE Audio support have long remained one of the last frontiers trapped in native code. Breaking that barrier would open the door to a new class of connected Web experiences – connecting your Bluetooth headphones, sensors, and controllers directly through the browser, with no drivers, or system dependencies could enable innovation that isn’t gated by operating systems but fueled by open standards and creativity.

Turning Limitations into Opportunities: Receiving High-Fidelity Music over Bluetooth and USB

In our previous post about BTstack on the Ezurio Vela IF820 development kit, we explored how to fully port the stack to this platform. As an added bonus, we repurposed the onboard RP2040 MCU to run the stack and to eliminate the need for extra hardware. In the end, a standard Bluetooth Controller breakout board was transformed into a compact, standalone BTstack development platform connected via USB. While this is quite nice, the Vela IF820 development board does not include an onboard audio codec or DAC, which means there’s no straightforward way to play back music. Instead of seeing that as a limitation for our project, we turned the lack of a audio playback component into an opportunity to learn something new.

LE Audio on ESP32

In our previous post, we explored how accurate playback for True Wireless Stereo (TWS) can be achieved on an STM32F4 Discovery development kit with both Infineon CYW5551x (LC3 on-board) as well as a Nordic Semiconductor nRF54L15 (LC3 codec on the STM32) Controllers. While these work well, the setup isn’t suitable to carry around and demonstrate – especially for a demo with multiple devices, e.g. one sender and two or more receivers.

True Wireless Stereo with LE Audio

As LE Audio is getting added to most new in-ears headphones and is support in newer flagship Android phones, we’d like to highlight an important feature of the technology: True-Wireless Stereo (TWS) playback without the Link Layer shenanigans of current Bluetooth Classic In-Ear headphones.

True Wireless Stereo (TWS) Playback on Bluetooth Classic A2DP

Up until now, Bluetooth did not provide the necessary synchronization primitives to playback audio accurately by two individual devices. To build In-Ear headphones nevertheless, there have been a range of different TWS approaches. Qualcomm provides a nice overview in their The Evolution of True Wireless Technology whitepaper on these. The following provides just a crude summary.

AVRCP Cover Art in iOS / Android

In 2019, just as we finished implementing the AVRCP profile, which is used to control audio playback, e.g. pause & volume control on Bluetooth speakers, the Cover Art feature was added to the AVRCP 1.6 specification. At the time, modern car infotainment systems already showed nice song covers with both iOS and Android. As Cover Art seemed to be in use, we decided to implement it as well.

After setting up the minimal logic to support it, we tested the code with an Android device, but it turned out that the Cover Art feature wasn’t supported there. Puzzled, we also tried the current iOS version on an iPhone, but it wasn’t supported there either. Still curious, we inspected the features provided by Apple’s MFi program and indeed, the iAP2 profile was providing “Now Playing”, which provides information about the current played track including cover art.

A2DP Sink and Source on STM32 F4 Discovery Board

After a small detour handling Cross-Platform Console Input, we’re back and got audio streaming via A2DP to work in both directions on the STM32 F4 Discovery board.

Given the hardware options on the board, we’d like to play stereo music via the built-in Cirrus 43L22 Audio Codec and stream some music to a headset / loudspeaker, ignoring the microphone on the Discovery board.

Audio Playback with the Cirrus 43L22 Audio Codec

As the audio codec was already on the dev kit, we expected playing a simple sound like a sine wave to be a straightforward task, using Makefiles and the GNU ARM Embedded Toolchain.