Archive for January, 2009

Redirect linux console beep to the sound card

Monday, January 19th, 2009

I’ve been frustrated for a long time that my Ubuntu Hardy Heron desktop machine would send a console or terminal beep (e.g. ctrl-G) to the PC speaker for a harsh 1980’s-style tone from under my desk.  I usually turn off the audible beep and live with a visual beep (screen or window flash), but I’ve started using irssi through screen, and I wanted a way to let it notify me of messages even when buried under other windows.

I tried softbeep, but that didn’t work for me.  However, I just found the Fancy Beeper Daemon, which did.  Here’s what I did to set it up.

First, I downloaded and unpacked the beep-2.6.24+.tar.gz tarball.  Then I ran “sudo install.sh” (I already had the linux kernel headers and compiler tools installed.)

For whatever reason,the new /dev/beep device wasn’t globally readable, so “sudo chmod a+r /dev/beep fixed that.  (A more sophisticated approach would have that chown to the console user on login, but this is a single-user machine, so I didn’t bother.)

Once that was done, I needed a daemon to poll that device and play a sound using aplay.  The Fancy Beeper Daemon tarball includes several examples, but I chose to create my own instead: beepd_aplay (to use this, change the user, group and pid file location to suit your own setup).

Then I added that to my .bashrc to run automatically when I log in.   Now, I get a nice sound through my sound card and speakers instead of that harsh system beep.