1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry PiにインストールされているSonic PiでUSBスピーカーを利用する

1
Last updated at Posted at 2019-01-12

はじめに

この記事は、ハンズオン準備のための備忘録です。技術的に最適な方法ではないかもしれません。

Raspberry Piで利用するRaspbianにはSonic Piというプログラムで音楽を奏でるソフトウェアがインストールされています。このソフトウェアでは、デフォルトでオーディオデバイスの優先順位がいちばん高いものに音声出力しているようですが、ソフトウェア内にはこの優先度を調整するための設定が無いため、Raspbianそのものの設定を変える必要がありました。

参考サイト

利用したもの

Raspberry Pi 3 Module B V1.2
Raspbian Stretch with desktop and recommended softwareのRelease date: 2018-11-13
USB接続ミニステレオスピーカー(スイッチサイエンスhttps://www.switch-science.com/catalog/3152/)

方法

① USBスピーカーをUSBポートに刺す

② コマンドでスピーカーの優先順位設定を調べる

cat /proc/asound/modules

たぶん以下の表示になる

0 snd_bcm2835
1 snd_usb_audio

③ /etc/modprobe.dにsound.confを作成する

sudo leafpad /etc/modprobe.d/sound.conf

④ sound.confに以下の内容を書く

options snd slots=snd_usb_audio,snd_bcm2835
options snd_usb_audio index=0
options snd_bcm2835 index=1

⑤再起動する

注意事項

  1. この設定を行うと、aplay /usr/share/sounds/alsa/Rear_Center.wavでの音声再生テストはエラーになります。

2. スイッチサイエンスの製品ページ https://www.switch-science.com/catalog/3152/ にある「Raspberry Pi での使用については、こちらのガイドをご参照ください。」のところは、行わなくてよい。

所感

Sonic Piはライブコーディングでライブ演奏ができるため、USBスピーカー接続のトラブルシューティング事例は多くあるかと思ったのですが、あまり見かけませんでした。今回の設定でも、すべてがOKというわけではなく対処療法なので、もっとよい方法があればご教示いただきたいです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?