😊

Raspberry Pi でCLI音楽再生

2023/05/04に公開

Raspberry Pi 3A+でGUI環境は重いので基本的にはSSHによるコンソール操作、出先でラズパイで音楽を再生させながら作業をできる様にCLIで操作できるようにMOCをインストール

mocインストール

$ sudo apt install moc
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libenca0 libopusfile0 librcc0 librcd0 libsidutils0 libtagc0
Suggested packages:
  moc-ffmpeg-plugin
The following NEW packages will be installed:
  libenca0 libopusfile0 librcc0 librcd0 libsidutils0 libtagc0 moc
0 upgraded, 7 newly installed, 0 to remove and 15 not upgraded.
Need to get 586 kB of archives.
After this operation, 1,770 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main arm64 libenca0 arm64 1.19-1+b1 [58.2 kB]
Get:2 http://deb.debian.org/debian bullseye/main arm64 libopusfile0 arm64 0.9+20170913-1.1 [37.7 kB]
Get:3 http://deb.debian.org/debian bullseye/main arm64 librcd0 arm64 0.1.13-3+b2 [24.3 kB]
Get:4 http://deb.debian.org/debian bullseye/main arm64 librcc0 arm64 0.2.12-0.1+b2 [46.9 kB]
Get:5 http://deb.debian.org/debian bullseye/main arm64 libsidutils0 arm64 2.1.1-15+b1 [25.4 kB]
Get:6 http://deb.debian.org/debian bullseye/main arm64 libtagc0 arm64 1.11.1+dfsg.1-3 [29.0 kB]
Get:7 http://deb.debian.org/debian bullseye/main arm64 moc arm64 1:2.6.0~svn-r3005-1 [364 kB]
Fetched 586 kB in 0s (1,398 kB/s)
Selecting previously unselected package libenca0:arm64.
(Reading database ... 102768 files and directories currently installed.)
Preparing to unpack .../0-libenca0_1.19-1+b1_arm64.deb ...
Unpacking libenca0:arm64 (1.19-1+b1) ...
Selecting previously unselected package libopusfile0.
Preparing to unpack .../1-libopusfile0_0.9+20170913-1.1_arm64.deb ...
Unpacking libopusfile0 (0.9+20170913-1.1) ...
Selecting previously unselected package librcd0.
Preparing to unpack .../2-librcd0_0.1.13-3+b2_arm64.deb ...
Unpacking librcd0 (0.1.13-3+b2) ...
Selecting previously unselected package librcc0.
Preparing to unpack .../3-librcc0_0.2.12-0.1+b2_arm64.deb ...
Unpacking librcc0 (0.2.12-0.1+b2) ...
Selecting previously unselected package libsidutils0.
Preparing to unpack .../4-libsidutils0_2.1.1-15+b1_arm64.deb ...
Unpacking libsidutils0 (2.1.1-15+b1) ...
Selecting previously unselected package libtagc0:arm64.
Preparing to unpack .../5-libtagc0_1.11.1+dfsg.1-3_arm64.deb ...
Unpacking libtagc0:arm64 (1.11.1+dfsg.1-3) ...
Selecting previously unselected package moc.
Preparing to unpack .../6-moc_1%3a2.6.0~svn-r3005-1_arm64.deb ...
Unpacking moc (1:2.6.0~svn-r3005-1) ...
Setting up libenca0:arm64 (1.19-1+b1) ...
Setting up libtagc0:arm64 (1.11.1+dfsg.1-3) ...
Setting up libsidutils0 (2.1.1-15+b1) ...
Setting up librcd0 (0.1.13-3+b2) ...
Setting up librcc0 (0.2.12-0.1+b2) ...
Setting up libopusfile0 (0.9+20170913-1.1) ...
Setting up moc (1:2.6.0~svn-r3005-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u5) ...

ボリューム調整

alsamixerがインストールされていたので起動しカーソルの上限変更、ESCで終了

起動

$ mocp

操作メモ

s→音楽を停止します。
b→前のトラック。
n→次のトラック。
q→MOCインターフェースを非表示にします。表示はCtrl+Alt+T
Q→MOCを停止して終了します
h→help

とても簡単に再生できました

参考URL

https://note.com/wabisuke94/n/n03e8cf2bee4b

Discussion