The default audio device in FreeBSD can be set with the utility sysctl on the command line. This means default microphone input and default sound output. Note, that setting the default audio device in FreeBSD is different from setting the Output Device in Sound in GNOME, which only affects a few applications, such as Firefox.

The different audio devices can be listed by concatenating the contents of sndstat. In this example, a number of audio devices on the motherboard and USB headphones is listed.

$ cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC887 (Rear Analog)> (play/rec)
pcm1: <Realtek ALC887 (Analog)> (play/rec)
pcm2: <Realtek ALC887 (Front Analog Headphones)> (play)
pcm3: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
pcm4: <USB audio> (play/rec) default
No devices installed from userspace.

The default audio device is controlled by getting and setting the kernel state of hw.snd.default_unit. The value of this variable sets the default audio device. In this example, the default audio device is changed from front analog headphones to USB headphones.

$ sysctl hw.snd.default_unit
hw.snd.default_unit: 2
$ sysctl hw.snd.default_unit=4
hw.snd.default_unit: 2 -> 4

Any application. such as VLC and KDEnlive, will now play audio to the default audio device, which is USB headephones in this example.

If needed, the mixer for each audio device can be used to adjust the different audio levels, such as output volume and input gain.

$ mixer -f /dev/mixer4
Mixer vol      is currently set to  55:55
Mixer pcm      is currently set to  75:75
Mixer rec      is currently set to  75:75
Mixer monitor  is currently set to  75:75

There are also more user friendly mixer frontends available, such mixertui, which can be installed from packages and ports.

# pkg install mixertui
$ mixertui