Skip to main content
Version: 5.0

Bluetooth Audio (Linux)

This article describes how to play audio over a Bluetooth device using the A2DP profile with Embedded Linux. For modules that don’t come with Bluetooth hardware on-module, support can easily be added by using a USB Bluetooth module.

Supported BSP

The bluez-alsa package is included since BSP 2.8b3.

Configuring the Device

Enable Bluetooth as described in the Bluetooth (Linux) article.

After enabling Bluetooth, restart the bluez-alsa service:

systemctl restart bluez-alsa.service

Edit:

/etc/dbus-1/system.d/bluetooth.conf
...
<policy user="bluealsa">
<allow send_destination="org.bluez"/>
</policy>
</busconfig>

Connect to the Bluetooth device as described in the Bluetooth (Linux) articele.

Using bluez-alsa

To play an audio file:

aplay -D bluealsa:HCI=hci0,DEV=[Device MAC],PROFILE=a2dp audio.wav

To set HCI, DEV and PROFILE as default create or modify:

~/.asoundrc
defaults.bluealsa{
interface "hci0"
device "[Device MAC]"
profile "a2dp"
}

With this configuration file in place aplay can be used without any device specification and it will play through Bluetooth.

To change volume level on the module use:

alsamixer -D bluealsa
Send Feedback!