Created
October 10, 2020 20:48
-
-
Save fagnercarvalho/2755eaa492a8aa27081e0e0fe7780d14 to your computer and use it in GitHub Desktop.
Install bluealsa and pair/connect to Bluetooth device in Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install bluealsa to create interface to Bluetooth device | |
git clone https://github.com/Arkq/bluez-alsa.git | |
cd bluez-alsa | |
su | |
apt-get install libglib2.0-dev -y | |
apt-get install -y libasound2-dev | |
apt install -y build-essential autoconf | |
apt-get install -y libbluetooth-dev | |
apt-get install libtool -y | |
apt install libsbc-dev -y | |
apt-get install build-essential libdbus-glib-1-dev libgirepository1.0-dev | |
autoreconf --install | |
mkdir build && cd build | |
../configure --enable-ofono --enable-debug | |
make && make install | |
# Pair, trust and then connect to Bluetooth device | |
bluetoothctl | |
power on | |
agent on | |
scan on | |
# Choose the right device address from the list | |
pair 78:44:05:EB:93:71 | |
trust 78:44:05:EB:93:71 | |
info 78:44:05:EB:93:71 | |
connect 78:44:05:EB:93:71 | |
# Create file for bluealsa interface | |
nano ~/.asoundrc | |
# Add to new file | |
defaults.bluealsa.interface "org.bluealsa" | |
defaults.bluealsa.device "78:44:05:EB:93:71" # change this to your Bluetooth device address | |
defaults.bluealsa.profile "a2dp" | |
defaults.bluealsa.delay 10000 | |
# Download track for testing purposes | |
wget "http://soundbible.com/grab.php?id=2206&type=wav" -O example.wav --no-check-certificate | |
# Play track by using aplay. aplay is a .wav file player | |
aplay -D bluealsa:DEV=78:44:05:EB:93:71,PROFILE=a2dp example.wav | |
# In case you have issues when trying to play the tracks check the logs by using the commands below | |
journalctl -xeu bluealsa.service | |
journalctl -xeu bluetooth.service | |
systemctl status bluetooth | |
# Also, make sure bluealsa is installed by running | |
bluealsa --version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment