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.
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
Connect to the Bluetooth device as described in the Bluetooth (Linux) articele.
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:
device "[Device MAC]"
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