0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

archlinux beepを鳴らす方法

Last updated at Posted at 2025-04-08

その昔、PC-9801用に'GAR SOUND SYSTEM'というFM音源ドライバを作ったことがありました。タイマ割り込みを利用してMMLで記述された曲を鳴らすというものでした。遅くてリアルタイムゲームの使い物にならなかったので、ASCII-netに発表したものの、御蔵入りにしました。linux用に改良版を又作りたかったのですが、Linuxのサウンドシステムは難しいので、pulseaudioで、音声ファイルを鳴らす方法を書いておきます。

僕のパソコンはラップトップで、物理的にbeep音が鳴らないので、paplayで代用します。

 paplay /usr/share/sounds/freedesktop/stereo/complete.oga

物理的にbeepが付いている場合は、以下の方法で、udevルールを変更すると鳴るようになると思います。

まず、beepをインストールします。

sudo pacman -S beep

/etc/udev/rules.d/70-pcspkr-beep.rulesというファイルを作成し、以下の内容を記述します

ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="PC Speaker", ENV{DEVNAME}!="", TAG+="uaccess"

設定を反映させます

sudo udevadm control --reload

再度モジュールをリロードします

sudo rmmod pcspkr && sudo modprobe pcspkr

beepを鳴らします。

beep
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?