Skip to content

Audio

FreeBSD uses the Open Sound System (OSS), a kernel-level audio mixer. Applications write to /dev/dsp directly. No PipeWire. No PulseAudio. No WirePlumber. No daemons.

The kernel mixes up to 256 virtual channels. Each application gets its own channel. Volume is controlled per-channel or globally via sysctl or /dev/mixer.

# Check loaded sound modules
cat /dev/sndstat
# Output (example)
Installed devices:
pcm0: <Realtek ALC1220 (Rear Analog)> (play/rec) default
pcm1: <Realtek ALC1220 (Front Analog)> (play/rec)
pcm2: <HDMI/DP (NVIDIA)> (play)
LayerFreeBSDLinux (PipeWire)
Applicationwrites to /dev/dspPipeWire client API
Session managerWirePlumber
Sound serverPipeWire daemon
Compat layerPulseAudio emulation (libpipewire-pulse)
Kernel driversnd_hda (kernel module)ALSA (kernel module)

The volume script wraps sysctl and mixer for quick keyboard-driven control:

volume up # +5%
volume down # -5%
volume mute # toggle mute
volume set 60 # set to 60%
volume status # print current level

These are bound to the media keys in Hyprland by default. See Keybindings.

audio-setup

Interactive audio configuration. Lets you:

  • Select the default output device
  • Set per-application volumes
  • Configure sample rate and bit depth
  • Test audio output
# List available devices
audio-setup list
# Set default output device by index
audio-setup default 1

Audio settings persist via sysctl.conf and loader.conf:

# /etc/sysctl.conf
hw.snd.default_unit=0 # default audio device index
hw.snd.default_auto=1 # auto-switch to new devices
dev.pcm.0.play.vchanmixer=100 # master volume (0-100)
# /boot/loader.conf
snd_hda_load="YES" # Intel HDA (most systems)
snd_uaudio_load="YES" # USB audio devices

Bluetooth requires virtual_oss to bridge the Bluetooth device to an OSS virtual device:

pkg install virtual_oss
# Pair device first
bluetoothctl
> scan on
> pair AA:BB:CC:DD:EE:FF
> connect AA:BB:CC:DD:EE:FF
# Bridge Bluetooth to OSS
virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 \
-s 1024 -f /dev/dsp -d dsp
rc.conf entry for virtual_oss at boot
sudo sysrc virtual_oss_enable=YES
sudo sysrc virtual_oss_dsp="/dev/dsp"

Then configure /usr/local/etc/virtual_oss.conf with your device parameters.

No audio output
# Verify device loaded
cat /dev/sndstat
# Check default device
sysctl hw.snd.default_unit
# Test playback
cat /dev/urandom | dd bs=4096 count=4 > /dev/dsp

If /dev/dsp does not exist, the kernel module is not loaded. Add snd_hda_load="YES" to /boot/loader.conf and reboot.

Wrong output device
# List devices with index
cat /dev/sndstat | grep pcm
# Set default (replace 1 with your device index)
sudo sysctl hw.snd.default_unit=1
# Persist
echo 'hw.snd.default_unit=1' | sudo tee -a /etc/sysctl.conf
Volume control has no effect

Verify you are targeting the correct mixer device. The volume script uses sysctl targeting hw.snd.default_unit. If you have multiple sound cards, ensure hw.snd.default_unit points to the active output.