Skip to content

Repository files navigation

A2DP Windows Bridge (A2DPWB)

Bluetooth A2DP audio streaming for Windows with experimental LHDC V5 + Low Latency support. Streams system audio through a WinUSB-controlled Bluetooth adapter without a custom kernel driver or test signing.

This is an experimental LHDC V5 / MediaTek MT7922 (AMD RZ616) development fork of A2DP Windows Bridge. It is not an official Savitech, HWA, Microsoft, MediaTek, or BlueKitchen product.

Supported Codecs

Codec Bitrate Sample Rate Bit Depth Latency
LHDC V5 64/160/192/256/320/400/500/900/1000 kbps 44.1/48/96 kHz 16/24 bit 5 ms frames; LL transport mode
LDAC 330/660/990 kbps 44.1–96 kHz 16/24/32 bit ~200 ms
aptX HD 576 kbps 44.1/48 kHz 24 bit ~150 ms
aptX Low Latency 352 kbps 44.1/48 kHz 16 bit ~32 ms
AAC 128/192/256 kbps 44.1/48 kHz 16 bit ~150 ms
SBC up to ~345 kbps 44.1/48 kHz 16 bit ~150 ms

Architecture

+-----------------------------------------------+
|  A2DPWB.exe                                   |
|                                               |
|  +- GUI (wxWidgets) ------+  +- CLI ---------+|
|  | Device / adapter select |  | --cli mode    ||
|  | Codec / quality config  |  | Same core     ||
|  | Profile management      |  |               ||
|  | Status display          |  |               ||
|  +-------------------------+  +---------------+|
|                                               |
|  +- Core -------------------------------------+|
|  | WASAPI Capture (Loopback / Virtual Device) ||
|  | Encoder (LHDC V5 / LDAC / aptX HD / aptX LL / AAC / SBC) |
|  | A2DP Service (connection lifecycle)        ||
|  | BTstack (HCI / L2CAP / AVDTP / A2DP)      ||
|  +--------------------------------------------+|
|                 WinUSB API                     |
+-----------------------+-----------------------+
                USB Bluetooth Adapter

Components

Directory Description
app/src/ Application: GUI (wxWidgets) + CLI, audio capture, encoding, Bluetooth transport
app/lang/ Localization files (JSON, embedded at build time)
app/resources/ Application icon, manifest, resource script
extern/btstack/ BTstack — user-mode Bluetooth stack (git submodule)
extern/lhdcv5-encoder/ Portable C LHDC V5 encoder (git submodule)
extern/libldac/ AOSP libldac — LDAC encoder (git submodule)
extern/libopenaptx/ libopenaptx — aptX / aptX HD encoder (git submodule)
extern/fdk-aac/ Fraunhofer FDK AAC — AAC-LC encoder (git submodule)
extern/json/ nlohmann/json — JSON parser for settings, profiles, localization

