Apparently, some users have been loudly complaining about their systems playing loud beeps. And it seems some devs have been a bit over zealous in trying to get rid of the system beep. So they have thrown the baby out with the bath water. And now users who need the system beep do not seem to have it anymore.
The traditional method, to trigger the bell sound on a system beep event, was using pcspkr or snd-pcsp kernel modules. It seems quite a lot of users have lost this functionality during system updates. There seem to be multiple workarounds of workarounds floating around to resolve this issue. Some seem to work for some, but not for many.
If you can, it is best to try get either pcspkr or snd-pcsp to work, as the system beep is an integrated event. You can hear the beep anywhere you want, including the console and terminals. The beep volume can be controlled from your audio mixer. You can increase, decrease, or mute the beep volume. That is how it used to be, and that is how it should have been.
Unfortunately, we seem to have quite a lot of trigger happy devs lately. In their eternal quest to keep adding yet more features and bumping up versions, they lose sight of core functionality and stability. Personally, I would rather have stable (even if old) reliable systems, than use bleeding edge new systems filled with tons of new (unnecessary?) features and yet more bugs. In this process, the maintainers seem to be cannibalising what they have been handed over from previous generations.
But I guess, we are where we are.. and we try to make the best of what we have.
A digital beep could be a useful alternative. In this case, an audio file sounding like a bell masquerades as the pc-speaker bell at each system beep. In a nutshell, an audio player plays an audio file, at every system beep event.
The caveat is that depending on the method used, a digital beep is restricted to certain environments only. The method used below will only work within X, not on the console or any tty or anywhere outside X.
Read on for what is required. You can customise, or replace most of the bits with something else.
Kernel config:
Since we will not use pcspkr or snd-pcsp, we might as well remove them from the kernel, or atleast mask them. No need to carry excess baggage. No point in having things we can't/won't use.
# vi /etc/modprobe.d/blacklist.conf blacklist pcspkr black snd-pcsp
Check your kernel config for INPUT_BEEP. If not, add them and recompile your kernel. You will need to reboot for the new kernel to take effect.
$ grep BEEP /boot/config-`uname -r` CONFIG_SND_HDA_INPUT_BEEP=y CONFIG_SND_HDA_INPUT_BEEP_MODE=1
This is enabled in the default kernel configs of gentoo, debian, ubuntu, and arch linux.
Packages required:
1. sound-theme-freedesktop
2. vorbis-tools
3. xkbevd
sound-theme-freedesktop: A standard minimal freedesktop.org sound theme.
This package installs a set of sound files in
/usr/share/sounds/freedesktop
directory. One of those audio files called bell.oga simulates a digital beep.vorbis-tools
This package contains the ogg123 audio decoder/player, which can play
.oga
sound files from a sound-theme
.$ man ogg123 ogg123 reads Ogg Vorbis audio files and decodes them to the devices specified on the command line. By default, ogg123 writes to the standard sound device, but output can be sent to any number of devices. Files can be read from the file system, or URLs can be streamed via HTTP.
xkbevd: XKB event daemon
We run this as a background service to check for bell events, and trigger
ogg123
to play bell.oga
.$ man xkbevd The xkbevd event daemon listens for specified XKB events and executes requested commands if they occur. The configuration file consists of a list of event specification/action pairs and/or variable definitions.
The default configuration file is ~/.xkb/xkbevd.cf, which needs to be created.
$ vi ~/.xkb/xkbevd.cf soundDirectory="/usr/share/sounds/" soundCmd="ogg123 -q" Bell() "freedesktop/stereo/bell.oga"
This is pretty much the standard configuration.
We could open this up, and use any other audio file and any other media player. One thing to consider would be the impact of using large audio files and/or large audio players. We don't really want our system to freeze at every single bell event, while bloatwares load.
Identify your environment, to auto-start the XKB event daemon, according to your DE (Desktop Environment) or WM (Window Manager).
In my case, I login at the console and startx. I added the following line to my startup file.
$ vi ~/.xinitrc xkbevd -bg exec i3
There are a few more lines in that file. But those are the last two lines.
Ok, we have pretty much finished up. Now, we need to check whether these settings take effect.
If you had to recompile your kernel, you need to reboot. If you didn't, you need to logout and login, to verify the daemon auto-start.
May the beep be with you!
No comments:
Post a Comment