Difference between revisions of "PC speaker"

From ArchWiki
Jump to: navigation, search
(copied content from 'Beep', added h1 header to mark Beep)
(updated man page links (interactive))
(Tag: wiki-scripts)
 
(25 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
[[Category:Sound]]
 
[[Category:Sound]]
[[bg:Disable PC speaker beep]]
+
[[ja:PC スピーカー]]
[[cs:Disable PC speaker beep]]
+
{{Related articles start}}
[[es:Disable PC speaker beep]]
+
{{Related|Kernel modules}}
[[ja:PC スピーカーのビープ音の無効化]]
+
{{Related|Advanced Linux Sound Architecture}}
[[ko:Disable PC speaker beep]]
+
{{Related articles end}}
[[ru:Disable PC speaker beep]]
 
[[uk:Disable PC speaker beep]]
 
[[zh-cn:Disable PC speaker beep]]
 
{{Merge|beep|...and rename to [[PC speaker]]?}}
 
  
= Disable PC Speaker =
+
The computer often seems to make beep noises or other sounds at various times, whether we want them or not. They come from various sources, and as such, you may be able to configure if or when they occur. For situations where no sound card or speakers are available and a simple audio notification is desired, see [[#Beep]].
== Introduction ==
 
  
The computer often seems to make beep noises or other sounds at various times, whether we want them or not. They come from various sources, and as such, you may be able to configure if or when they occur.
+
Sounds from the computer can be heard from the built-in case speaker, the speakers, or headphones which are plugged into the soundcard (in which case the noise may be unexpectedly loud).  
  
Further, the sounds from the computer can be heard from the built-in case speaker, or the speakers or headphones which are plugged into the sound card (in which case the noise may be unexpectedly loud). This article deals primarily with the former.
+
{{Note|The sounds are caused by the BIOS (Basic Input/Output System), the OS (Operating System), the DE (Desktop Environment), or various software programs. The BIOS is a particularly troublesome problem because it is kept inside an EPROM chip on the motherboard, and the only direct control the user has is by turning the power on or off. Unless the BIOS setup has a setting you can adjust or you wish to attempt to reprogram that chip with the proper light source, it is not likely you will be able to change it at all. BIOS-generated beep sounds are not addressed here, except to say that unplugging your computer case speaker will stop all such sounds from being heard. (Do so at your own risk.)}}
  
The sounds are caused by the BIOS (Basic Input/Output System), the OS (Operating System), the DE (Desktop Environment), or various software programs. The BIOS is a particularly troublesome problem because it is kept inside an EPROM chip on the motherboard, and the only direct control the user has is by turning the power on or off.  Unless the BIOS setup has a setting you can adjust or you wish to attempt to reprogram that chip with the proper light source, it is not likely you will be able to change it at all. BIOS-generated beep sounds are not addressed here, except to say that unplugging your computer case speaker will stop all such sounds from being heard.  (Do so at your own risk.)
+
== Disable PC Speaker ==
  
However, everything else which can cause a sound to come out of the computer case speaker can be handled with the suggestions listed below.
+
Turning off a particular instance of a sound, while leaving the others operational, is possible if and only if one can identify which portion of the environment generates the particular sound. This allows customizing the selection of sounds. Please feel free to add any configurations and settings to this wiki page that may be useful for other users.
  
One should also note that the option of turning off a particular instance of a sound, while leaving the others operational, is possible if one can identify which portion of the environment is the source of the particular sound generation. This can make a very customized selection of attention-getting sounds possible. Please feel free to add your findings to this wiki page when you find particular examples of settings combinations which may be useful for other users.
+
=== Globally ===
  
==Globally==
+
The PC speaker can be disabled by [[Kernel modules#Manual_module_handling|unloading]] the {{ic|pcspkr}} [[kernel module]]:
 
 
The PC speaker can be disabled by [[Kernel modules#Manual_module_handling|unloading]] the {{ic|pcspkr}} module:
 
 
  # rmmod pcspkr
 
  # rmmod pcspkr
  
Line 34: Line 27:
 
[[Kernel_modules#Using_kernel_command_line_2|Blacklisting it on the kernel command line]] is yet another way. Simply add {{ic|1=modprobe.blacklist=pcspkr}} to your bootloader's kernel line.
 
[[Kernel_modules#Using_kernel_command_line_2|Blacklisting it on the kernel command line]] is yet another way. Simply add {{ic|1=modprobe.blacklist=pcspkr}} to your bootloader's kernel line.
  
== Locally ==
+
=== Xorg ===
 
 
=== In X ===
 
  
 
  $ xset -b
 
  $ xset -b
  
You can add this command to a startup file, such as [[xprofile]] to make it permanent.
+
You can add this command to a startup file such as {{ic|/etc/xprofile}} to make it permanent. See [[xprofile]] for more information.
  
=== In console ===
+
=== Console ===
  
You can add this command in {{ic|/etc/profile}} or a dedicated file like {{ic|/etc/profile.d/disable-beep.sh}} (must be executable):
+
You can add this command in {{ic|/etc/profile}} or a dedicated file like {{ic|/etc/profile.d/disable-beep.sh}}:
 
  setterm -blength 0
 
  setterm -blength 0
  
Line 50: Line 41:
 
  set bell-style none
 
  set bell-style none
  
=== Using ALSA ===
+
=== ALSA ===
  
{{Tip|For most Intel's cards, if you do not see PC Speaker in alsamixer's default device, then try selecting "HDA Intel PCH" device by pressing F6. It is listed as "Beep" there. This is because PulseAudio proxy controls may not list all PC Speakers.}}
+
For most sound cards the PC speaker is listed as an [[ALSA]] channel, named either ''PC Speaker'', ''PC Beep'', or ''Beep''. To mute the speaker, either use ''alsamixer'' or ''amixer'':
Try muting the PC Speaker:
+
  $ amixer set ''channel'' 0% mute
  $ amixer set 'PC Speaker' 0% mute
 
  
For certain sound cards, it is the PC Beep:
+
To unmute the channel, see [[Advanced Linux Sound Architecture#Unmuting the channels]].
$ amixer set 'PC Beep' 0% mute
 
  
Or merely Beep:
+
{{Tip|If you are using PulseAudio and the PC speaker channel is not listed for the default ALSA device, try selecting the device corresponding to the sound card - PulseAudio proxy controls may not list the PC speaker}}
$ amixer set 'Beep' 0% mute
 
  
You can also use alsamixer for a console GUI
+
=== GNOME ===
$ alsamixer
 
 
 
Scroll to PC beep and press 'M' to mute. Save your alsa settings:
 
# alsactl store
 
 
 
{{Note|Not every sound card creates a PC Speaker or PC Beep slider control in alsamixer.}}
 
 
 
=== In GNOME ===
 
  
 
Using GSettings:
 
Using GSettings:
Line 76: Line 56:
 
  $ gsettings set org.gnome.desktop.wm.preferences audible-bell false
 
  $ gsettings set org.gnome.desktop.wm.preferences audible-bell false
  
=== In Cinnamon ===
+
=== Cinnamon ===
  
 
Cinnamon seems to play a "water drop" sound. To disable it, set in dconf:
 
Cinnamon seems to play a "water drop" sound. To disable it, set in dconf:
Line 95: Line 75:
 
This is documented in the [https://developer.gnome.org/gtk3/stable/GtkSettings.html Gnome Developer Handbook].
 
This is documented in the [https://developer.gnome.org/gtk3/stable/GtkSettings.html Gnome Developer Handbook].
  
==See also==
+
== Beep ==
 +
Beep is an advanced PC speaker beeping program. It is useful for situations where no sound card and/or speakers are available, and simple audio notification is desired.
  
* Have a look at these {{ic|man}} pages for further information: {{ic|xset(1)}}, {{ic|setterm(1)}}, {{ic|readline(3)}}.
+
=== Installation ===
* [[Kernel modules]]
 
  
= Beep =
+
[[Install]] the {{Pkg|beep}} package.
[[Category:Sound]]
 
{{Merge|Disable PC speaker beep|...and rename to [[PC speaker]]?}}
 
  
Beep is an advanced PC speaker beeping program. It is useful for situations where no sound card and/or speakers are available, and simple audio notification is desired.
+
You may also need to [[#ALSA|unmute]] the PC speaker in [[ALSA]].
  
==Installation==
 
[[Install]] the {{Pkg|beep}} package.
 
 
==Configuration==
 
 
=== Access for non-root users ===
 
=== Access for non-root users ===
  
Line 126: Line 100:
 
Note however that this way '''anyone''' can execute {{ic|/usr/bin/beep}} with root permissions. The change also creates a difference between local copy and the package, which will be reported by {{ic|pacman -Qkk}}.
 
Note however that this way '''anyone''' can execute {{ic|/usr/bin/beep}} with root permissions. The change also creates a difference between local copy and the package, which will be reported by {{ic|pacman -Qkk}}.
  
===Unmuting in alsamixer===
+
=== Tips and Tricks ===
 
 
You should also unmute the Beep channel using {{Ic|alsamixer}}.
 
 
 
$ alsamixer
 
 
 
You may need to press {{ic|F6}} and select your card. scroll to the Beep channel using the arrow keys and press {{ic|M}} to unmute the channel. notice that the "MM" label below the channel will change to "00". you can also use {{ic|↑}} to increase the volume of the channel.
 
 
 
Press {{ic|Esc}} to close alsamixer.
 
 
 
You can also save your settings to ALSA Mixer to make it permanent:
 
 
 
# alsactl -f /var/lib/alsa/asound.state store
 
  
==Tips and Tricks==
 
 
While many people are happy with the traditional beep sound, some may like to change its properties a bit. The following example plays slighly higher and shorter sound and repeats it two times.
 
While many people are happy with the traditional beep sound, some may like to change its properties a bit. The following example plays slighly higher and shorter sound and repeats it two times.
  
 
  # beep -f 5000 -l 50 -r 2
 
  # beep -f 5000 -l 50 -r 2
  
==See also==
+
== See also ==
*[[Advanced Linux Sound Architecture]]
+
 
 +
* {{man|1|xset}}, {{man|1|setterm}}, {{man|3|readline}}

Latest revision as of 20:32, 6 September 2017

The computer often seems to make beep noises or other sounds at various times, whether we want them or not. They come from various sources, and as such, you may be able to configure if or when they occur. For situations where no sound card or speakers are available and a simple audio notification is desired, see #Beep.

Sounds from the computer can be heard from the built-in case speaker, the speakers, or headphones which are plugged into the soundcard (in which case the noise may be unexpectedly loud).

Note: The sounds are caused by the BIOS (Basic Input/Output System), the OS (Operating System), the DE (Desktop Environment), or various software programs. The BIOS is a particularly troublesome problem because it is kept inside an EPROM chip on the motherboard, and the only direct control the user has is by turning the power on or off. Unless the BIOS setup has a setting you can adjust or you wish to attempt to reprogram that chip with the proper light source, it is not likely you will be able to change it at all. BIOS-generated beep sounds are not addressed here, except to say that unplugging your computer case speaker will stop all such sounds from being heard. (Do so at your own risk.)

Disable PC Speaker

Turning off a particular instance of a sound, while leaving the others operational, is possible if and only if one can identify which portion of the environment generates the particular sound. This allows customizing the selection of sounds. Please feel free to add any configurations and settings to this wiki page that may be useful for other users.

Globally

The PC speaker can be disabled by unloading the pcspkr kernel module:

# rmmod pcspkr

Blacklisting the pcspkr module will prevent udev from loading it at boot:

# echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf

Blacklisting it on the kernel command line is yet another way. Simply add modprobe.blacklist=pcspkr to your bootloader's kernel line.

Xorg

$ xset -b

You can add this command to a startup file such as /etc/xprofile to make it permanent. See xprofile for more information.

Console

You can add this command in /etc/profile or a dedicated file like /etc/profile.d/disable-beep.sh:

setterm -blength 0

Another way is to add or uncomment this line in /etc/inputrc or ~/.inputrc:

set bell-style none

ALSA

For most sound cards the PC speaker is listed as an ALSA channel, named either PC Speaker, PC Beep, or Beep. To mute the speaker, either use alsamixer or amixer:

$ amixer set channel 0% mute

To unmute the channel, see Advanced Linux Sound Architecture#Unmuting the channels.

Tip: If you are using PulseAudio and the PC speaker channel is not listed for the default ALSA device, try selecting the device corresponding to the sound card - PulseAudio proxy controls may not list the PC speaker

GNOME

Using GSettings:

$ gsettings set org.gnome.desktop.wm.preferences audible-bell false

Cinnamon

Cinnamon seems to play a "water drop" sound. To disable it, set in dconf:

$ dconf write /org/cinnamon/desktop/wm/preferences/audible-bell false

GTK+

Append this line to ~/.gtkrc-2.0:

gtk-error-bell = 0

Add the same line to the [Settings] section of $XDG_CONFIG_HOME/gtk-3.0/settings.ini:

[Settings]
gtk-error-bell = 0

This is documented in the Gnome Developer Handbook.

Beep

Beep is an advanced PC speaker beeping program. It is useful for situations where no sound card and/or speakers are available, and simple audio notification is desired.

Installation

Install the beep package.

You may also need to unmute the PC speaker in ALSA.

Access for non-root users

By default beep will fail if not run by the root. Other users may call it using sudo. To let group users call sudo beep without a password (for example to use it in scripts), /etc/sudoers should be edited:

%users ALL=(ALL) NOPASSWD: /usr/bin/beep

or, to let only a single user do that:

username ALL=(ALL) NOPASSWD: /usr/bin/beep

Another way is setting the sticky bit on /usr/bin/beep:

# chmod 4755 /usr/bin/beep

Note however that this way anyone can execute /usr/bin/beep with root permissions. The change also creates a difference between local copy and the package, which will be reported by pacman -Qkk.

Tips and Tricks

While many people are happy with the traditional beep sound, some may like to change its properties a bit. The following example plays slighly higher and shorter sound and repeats it two times.

# beep -f 5000 -l 50 -r 2

See also