LoginSignup
12
14

More than 5 years have passed since last update.

Raspberry Piで Audio の録音

Posted at

Raspberry Piを使ってAudioを録音する仕組みが必要になったので,ちょっと備忘録.

準備

道具をAmazonで買ってくる.

その後,必要なソフトをInstall

01
raspberrypi - pi% sudo apt-get install alsa-utils sox libsox-fmt-all

確認

Deviceが認識されているかの確認.

02
raspberrypi - pi% lsusb                                                                                                         
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller

raspberrypi - pi% arecord -l                                                                                                     
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

録音

確認した結果HWはcard 1っぽいので結構当てずっぽうで録音コマンドを叩いてみる.

03
raspberrypi - pi% export AUDIODRIVER=alsa
raspberrypi - pi% AUDIODEV=plughw:1,0 rec test.mp3

録音できたっぽい.

再生

04
raspberrypi - pi% AUDIODEV=plughw:0,0 play test.mp3
raspberrypi - pi% AUDIODEV=plughw:1,0 play test.mp3

の両方で再生できた.plughw:0,0だとRaspberry Pi本体のAudio出力から,plughw:1,0だとUSB側から出力される.

まとめ

  • Raspberry PiからAudio変換ケーブルを使って録音することに成功した.
  • コマンドラインベースで手打ちなので次回はスクリプトから呼び出したい.

参考

Raspberry Piで録音再生

12
14
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
12
14