💾 Archived View for paritybit.ca › arboretum › knowledge › openbsd-desktop.gmi captured on 2023-01-29 at 02:54:47. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Random things that I want to make note of. Usually small tutorial snippets
This is a pain point with daily OpenBSD use. Audio device management is not as easy as it is with most other OSes, even if the audio system is way simpler. It can take a few commands to get things in order, and it's friendliest on laptops where you are less likely to have several peripherals plugged in.
Scan `dmesg` for `audioN` strings to figure out which audio device is mapped to which number. Then, to use, for example, audio1 when present but fall back to audio0 when not, use:
# rcctl set sndiod flags -f rsnd/0 -F rsnd/1 # rcctl restart sndiod
Audio1 can be a USB DAC or other non-default audio interface.
(Being able to tell sndiod which audio device to use without needing to change flags with rcctl and root privileges would be very nice. As would a small utility to list out audio interfaces by name. First thing might be hard depending on how sndiod works, but second could be a simple shell script.)
When you unplug an additional audio device, sndiod won't know about it unless you tell it to reload its configuration.
# cat > /etc/hotplug/attach case $2 in uaudio*) pkill -HUP sndiod ;; esac ^D # chmod +x /etc/hotplug/attach # rcctl enable hotplugd # rcctl start hotplugd
`sndioctl` is the program used to change audio device volume. It can be run as a non-privileged user:
$ sndioctl input.mute=1
will mute the microphone, for example.
$ sndioctl output.level=+0.1
will increase output volume by 10%, for example.
Passing the AUDIOPLAYDEVICE and AUDIORECDEVICE environment variables to a program will tell it to use the defined devices for playing or recording audio. This is useful if you have sndio set to play audio through one device, but your microphone is a different device.
$ AUDIOPLAYDEVICE=snd/1 AUDIORECDEVICE=snd/2 mumble
will tell this invocation of mumble to play audio through the audio1 device but record through audio2.