aplayに必要なパッケージをインストールする
この手順では、Linuxでaplay
コマンドを使用するために必要なパッケージをインストールします。aplay
コマンドは、ALSA(Advanced Linux Sound Architecture)ユーティリティの一部であり、ALSAサウンドシステムに対するユーザーレベルのインターフェイスを提供します。
まず、パッケージインデックスを更新しましょう。
sudo apt-get update
出力例:
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Fetched 324 kB in 1s (324 kB/s)
Reading package lists... Done
次に、aplay
コマンドや他のALSAユーティリティを含むalsa-utils
パッケージをインストールします。
sudo apt update
sudo apt-get install -y alsa-utils
出力例:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
alsa-firmware-loaders alsa-topology-conf alsa-ucm-conf libatopology2 libsnd-dev libsndfile1 libsndfile1-dev
Suggested packages:
alsa-oss
The following NEW packages will be installed:
alsa-firmware-loaders alsa-topology-conf alsa-ucm-conf alsa-utils libatopology2 libsnd-dev libsndfile1 libsndfile1-dev
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,265 kB of archives.
After this operation, 5,120 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-firmware-loaders amd64 1.2.4-1 [12.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-topology-conf all 1.2.4-1 [11.0 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-ucm-conf all 1.2.4-1 [89.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 alsa-utils amd64 1.2.6-1ubuntu1 [1,153 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 libatopology2 amd64 1.2.4-1 [13.9 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libsnd-dev amd64 1.0.29-1 [18.0 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 libsndfile1 amd64 1.0.31-2 [111 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libsndfile1-dev amd64 1.0.31-2 [57.1 kB]
Fetched 1,265 kB in 1s (1,265 kB/s)
Selecting previously unselected package alsa-firmware-loaders.
(Reading database... 123412 files and directories currently installed.)
Preparing to unpack.../alsa-firmware-loaders_1.2.4-1_amd64.deb...
Unpacking alsa-firmware-loaders (1.2.4-1)...
Selecting previously unselected package alsa-topology-conf.
Preparing to unpack.../alsa-topology-conf_1.2.4-1_all.deb...
Unpacking alsa-topology-conf (1.2.4-1)...
Selecting previously unselected package alsa-ucm-conf.
Preparing to unpack.../alsa-ucm-conf_1.2.4-1_all.deb...
Unpacking alsa-ucm-conf (1.2.4-1)...
Selecting previously unselected package alsa-utils.
Preparing to unpack.../alsa-utils_1.2.6-1ubuntu1_amd64.deb...
Unpacking alsa-utils (1.2.6-1ubuntu1)...
Selecting previously unselected package libatopology2:amd64.
Preparing to unpack.../libatopology2_1.2.4-1_amd64.deb...
Unpacking libatopology2:amd64 (1.2.4-1)...
Selecting previously unselected package libsnd-dev:amd64.
Preparing to unpack.../libsnd-dev_1.0.29-1_amd64.deb...
Unpacking libsnd-dev:amd64 (1.0.29-1)...
Selecting previously unselected package libsndfile1:amd64.
Preparing to unpack.../libsndfile1_1.0.31-2_amd64.deb...
Unpacking libsndfile1:amd64 (1.0.31-2)...
Selecting previously unselected package libsndfile1-dev:amd64.
Preparing to unpack.../libsndfile1-dev_1.0.31-2_amd64.deb...
Unpacking libsndfile1-dev:amd64 (1.0.31-2)...
Setting up alsa-firmware-loaders (1.2.4-1)...
Setting up alsa-topology-conf (1.2.4-1)...
Setting up alsa-ucm-conf (1.2.4-1)...
Setting up libatopology2:amd64 (1.2.4-1)...
Setting up libsnd-dev:amd64 (1.0.29-1)...
Setting up libsndfile1:amd64 (1.0.31-2)...
Setting up libsndfile1-dev:amd64 (1.0.31-2)...
Setting up alsa-utils (1.2.6-1ubuntu1)...
Processing triggers for man-db (2.10.2-1)...
Processing triggers for libc-bin (2.35-0ubuntu3)...
これでaplay
コマンドに必要なパッケージがインストールされ、次の手順に進むことができます。