DEV Community

Alfonso Siciliano
Alfonso Siciliano

Posted on • Originally published at alfonsosiciliano.gitlab.io

FreeBSD disable stereo sound

We have two ears, so we hear the world in stereo. Two ears give us a sense of distance and direction. Therefore, the FreeBSD Operating System provides and enables multichannel audio by default, popularly referred to as "surround sound". Properly, by default only 2 channels are enabled: "s16le:2.0, Stereo, 2 channels (left, right)".

Unfortunately, stereo audio is quite useless and annoying for a person with single sided deafness or unilateral hearing loss. Some utility allows to select mono, for example, vlc (port/package multimedia/vlc):

vlc main menu: Audio -> Stereo Mode -> Mono

Not all utilities are so advanced. Fortunately, the FreeBSD Audio Subsystem is very powerful. It is possible to select mono for each device via:

# sysctl dev.pcm.%d.play.vchanformat="s16le:1.0"
Enter fullscreen mode Exit fullscreen mode

where %d is a device number listed by:

$ sysctl dev.pcm
Enter fullscreen mode Exit fullscreen mode

To automatically set the mode each time the machine boots (let's say for the device number 3), add to /etc/sysctl.conf.

# Mono for device 3
dev.pcm.3.play.vchanformat=s16le:1.0
Enter fullscreen mode Exit fullscreen mode

Laptops typically have two speakers (left and right). The speaker to "bad" ear can be annoying for people with unilateral hearing loss. Fortunately (again), the FreeBSD Audio Subsystem is very powerful. It is possible to set the volume for each speaker, for example, via mixertui (port/package audio/mixertui):

Volume bar in muxertui: left speaker 85, right speaker 0

To save pressing 'p' key and to load/set after a reboot
(without starting the TUI):

$ mixertui -p audio-profile.conf
Enter fullscreen mode Exit fullscreen mode

Important. Refer to the sound(4) manual and the Sound Wiki Page to know more about FreeBSD audio features and customizations.

Top comments (0)