Getting the PC speaker to beep

On my Oneiric system I had to do the following to get XBell/XkbBell working again:

  1. Load the module pcspkr (like you already did via /etc/modprobe.d/blacklist.conf)
  2. Remove the package pulseaudio-module-x11 (that seems to absorb all XBell events)
  3. Put options snd-hda-intel beep_mode=2 into /etc/modprobe.d/enable-beep.conf (you only need that case you own a system with an intel sound chip like my Latitude E6420). Unmute the speaker in alsamixer after that.

Some terminals (like konsole, see bug Bug 177861) ignore the bell character. A good way to test the system beep is with the xkbbell command.

After I did all that the java call Toolkit.getDefaultToolkit().beep() works just fine.


On 14.04.3 LTS it nows seems sufficient to edit /etc/modprobe.d/blacklist.conf and enable pcspkr by commenting out the blacklist line.

#blacklist pcspkr

The # turns the line into a comment.

Make sure the Terminal (gnome-terminal) allows console bell in the preferences tab.

This was tested via backspace on an empty terminal line. This was also tested via the beep utility (assuming that you have installed it). Instead you can do programmatic beeping via the java.awt.Toolkit object:

java.awt.Toolkit.getDefaultToolkit().beep().

The Toolkit object is more efficient than the beep utility.

By the way, some people dislike the PC speaker. Link

Tags:

Speakers