RaspberryPiでAirPlay
この情報は古くなっています。
MarshallスピーカーをAirPlayスピーカーにしてみます。
具合
メモ
BluetoothDAC Bluetooth AUDIO (A2DP) レシーバーできる?
- Bluetooth V4.0+EDRとAirPlayが使えるようになる
- Realtek HD PCオンボード端子 vs AirPlayの場合、高音質化が良くわかる
- 大音量の無音部でホワイトノイズ?が聞こえる
JustBoom DAC | 384kHz/32bit ALSA192kHz制限 突破可能 ×DSD |
iTunes | ×FLAC 〇ALAC ×DSD |
iPhone | 〇FLAC 〇ALAC △DSD |
環境
ボード | Raspberry Pi Zero WH |
ストレージ | SanDisk Ultra microSDHC 16GB |
電源アダプタ | USB ACアダプター 5V 2A |
Wi-Fi | 標準搭載のWi-Fi 2.4GHz |
D/Aコンバータ | JustBoom DAC Zero pHAT |
ケース | JustBoom DAC Zero Case |
作業PC | Windows10 |
テストスピーカー
ヘッドホン | - |
3.5mm | Marshall Kilburn |
組み立て
Get Started
JustBoom DAC Zero pHATとケースをセットアップする JustBoom ボードに IRレシーバーを追加する JustBoom ボードに ロータリーエンコーダを追加する JustBoom DAC Zero またはDigi Zeroに再生LEDを追加する JustBoom DAC Zero pHATにRCAコネクタを追加する
Software Guides
ソフトウェアガイド RaspbianであなたのJustBoomを設定してください
Technical Guides
JustBoom ボードピン配置
FAQ
よくある質問
Products
JustBoom DAC Zero pHAT for Raspberry Pi Zero / Pi Zero W • JustBoom ・DACチップ-384kHz/32ビット。Linuxドライバの制限により、Raspberry Piの最大周波数は現在標準で192kHzに制限されていますが、手動でドライバを更新するとこれを増やすことができます。 ・追加のステレオラインレベル出力用のオプションのはんだ付けRCAジャック - Switchcraft PJRAN1X1U02X(白)および Switchcraft PJRAN1X1U03X(赤) ・オプションのハンダ付け型プレイバックLED - Kingbright L-934GD(緑色)または Multicomp MCL034MD(赤色)
準備
OS
Download Raspbian for Raspberry Pi
Raspbian Stretch Lite 使用
(省略)
MicroSD、モニター、キーボードを取り付け電源ON
拡張
ログイン
raspberrypi login: pi Password: raspberry
設定
$ sudo raspi-config 7.Advanced Options > A1 Expand Filesystem > <Ok> > tab > Finish > reboot<Yes>
タイムゾーン
ログイン
raspberrypi login: pi Password: raspberry
設定
$ sudo raspi-config 4 Localisation Options > I2 Change Timezone > Asia > Tokyo > tab > Finish
キーボード
設定
$ sudo raspi-config 4 Localisation Options > I3 Change Keyboard Layout > Generic 105-key (Intl) PC > Other > Japanese > Japanese > The default for the keyboard layout > No compose key > tab > Finish
ホスト名
設定
$ sudo raspi-config 2 Network Options > N1 Hostname > <Ok>
変更
dac
再起動
tab > Finish > reboot<Yes>
SSH有効化
ログイン
raspberrypi login: pi Password: raspberry
設定
$ sudo raspi-config 5 Interfacing Options > P2 SSH > <Yes> > <Ok> > tab > Finish
Wi-Fi有効化
設定
$ sudo raspi-config 4 Localisation Options > I4 Change Wi-Fi Country > JP Japan > <Ok> > tab > Finish
設定
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
変更
XXXXXXXX: 接続したいWi-FiのSSID
ZZZZZZZZZZZZ: 接続したいWi-Fiのパスワード
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=JP network={ ssid="XXXXXXXX" psk="ZZZZZZZZZZZZ" key_mgmt=WPA-PSK }
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
Windows10 SSHクライアント > TeraTermの場合
ホスト: dac.local ユーザ名: pi パスフレーズ: raspberry
Wi-Fi電源管理機能OFF
$ sudo nano /etc/rc.local
末尾exit 0の手前に入力
sudo /sbin/iw dev wlan0 set power_save off
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
Windows10 SSHクライアント > TeraTermの場合
ホスト: dac.local ユーザ名: pi パスフレーズ: raspberry
確認
$ iwconfig wlan0 Power Management:off
取り外し
設定
$ sudo apt-get update $ sudo apt-get upgrade
電源OFF
$ sudo shutdown -h now
モニター、キーボードは必要無くなるので取り外し電源ON
IP固定
電源入れっぱなしで数日 ホスト名の接続だけ失敗する怪現象
IPで接続できるようにしておく
Raspbian Stretch の場合
$ sudo nano /etc/dhcpcd.conf
末尾に追加
interface wlan0 static ip_address=192.168.1.200/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
端子設定
$ sudo raspi-config 7 Advanced Options > A4 Audio > 1 Force 3.5mm (‘headphone’) jack > tab > Finish
DAC設定
JustBoomの場合
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
設定
$ sudo nano /boot/config.txt
末尾dtparam=audio=onをコメントアウトし追記
#dtparam=audio=on dtparam=audio=off dtoverlay=i2s-mmap dtoverlay=justboom-dac
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
Shairport Sync
インストール
参考: Simple Installation Instructions
参考: Troubleshooting
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
パッケージ
$ sudo apt-get install build-essential git xmltoman autoconf automake libtool libdaemon-dev libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev
ビルド
$ git clone https://github.com/mikebrady/shairport-sync.git $ cd shairport-sync $ autoreconf -fi $ ./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-systemd $ make $ sudo make install
自動起動
$ sudo systemctl enable shairport-sync
サービス開始
$ sudo systemctl start shairport-sync
再起動
$ sudo reboot
アップデート
参考: shairport-sync/UPDATING.md at master
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
アップデート
$ sudo apt-get update $ sudo apt-get upgrade
音楽の再生を停止
以前のビルドディレクトリがあるか確認
$ ls -l drwxr-xr-x 10 pi pi 4096 Jan 13 23:56 shairport-sync
ディレクトリがある場合
$ cd shairport-sync $ git pull
ディレクトリがない場合
$ git clone https://github.com/mikebrady/shairport-sync.git $ cd shairport-sync
update
$ autoreconf -fi $ make $ sudo make install
再起動
$ sudo systemctl daemon-reload $ sudo systemctl restart shairport-sync
AirPlay接続
AirPlay でオーディオをストリーミングする方法 - Apple サポート
延命対策
swap
無効化
Stretchの場合
$ sudo dphys-swapfile swapoff $ sudo systemctl stop dphys-swapfile $ sudo systemctl disable dphys-swapfile
fstab
設定
$ sudo nano /etc/fstab
nodiratime追記と末尾に追記
参考: fstab - ArchWiki atime オプション
PARTUUID=5cfaeb3f-02 / ext4 defaults,noatime,nodiratime 0 1 tmpfs /tmp tmpfs defaults,noatime,nodiratime,mode=1777 0 0 tmpfs /run/user/1000 tmpfs defaults,noatime,nodiratime,mode=1777 0 0
保存: Ctrl + o リターン
終了: Ctrl + x
再起動
$ sudo reboot
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
確認
$ df -h
systemctl
確認
$ systemctl list-unit-files -t service|grep enabled
rsyslog停止
$ sudo systemctl stop rsyslog.service $ sudo systemctl disable rsyslog.service 戻すなら $ sudo systemctl enable rsyslog.service
bluetooth停止
$ sudo systemctl stop hciuart.service $ sudo systemctl stop bluetooth.service $ sudo systemctl disable hciuart.service $ sudo systemctl disable bluetooth.service 戻すなら $ sudo systemctl enable hciuart.service $ sudo systemctl enable bluetooth.service
再起動
$ sudo reboot
Windows10 SSHクライアント > TeraTermの場合
ホスト: 192.168.1.200 ユーザ名: pi パスフレーズ: raspberry
確認
$ systemctl list-unit-files -t service $ systemctl list-unit-files -t service|grep disabled
folder2ram
RAMディスク化
インストール
$ sudo wget -O /sbin/folder2ram https://raw.githubusercontent.com/bobafetthotmail/folder2ram/master/debian_package/sbin/folder2ram $ sudo chmod +x /sbin/folder2ram $ sudo folder2ram -configure will now open the configuration file with your favourite text editor write its name and press enter (nano, vim, gedit are the most common) リターン $ sudo nano /etc/folder2ram/folder2ram.conf
末尾に追記
tmpfs /var/log tmpfs /var/tmp tmpfs /var/spool tmpfs /var/cache/samba
保存: Ctrl + o > リターン
終了: Ctrl + x
$ sudo folder2ram -mountall $ sudo folder2ram -enablesystemd
再起動
$ sudo reboot
確認
$ df -h
journald
$ sudo nano /etc/systemd/journald.conf
追記
Storage=none
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
sysctl
Netdataでsoftnetの警告が必ず出る
過去10分間に、ksoftirqがsysctl net.core.netdev_budgetまたはnet.core.netdev_budget_usecsを使い果たし作業が残っている。これはパケットがドロップされる原因となる可能性があります。
参考: Red Hat Enterprise Linux Network Performance Tuning Guide
参考: Can't fix persistent 'netdev budget ran outs' with 45k alerts, need help #4624
設定
$ sudo nano /etc/sysctl.conf
末尾に追記
net.core.netdev_budget_usecs=20000
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
更新履歴
- 2019.04.04 アップデート追記
- 2019.01.05 公開