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.
How It Works
Section titled “How It Works”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 modulescat /dev/sndstat
# Output (example)Installed devices:pcm0: <Realtek ALC1220 (Rear Analog)> (play/rec) defaultpcm1: <Realtek ALC1220 (Front Analog)> (play/rec)pcm2: <HDMI/DP (NVIDIA)> (play)Stack Comparison
Section titled “Stack Comparison”| Layer | FreeBSD | Linux (PipeWire) |
|---|---|---|
| Application | writes to /dev/dsp | PipeWire client API |
| Session manager | — | WirePlumber |
| Sound server | — | PipeWire daemon |
| Compat layer | — | PulseAudio emulation (libpipewire-pulse) |
| Kernel driver | snd_hda (kernel module) | ALSA (kernel module) |
FreeBSD audio requires one kernel module and zero daemons. Simpler means fewer failure modes.
Commands
Section titled “Commands”volume
Section titled “volume”The volume script wraps sysctl and mixer for quick keyboard-driven control:
volume up # +5%volume down # -5%volume mute # toggle mutevolume set 60 # set to 60%volume status # print current levelThese are bound to the media keys in Hyprland by default. See Keybindings.
audio-setup
Section titled “audio-setup”audio-setupInteractive audio configuration. Lets you:
- Select the default output device
- Set per-application volumes
- Configure sample rate and bit depth
- Test audio output
# List available devicesaudio-setup list
# Set default output device by indexaudio-setup default 1Configuration
Section titled “Configuration”Audio settings persist via sysctl.conf and loader.conf:
# /etc/sysctl.confhw.snd.default_unit=0 # default audio device indexhw.snd.default_auto=1 # auto-switch to new devicesdev.pcm.0.play.vchanmixer=100 # master volume (0-100)# /boot/loader.confsnd_hda_load="YES" # Intel HDA (most systems)snd_uaudio_load="YES" # USB audio devicesBluetooth Audio
Section titled “Bluetooth Audio”Bluetooth requires virtual_oss to bridge the Bluetooth device to an OSS virtual device:
pkg install virtual_oss# Pair device firstbluetoothctl > scan on > pair AA:BB:CC:DD:EE:FF > connect AA:BB:CC:DD:EE:FF
# Bridge Bluetooth to OSSvirtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 \ -s 1024 -f /dev/dsp -d dspsudo sysrc virtual_oss_enable=YESsudo sysrc virtual_oss_dsp="/dev/dsp"Then configure /usr/local/etc/virtual_oss.conf with your device parameters.
Troubleshooting
Section titled “Troubleshooting”# Verify device loadedcat /dev/sndstat
# Check default devicesysctl hw.snd.default_unit
# Test playbackcat /dev/urandom | dd bs=4096 count=4 > /dev/dspIf /dev/dsp does not exist, the kernel module is not loaded. Add snd_hda_load="YES" to /boot/loader.conf and reboot.
# List devices with indexcat /dev/sndstat | grep pcm
# Set default (replace 1 with your device index)sudo sysctl hw.snd.default_unit=1
# Persistecho 'hw.snd.default_unit=1' | sudo tee -a /etc/sysctl.confVerify 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.