Search by Tags

Bluetooth Audio (Linux)

 
Applicable for

Tags

Subscribe for this article updates

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 table below presents the modules with integrated Bluetooth:

Family Module Version Bluetooth adapter Description
Colibri iMX6ULL 512MB Wi-Fi / Bluetooth Wi2Wi WM828CC6 Bluetooth 4.2/BLE (Dual-Mode)

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:

/ect/dbus-1/systemd/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 blue-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