Bluetooth Audio (Linux)
info
This page has not been fully updated to reflect the changes made in Toradex Linux BSP 6. Some information may still apply to Toradex Linux BSP 6 configurations. If you encounter issues, please Send Feedback.
If you are using version 5 LTS, please visit the 5 LTS version documentation.
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:
...
<policy user="bluealsa">
<allow send_destination="org.bluez"/>
</policy>
</busconfig>
Connect to the Bluetooth device as described in the Bluetooth (Linux) article.
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:
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