概要
スマホの音楽(Amazon Musicなど)をBluetooth(a2dp)でvolumio(raspberry pi3)に接続したスピーカーで鳴らす。
環境
- raspberry pi3
- volumio2
- hifiberry dac
やること
Volumio+Bluez-Alsa
このページの内容を行いますが、そのままだとできないところがあるので、補足説明します。
とりかかろう!
1.1 Dependencies
sudo apt-get update
sudo apt-get install libasound2-dev
sudo apt-get install dh-autoreconf
sudo apt-get install libortp-dev
sudo apt-get install bluez pi-bluetooth bluez-tools libbluetooth-dev
sudo apt-get install libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
sudo apt-get install libsbc1 libsbc-dev
1.2 Bluez-Alsaのインストール
sudo git clone https://github.com/Arkq/bluez-alsa.git
cd bluez-alsa sudo autoreconf --install
sudo mkdir build && cd build
sudo ../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib
sudo make && sudo make install
1.3 Bluetoothの設定
/etc/bluetooth/main.conf の内容を次の内容でアップデートします。
main.conf
[General]
Class = 0x20041C
/etc/bluetooth/audio.conf を以下の中身で作ります。
audio.conf
[General]
Class = 0x20041C
Enable = Source,Sink,Media,Socket
1.4 bluealsaの自動起動
1.4.1 自動起動設定ファイルの作成
systemd を使用して、bluealsaを自動起動させるため、
/lib/systemd/system/bluealsa.serviceファイルを作成します。
bluealsa.service
[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
#rootでないと実行できないので修正。
#User=volumio
User=root
Group=audio
ExecStart=/usr/bin/bluealsa
[Install] WantedBy=multi-user.target
bluealsaは、bluetooth.serviceの起動が前提なので、
Requires=bluetooth.service
After=bluetooth.service
が必要です。
参考にしたページでは、User=volumioになっていますが、これだと
起動時、Permissionエラーになります。
bluealsa manページです。
1.4.2 自動起動登録
sudo systemctl daemon-reload
sudo systemctl enable bluealsa.service
上手く動いているかどうかは、以下のコマンドを使って確認してください。
- journalctl
- systemctl | grep blue