LoginSignup
1
1

More than 5 years have passed since last update.

[メモ]ラズパイzero w事始め(Audio Injector Zeroのサウンドカード接続)

Last updated at Posted at 2017-11-18

概要

ラズパイzeroWに、Audio Injector Zeroのサウンドカードを取り付けましたのでその手順メモ。
Audio Injector Zero

このサウンドカードを選択した理由はインプット/アウトプットの豊富さと独立したボリュームポットの接続が可能な拡張性の高さです。国内では手に入らないので米アマゾンからお取り寄せで購入しました。
拡張ボード接続例
参考にしたサイト:

英文が苦手な私は上記「アールテクニカ地下ガレージ」様の記事で助かりました。

Audio Injector Zerの主な仕様(意訳)

  • 仕様(サウンドカードボード):
    • Direct Inputsコネクタ(ステレオ)
    • Direct Outputsコネクタ(ステレオ)
    • Potentiometer Inputsコネクタおよびポテンショメータ(ステレオ)
    • Potentiometer Outputsコネクタおよびポテンショメータ(ステレオ)
    • ヘッドフォン端子
    • マイクロフォン
    • Sample rate : 96 kHz, 32 bit (with 24 bit ΔΣ DACs and ADCs)
    • ジッタコントロール:クリスタルロック、コーデックマスター、低ジッタ(クリスタルカード)。
    • ハードウェア:Raspberry Pi2、Pi3、およびZeroで動作

事前準備

SSHで同一LANセグメントから設定を行います。以下の事前作業を終えておきます。

  • ラズパイzeroWのSSH有効化とGPIOヘッダーピンの取り付け。
  • Audio Injector ZeroのGPIO接続箇所に2×40のメスコネクターをあらかじめ半田付け。
  • audio.injector.scripts_0.1-1_all.deb.tar.gzをダウンロード

設定

Audio Injector Zeroをラズパイに接続して、ラズパイの電源をONにします。

SCPで事前にダウンロードしたaudio.injector.scripts_0.1-1_all.deb.tar.gzをラズパイのpiユーザhomeディレクトリにファイルを送る(ラズパイ上でWgetを試みましたがダメでした)

# ご自身のラズパイのIPで実施してください。
scp audio.injector.scripts_0.1-1_all.deb.tar py@192.168.0.xxx:

ラズパイにSSHログインし、homeディレクトリにUPしたファイルを解凍。

tar xvf audio.injector.scripts_0.1-1_all.deb.tar

解凍したファイルaudio.injector.scripts_0.1-1_all.debをインストール

sudo dpkg -i audio.injector.scripts_0.1-1_all.deb

コマンドラインからaudioInjector-setup.shコマンドを実行します(入力してreturnキーを押す)。

sudo audioInjector-setup.sh

以下、セットアップシェル実行中のメッセージ

updating the kernel
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13403 100 13403 0 0 19127 0 --:--:-- --:--:-- --:--:-- 19119
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We're running for the first time
*** Backing up files (this will take a few minutes)
*** Backing up firmware
*** Backing up modules 4.9.59+

This update bumps to rpi-4.9.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=167934

*** Downloading specific firmware revision (this will take a few minutes)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 168 0 168 0 0 161 0 --:--:-- 0:00:01 --:--:-- 162
100 54.1M 100 54.1M 0 0 795k 0 0:01:09 0:01:09 --:--:-- 1543k
*** Updating firmware
*** Updating kernel modules
*** depmod 4.9.61+
*** depmod 4.9.61-v7+
*** Updating VideoCore libraries
*** Using HardFP libraries
*** Updating SDK
*** Running ldconfig
*** Storing current firmware revision
*** Deleting downloaded files
*** Syncing changes to disk
*** If no errors appeared, your firmware was successfully updated to ff196a8a73de039aeebc81c7c1f1e4a6580db11c
*** A reboot is needed to activate the new firmware

The audio injector sound card is now setup.
Please reboot to enable the correct device tree.

再起動後にtestコマンドを実行。

alsactl --file /usr/share/doc/audioInjector/asound.state.RCA.thru.test restore

しかし、ここでNG。soxをインストールしろとメッセージが。。

couldn't find the sox command please install the sox pacakge

soxをインストール

sudo apt-get install sox

パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5
coinor-libcoinutils3v5 coinor-libipopt1v5 coinor-libosi1v5 fonts-opensymbol
libabw-0.1-1 libboost-date-time1.61.0 libboost-date-time1.62.0
libboost-filesystem1.61.0 libboost-iostreams1.61.0 libboost-system1.61.0
libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5
libcolamd2 libe-book-0.1-1 libeot0 libetonyek-0.1-1 libexttextcat-2.0-0
libexttextcat-data libfreehand-0.1-1 libgltf-0.0-0v5 libgmime-2.6-0
libgpgme11 libhsqldb1.8.0-java liblangtag-common liblangtag1 libmhash2
libmspub-0.1-1 libmumps-seq-4.10.0 libmwaw-0.3-3 libmythes-1.2-0
libneon27-gnutls libodfgen-0.1-1 liborcus-0.11-0 libpagemaker-0.0-0
libraptor2-0 librasqal3 libraw15 librdf0 librevenge-0.0-0 libservlet3.1-java
libsuitesparseconfig4 libvisio-0.1-1 libwpd-0.10-10 libwpg-0.3-3
libwps-0.4-4 libyajl2 lp-solve uno-libs3 ure
これを削除するには 'sudo apt autoremove' を利用してください。
以下の追加パッケージがインストールされます:
libopencore-amrnb0 libopencore-amrwb0 libsox-fmt-alsa libsox-fmt-base
libsox2
提案パッケージ:
libsox-fmt-all
以下のパッケージが新たにインストールされます:
libopencore-amrnb0 libopencore-amrwb0 libsox-fmt-alsa libsox-fmt-base
libsox2 sox
アップグレード: 0 個、新規インストール: 6 個、削除: 0 個、保留: 1 個。
599 kB のアーカイブを取得する必要があります。
この操作後に追加で 1,224 kB のディスク容量が消費されます。
続行しますか? [Y/n] y
取得:1 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian stretch/main armhf libopencore-amrnb0 armhf 0.1.3-2.1 [80.4 kB]
取得:2 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf libopencore-amrwb0 armhf 0.1.3-2.1 [42.0 kB]
取得:3 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf libsox2 armhf 14.4.1-5 [231 kB]
取得:4 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf libsox-fmt-alsa armhf 14.4.1-5 [47.0 kB]
取得:5 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf libsox-fmt-base armhf 14.4.1-5 [63.8 kB]
取得:6 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf sox armhf 14.4.1-5 [135 kB]
599 kB を 5秒 で取得しました (113 kB/s)
以前に未選択のパッケージ libopencore-amrnb0:armhf を選択しています。
(データベースを読み込んでいます ... 現在 111092 個のファイルとディレクトリがインストールされています。)
.../0-libopencore-amrnb0_0.1.3-2.1_armhf.deb を展開する準備をしています ...
libopencore-amrnb0:armhf (0.1.3-2.1) を展開しています...
以前に未選択のパッケージ libopencore-amrwb0:armhf を選択しています。
.../1-libopencore-amrwb0_0.1.3-2.1_armhf.deb を展開する準備をしています ...
libopencore-amrwb0:armhf (0.1.3-2.1) を展開しています...
以前に未選択のパッケージ libsox2:armhf を選択しています。
.../2-libsox2_14.4.1-5_armhf.deb を展開する準備をしています ...
libsox2:armhf (14.4.1-5) を展開しています...
以前に未選択のパッケージ libsox-fmt-alsa:armhf を選択しています。
.../3-libsox-fmt-alsa_14.4.1-5_armhf.deb を展開する準備をしています ...
libsox-fmt-alsa:armhf (14.4.1-5) を展開しています...
以前に未選択のパッケージ libsox-fmt-base:armhf を選択しています。
.../4-libsox-fmt-base_14.4.1-5_armhf.deb を展開する準備をしています ...
libsox-fmt-base:armhf (14.4.1-5) を展開しています...
以前に未選択のパッケージ sox を選択しています。
.../5-sox_14.4.1-5_armhf.deb を展開する準備をしています ...
sox (14.4.1-5) を展開しています...
mime-support (3.60) のトリガを処理しています ...
libsox2:armhf (14.4.1-5) を設定しています ...
libopencore-amrnb0:armhf (0.1.3-2.1) を設定しています ...
man-db (2.7.6.1-2) のトリガを処理しています ...
libopencore-amrwb0:armhf (0.1.3-2.1) を設定しています ...
libsox-fmt-base:armhf (14.4.1-5) を設定しています ...
libsox-fmt-alsa:armhf (14.4.1-5) を設定しています ...
sox (14.4.1-5) を設定しています …

soxのインスコが完了したら、また先ほどのコマンドを実行->OKだったので、続けてヘッドフォンジャックに任意のヘッドフォンを接続して、audioInjector-test.shを動かしてみます。

# 先ほどこけたコマンド
alsactl --file /usr/share/doc/audioInjector/asound.state.RCA.thru.test restore
# Audio Injector Zero同梱のサウンドテストスクリプトを実行
audioInjector-test.sh

play: no process found
arecord: no process found
gpicview: no process found
録音中 WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, レート 48000 Hz, ステレオ

Encoding: n/a
Channels: 2 @ 16-bit
Samplerate: 48000Hz
Replaygain: off
Duration: unknown

In:0.00% 00:00:03.07 [00:00:00.00] Out:144k [ | ] Hd:5.9 Clip:0
Done.
Error: no "view" rule for type "image/png" passed its test case
(for more information, add "--debug=1" on the command line)
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening '/tmp/spectrogram.png'
録音中 WAVE '/tmp/test.mic.wav' : Signed 16 bit Little Endian, レート 48000 Hz, ステレオ

Encoding: n/a
Channels: 2 @ 16-bit
Samplerate: 48000Hz
Replaygain: off
Duration: unknown

In:0.00% 00:00:03.07 [00:00:00.00] Out:144k [ | ] Hd:5.9 Clip:0
Done.
Error: no "view" rule for type "image/png" passed its test case
(for more information, add "--debug=1" on the command line)
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening '/tmp/spectrogram.mic.png'
press enter to test again, any other key then enter to exit
o

上記の通り、X系のアプリケーションはコケてますが、ヘッドホンからピー、ピーという連続音が聞こえるのでサウンド出力系のセットアップは正常であることの確認が取れました。

使用するGPIOピン

最後に公式のフォーラムより、Audio Injector Zeroが使用しているGPIOピンの情報です。

  • ピン03:I2Cピン
  • ピン05:I2Cピン
  • ピン12:ビットクロック
  • ピン35:LRクロック
  • ピン38:データ ピン40:データ出力

使用するGPIOピンの図

次回はAirPlay接続して、iTunesの再生を試してみたいと思います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1