SND_UAUDIO(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– SND_UAUDIO(4) β€” USB audio and MIDI device driver πŸ’–

okay bestie, welcome to the Kernel Interfaces Manual page for snd_uaudio β€” literally the USB audio + MIDI device driver moment. It’s giving β€œplug in your interface and let the kernel handle it” energy, no cap. 🎧✨

🌸 NAME 🌸

snd_uaudio β€” USB audio and MIDI device driver. 🫢

πŸŽ€ SYNOPSIS πŸŽ€

Build it into your kernel with these lines, bestie:

device sound
device usb
device snd_uaudio

Then in rc.conf(5):

kld_list="snd_uaudio"

And in sysctl.conf(5), these are the names to know:

hw.usb.uaudio.buffer_ms
hw.usb.uaudio.default_bits
hw.usb.uaudio.default_channels
hw.usb.uaudio.default_rate
hw.usb.uaudio.handle_hid
hw.usb.uaudio.debug

πŸ¦‹ DESCRIPTION πŸ¦‹

A USB audio device consists of a number of components: input terminals (e.g. USB digital input), output terminals (e.g. speakers), and a number of units in between (e.g. volume control). It’s basically a tiny little audio chain living on your USB bus, and the kernel is the main character holding it together. πŸ’…

If the device supports multiple configurations, and there have been no user-supplied values specified through the sysctl(8) interface, the driver will select the best matching configuration supported by the device during attach. β€œBest” means the configuration with the most channels and highest quality in sample rate and sample size. Obsessed with a driver that picks the glow-up config for you. ✨

Refer to the β€˜USB Audio Class Specification’ for more information.

πŸ’œ HARDWARE πŸ’œ

The snd_uaudio driver provides support for USB audio class devices and USB MIDI class devices. That’s the whole vibe check: audio class and MIDI class, handled. 🎹🎧

πŸ”₯ SYSCTL VARIABLES πŸ”₯

The following settings can be entered at the loader(8) prompt or in loader.conf(5) and can also be changed at runtime with the sysctl(8) command. For a change to take effect during runtime, the device has to be re-attached. Like, literally re-attach it β€” the runtime glow-up doesn’t happen until you do. 🫠

  • hw.usb.uaudio.buffer_ms β€” Period of audio data processed at once, in milliseconds, from 1 to 8 (default is 4). Lower values mean less latency, but this can result in audible gaps due to frequent CPU wakeups. So yes, low latency is cute, but not if your audio starts glitching like a bad video call. 😭
  • hw.usb.uaudio.default_bits β€” Preferred sample size in bits, from 0 to 32 (default is 0). A value of 0 sets the sample size to the maximum supported sample size. Set this to select a smaller sample size if the device supports multiple sample sizes. Tiny-bit energy when you want it, bestie. 🎚️
  • hw.usb.uaudio.default_channels β€” Preferred number of sample channels, from 0 to 64 (default is 0). USB 1.1 devices are limited to 4 channels due to bandwidth constraints, unless a higher value is explicitly requested. A value of 0 sets the sample channels to the maximum supported channel number. Set this to select a smaller channel number if the device supports multiple channel configurations. Channel count realness, but make it configurable. 🌈
  • hw.usb.uaudio.default_rate β€” Preferred sample rate in Hz (default is 0). If set to 0, the device’s highest supported sample rate will be used. Note that if VCHANs are enabled, the sample rate will be overridden by dev.pcm.%d.[play|rec].vchanrate (see sound(4)), which can also be used to adjust the sample rate during runtime. If hw.usb.uaudio.default_rate is non-zero, dev.pcm.%d.[play|rec].vchanrate will use it as its maximum allowed value. Rate logic is doing the absolute most, but it’s documented so we move. πŸ’…
  • hw.usb.uaudio.handle_hid β€” Let snd_uaudio handle HID volume keys, if any (default is 1).
    • 0 β€” Disabled.
    • 1 β€” Enabled.

If usb(4) has been compiled with USB_DEBUG on, the following setting is also available:

  • hw.usb.uaudio.debug β€” Debug output level (default is 0). Debug girlies, this one’s for you. πŸ”

🌈 SEE ALSO 🌈

⭐ HISTORY ⭐

The snd_uaudio driver first appeared in FreeBSD 4.7. Iconic behavior since FreeBSD 4.7, periodt. πŸ‘‘

πŸ‘‘ AUTHORS πŸ‘‘

This manual page was adopted from NetBSD 1.6 and modified for FreeBSD by Hiten Pandya <hmp@FreeBSD.org>. Credit where credit is due, bestie. 🫢

πŸ’€ BUGS πŸ’€

The PCM framework in FreeBSD currently does not support the full set of USB audio mixer controls. Some mixer controls are only available as dev.pcm.%d.mixer sysctls. Not me finding out the mixer controls are lowkey sysctl-only right now β€” but that’s the documented tea. 🍡


xoxo bestie πŸ’– this page is sourced/versioned as Debian, dated July 17, 2025, and it’s the SND_UAUDIO(4) page. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from