Prerequisites

  • Windows 10/11 (x64)
  • Visual Studio 2022 or later with C++ desktop workload
  • CMake 3.16+
  • Git (for submodules and wxWidgets FetchContent)
  • Supported WinUSB Bluetooth adapter. The tested path is MediaTek MT7922 / AMD RZ616 (USB\VID_0E8D&PID_0616&MI_00). Other adapters retain upstream support but are not yet regression-tested in this fork.
  • Zadig (https://zadig.akeo.ie/) to install WinUSB driver on the adapter

Setup

  1. Plug in a dedicated USB Bluetooth adapter (keep built-in Bluetooth for normal Windows use)
  2. Install Zadig from https://zadig.akeo.ie/
  3. Open Zadig → Options → List All Devices
  4. Select your USB Bluetooth adapter from the dropdown
  5. Select WinUSB as the target driver and click Replace Driver
  6. Find your headphone's Bluetooth address in Windows Settings → Bluetooth & devices → your device → Properties
  7. Run A2DPWB.exe (GUI) or A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF

Warning: Replacing the Bluetooth function driver with WinUSB makes that radio unavailable to normal Windows Bluetooth until its original driver is restored. For the RZ616 combo card, select only BT_FUNCTION (Interface 0 / MI_00) in Zadig. Do not replace the Wi-Fi interface; Wi-Fi remains managed by its normal Windows driver. Keep a way to restore the OEM driver in Device Manager.

MediaTek MT7922 / AMD RZ616

The application reads the per-installation DeviceInterfaceGUIDs written by Zadig, initializes the MT7922 firmware from the installed MediaTek DriverStore package, and opens only the Bluetooth MI_00 function. No firmware download is required in the GUI for this adapter.

The tested stable LHDC V5 LL setting is 500 kbps / 48 kHz / 24-bit. The 900/1000 kbps modes are intentionally exposed for testing, but may crackle when the controller or radio link cannot sustain them. LL mode bounds the transmit queue and drops stale packets instead of allowing latency to grow indefinitely.

Firmware Files (Realtek adapters)

Realtek-based USB Bluetooth adapters (e.g., TP-Link UB500, RTL8761BU dongles) require proprietary firmware to operate. Intel and CSR adapters do not need this step.

GUI (Guided): Launch A2DPWB.exe and open the Firmware dialog. If firmware is missing, a warning is displayed with the required filenames. Use Open Download Page to open the linux-firmware/rtl_bt page in your browser, and Open Config Folder to open the destination folder. Download the .bin files and place them in the config folder.

Manual:

  1. Download the firmware and config .bin files for your chipset from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_bt (e.g., rtl8761bu_fw.bin and rtl8761bu_config.bin)
  2. Place both files in the A2DPWB config folder (%APPDATA%\A2DPWB, or the path shown in the Firmware dialog)

License: These firmware files are proprietary Realtek binaries distributed via the linux-firmware project. They are not included in this repository. See linux-firmware WHENCE for redistribution terms.

Building

git clone --recursive https://github.com/rison1337/LHDC-V5-Windows-RZ616.git
cd LHDC-V5-Windows-RZ616
cmake -B build -A x64
cmake --build build --config Release

The executable is output to build/app/Release/A2DPWB-1.0.1.exe.

Note: The first build takes several minutes because CMake FetchContent downloads and compiles wxWidgets.

Usage

GUI Mode (default)

A2DPWB.exe

The graphical interface provides:

  • Bluetooth adapter selection (WinUSB-attached adapters)
  • Audio device selection (WASAPI loopback capture source)
  • LHDC V5 quick controls (64–1000 kbps, 48/96 kHz, 16/24-bit, LL toggle)
  • Codec selection (Auto / LHDC V5 / LDAC / aptX HD / aptX LL / AAC / SBC)
  • LDAC quality mode (HQ 990 kbps / SQ 660 kbps / MQ 330 kbps)
  • LDAC ABR (Adaptive Bit Rate) toggle
  • Connection profile management (save / load device + codec settings)
  • Real-time status display (codec, bitrate, connection state)

CLI Mode

# Auto-select best codec
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF

# Specify codec
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c ldac
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c lhdcv5
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c aptxhd
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c aptxll
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c aac
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c sbc

# LDAC quality modes
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c ldac -q hq   # 990 kbps (default)
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c ldac -q sq   # 660 kbps
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c ldac -q mq   # 330 kbps

# Enable LDAC ABR (Adaptive Bit Rate)
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -c ldac -a

# Virtual audio device capture (e.g. VB-CABLE)
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -m virtual --audio-device "{device-id}"

# Specify USB adapter path (when multiple adapters are connected)
A2DPWB.exe --cli -d AA:BB:CC:DD:EE:FF -u "\\?\usb#..."

# List paired Bluetooth audio devices
A2DPWB.exe --cli -l

Note: Both capture modes (system loopback and virtual device) use WASAPI shared mode. The capture sample rate depends on the device's format configured in Windows Sound settings (typically 48 kHz). To use LDAC at 96 kHz, change the device format to 96 kHz in Sound settings > Advanced.

Features

  • LHDC V5: vendor negotiation, 5 ms frames, 16/24-bit PCM, 44.1/48/96 kHz, fixed 64–1000 kbps modes, and LL packet signaling
  • MediaTek RZ616: dynamic WinUSB discovery and firmware/function initialization
  • Multi-codec support: LHDC V5, LDAC, aptX HD, aptX Low Latency, AAC, SBC with automatic negotiation
  • Two capture modes: System loopback (all system audio) or virtual audio device (per-app routing via VB-CABLE etc.)
  • LDAC ABR: Adaptive Bit Rate for unstable connections
  • Auto-reconnect: Reconnects on Bluetooth disconnection (up to 10 attempts)
  • Profile management: Save and load device + codec configurations
  • Localization: English / Japanese UI
  • Realtek firmware: Guided firmware download for Realtek adapters
  • MTU-aware framing: Optimal packet utilization for each codec
  • PCM residual buffering: Prevents audio data loss at encoder boundaries

License

This project is licensed under the MIT License. See LICENSE for the full text.

Third-party libraries are used under their respective licenses. See THIRD_PARTY_LICENSES.md for details.

BTstack is dual-licensed: BSD-3-Clause for non-commercial use, commercial license available from BlueKitchen GmbH.

References

About

Experimental LHDC V5 Low Latency A2DP audio streaming for Windows, currently tested with MediaTek MT7922 / AMD RZ616.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages