SOUND(4)
π SOUND(4) π
okay so this is the FreeBSD Kernel Interfaces Manual page for sound, pcm, and snd, aka the whole PCM audio device infrastructure. bestie, grab a strawberry drink π, because this is the audio lore.
β¨ NAME β¨
sound, pcm, snd β FreeBSD PCM audio device infrastructure π
π οΈ SYNOPSIS π οΈ
To compile this driver into the kernel, place the following line in your kernel configuration file:
device sound
π DESCRIPTION π
The sound driver is the main component of the FreeBSD sound system. It works in conjunction with a bridge device driver on supported devices and provides PCM audio record and playback once it attaches. Each bridge device driver supports a specific set of audio chipsets and needs to be enabled together with the sound driver. PCI and ISA PnP audio devices identify themselves, so users are usually not required to add anything to /boot/device.hints. slay, autodetection π
Some of the main features of the sound driver are: multichannel audio, per-application volume control, dynamic mixing through virtual sound channels, true full duplex operation, bit perfect audio, rate conversion and low latency modes. itβs giving audio main character energy π
The sound driver is enabled by default, along with several bridge device drivers. Those not enabled by default can be loaded during runtime with kldload(8) or during boot via loader.conf(5). The following bridge device drivers are available:
snd_ai2s(4)(enabled by default on powerpc)snd_als4000(4)snd_atiixp(4)snd_cmi(4)(enabled by default on amd64, i386)snd_cs4281(4)snd_csa(4)(enabled by default on amd64, i386)snd_davbus(4)(enabled by default on powerpc)snd_emu10k1(4)snd_emu10kx(4)(enabled by default on amd64, i386)snd_envy24(4)snd_envy24ht(4)snd_es137x(4)(enabled by default on amd64, i386)snd_fm801(4)snd_hda(4)(enabled by default on amd64, i386)snd_hdsp(4)snd_hdspe(4)snd_ich(4)(enabled by default on amd64, i386)snd_maestro3(4)snd_neomagic(4)snd_solo(4)snd_spicds(4)snd_uaudio(4)(auto-loaded on device plug)snd_via8233(4)(enabled by default on amd64, i386)snd_via82c686(4)snd_vibes(4)
Refer to the manual page for each bridge device driver for driver specific settings and information. iykyk, each bridge has its own little vibe check π¦
π₯Ύ Boot Variables π₯Ύ
In general, the module snd_foo corresponds to device snd_foo and can be loaded by the boot loader(8) via loader.conf(5) or from the command line using the kldload(8) utility. Options which can be specified in /boot/loader.conf include:
snd_driver_load(βNOβ) β If set to βYESβ, this option loads all available drivers.snd_hda_load(βNOβ) β If set to βYESβ, only the Intel High Definition Audio bridge device driver and dependent modules will be loaded.snd_foo_load(βNOβ) β If set to βYESβ, load driver for card/chipsetfoo.
To define default values for the different mixer channels, set the channel to the preferred value using hints, e.g.: hint.pcm.0.line="0". This will mute the input channel per default. noted, bestie π
πΆ Multichannel Audio πΆ
Multichannel audio, popularly referred to as βsurround soundβ, is supported and enabled by default. The FreeBSD multichannel matrix processor supports up to 18 interleaved channels, but the limit is currently set to 8 channels (as commonly used for 7.1 surround sound). The internal matrix mapping can handle reduction, expansion or re-routing of channels. This provides a base interface for related multichannel ioctl() support. Multichannel audio works both with and without VCHANs. okay, spatial audio said periodt π
Most bridge device drivers are still missing multichannel matrixing support, but in most cases this should be trivial to implement. Use the dev.pcm.%d.[play|rec].vchanformat sysctl(8) to adjust the number of channels used. The current multichannel interleaved structure and arrangement was implemented by inspecting various popular UNIX applications. There were no single standard, so much care has been taken to try to satisfy each possible scenario, despite the fact that each application has its own conflicting standard. chaos, but carefully managed chaos π
ποΈ EQ ποΈ
The Parametric Software Equalizer (EQ) enables the use of βtoneβ controls (bass and treble). Commonly used for ear-candy or frequency compensation due to the vast difference in hardware quality. EQ is disabled by default, but can be enabled with the hint.pcm.%d.eq tunable. bass go brrr when you turn it on π
π VCHANs π
Each device can optionally support more playback and recording channels than physical hardware provides by using βvirtual channelsβ or VCHANs. VCHAN options can be configured via the sysctl(8) interface but can only be manipulated while the device is inactive. so yes, you gotta catch it while itβs asleep π§
π VPC π
FreeBSD supports independent and individual volume controls for each active application, without touching the master sound volume. This is sometimes referred to as Volume Per Channel (VPC). The VPC feature is enabled by default. per-app volume is iconic, no cap π
ποΈ Loader Tunables ποΈ
The following loader tunables are used to set driver configuration at the loader(8) prompt before booting the kernel, or they can be stored in /boot/loader.conf in order to automatically set them before booting the kernel. It is also possible to use kenv(1) to change these tunables before loading the sound driver. The following tunables can not be changed during runtime using sysctl(8). big emphasis on can not, bestie β οΈ
hint.pcm.%d.eqβ Set to1or0to explicitly enable (1) or disable (0) the equalizer. Requires a driver reload if changed. Enabling this will make bass and treble controls appear in mixer applications. This tunable is undefined by default. Equalizing is disabled by default.hint.pcm.%d.vpcβ Set to1or0to explicitly enable (1) or disable (0) the VPC feature. This tunable is undefined by default. VPC is however enabled by default.
βοΈ Runtime Configuration βοΈ
There are a number of sysctl(8) variables available which can be modified during runtime. These values can also be stored in /etc/sysctl.conf in order to automatically set them during the boot process. hw.snd.* are global settings and dev.pcm.* are device specific. runtime tweaking is lowkey the moment β¨
hw.snd.compat_linux_mmapβ Linuxmmap(2)compatibility. The following values are supported (default is0):hw.snd.default_autoβ Automatically assign the default sound unit. The following values are supported (default is1):0β Do not assign the default sound unit automatically.1β Use the best available sound device based on playing and recording capabilities of the device.2β Use the most recently attached device.
hw.snd.default_unitβ Default sound card for systems with multiple sound cards. When usingdevfs(4), the default device for/dev/dsp. Equivalent to a symlink from/dev/dspto/dev/dsp${hw.snd.default_unit}.hw.snd.feeder_eq_exact_rateβ Only certain rates are allowed for precise processing. The default behavior is however to allow sloppy processing for all rates, even the unsupported ones. Enable to toggle this requirement and only allow processing for supported rates.hw.snd.feeder_rate_maxβ Maximum allowable sample rate.hw.snd.feeder_rate_minβ Minimum allowable sample rate.hw.snd.feeder_rate_polyphase_maxβ Adjust to set the maximum number of allowed polyphase entries during the process of building resampling filters. Disabling polyphase resampling has the benefit of reducing memory usage, at the expense of slower and lower quality conversion. Only applicable when the SINC interpolator is used. Default value is183040. Set to0to disable polyphase resampling.hw.snd.feeder_rate_qualityβ Sample rate converter quality. Default value is1, linear interpolation. Available options include:0β Zero Order Hold, ZOH. Very fast, but with poor quality.1β Linear interpolation. Fast, quality is subject to personal preference. Technically the quality is poor however, due to the lack of anti-aliasing filtering.2β Bandlimited SINC interpolator. Implements polyphase banking to boost the conversion speed, at the cost of memory usage, with multiple high quality polynomial interpolators to improve the conversion accuracy. 100% fixed point, 64bit accumulator with 32bit coefficients and high precision sample buffering. Quality values are 100dB stopband, 8 taps and 85% bandwidth.3β Continuation of the bandlimited SINC interpolator, with 100dB stopband, 36 taps and 90% bandwidth as quality values.4β Continuation of the bandlimited SINC interprolator, with 100dB stopband, 164 taps and 97% bandwidth as quality values.
hw.snd.feeder_rate_roundβ Sample rate rounding threshold, to avoid large prime division at the cost of accuracy. All requested sample rates will be rounded to the nearest threshold value. Possible values range between0(disabled) and500. Default is25.hw.snd.latencyβ Configure the buffering latency. Only affects applications that do not explicitly request blocksize / fragments. This tunable provides finer granularity than thehw.snd.latency_profiletunable. Possible values range between0(lowest latency) and10(highest latency).hw.snd.latency_profileβ Define sets of buffering latency conversion tables for thehw.snd.latencytunable. A value of0will use a low and aggressive latency profile which can result in possible underruns if the application cannot keep up with a rapid irq rate, especially during high workload. The default value is1, which is considered a moderate/safe latency profile.hw.snd.vchans_enableβ Global VCHAN setting to enable (1) or disable (0) VCHANs. This setting can be overridden for an individual device by using thedev.pcm.%d.[play|rec].vchanstunables. Default is enabled.hw.snd.report_soft_formatsβ Controls the internal format conversion if it is available transparently to the application software. When disabled or not available, the application will only be able to select formats the device natively supports.hw.snd.report_soft_matrixβ turns on seamless channel matrixing even when the hardware genuinely can't do it. Translation: you can play multichannel streams on a basic stereo sound card and it just works. Lowkey magic β¨hw.snd.verboseβ how chatty the/dev/sndstatdevice is. Higher values = more output, and level four is the highest β that's the one to use when you're reporting a problem. The levels are:0β installed devices and their allocated bus resources.1β the number of playback, record, virtual channels, and flags per device.2β channel information per device, including the channel's current format, speed, and pseudo device statistics like buffer overruns and buffer underruns.3β file names and versions of the currently loaded sound modules.4β various messages intended for debugging.
hw.snd.vpc_0dbβ the default value for sound volume. Crank it up to give yourself more room for attenuation control, or bring it down for more amplification β but bestie, that comes with the possible cost of sound clipping. πhw.snd.vpc_autoresetβ when a channel is closed, the channel volume gets reset to 0db, which means any changes you made to the volume are just gone. Enabling this preserves the volume, at the cost of possible confusion when applications tries to re-open the same device. πhw.snd.vpc_mixer_bypassβ the recommended way to use the VPC feature is to teach applications to use the correctioctl():SNDCTL_DSP_GETPLAYVOL,SNDCTL_DSP_SETPLAYVOL,SNDCTL_DSP_SETRECVOL,SNDCTL_DSP_SETRECVOL. This is however not always possible. Enable this to allow applications to use their own existing mixer logic to control their own channel volume.hw.snd.vpc_resetβ enable it and every channel volume gets restored back to the default value of0db. Fresh start energy π«Άdev.pcm.%d.bitperfectβ enable or disable bitperfect mode. When it's on, channels skip all dsp processing β channel matrixing, rate converting, equalizing, the whole thing. The pure sound stream gets fed directly to the hardware, no notes. If VCHANs are enabled, bitperfect mode will use the VCHAN format/rate as the definitive format/rate target. The recommended way to use bitperfect mode is to disable VCHANs and enable this sysctl. Default is disabled.dev.pcm.%d.[play|rec].vchansβ enable (1) or disable (0) VCHANs. Default is enabled.dev.pcm.%d.[play|rec].vchanformatβ the format for VCHAN mixing. All playback paths get converted to this format before the mixing process begins. By default only 2 channels are enabled. The available options include:s16le:1.0β Mono.s16le:2.0β Stereo, 2 channels (left, right).s16le:2.1β 3 channels (left, right, LFE).s16le:3.0β 3 channels (left, right, rear center).s16le:4.0β Quadraphonic, 4 channels (front/rear left and right).s16le:4.1β 5 channels (4.0 + LFE).s16le:5.0β 5 channels (4.0 + center).s16le:5.1β 6 channels (4.0 + center + LFE).s16le:6.0β 6 channels (4.0 + front/rear center).s16le:6.1β 7 channels (6.0 + LFE).s16le:7.1β 8 channels (4.0 + center + LFE + left and right side).
dev.pcm.%d.[play|rec].vchanmodeβ VCHAN format/rate selection. The available options include:fixedβ channel mixing is done using fixed format/rate. Advanced operations such as digital passthrough will not work. Can be considered as a "legacy" mode. This is the default mode for hardware channels which lack support for digital formats.passthroughβ channel mixing is done using fixed format/rate, but advanced operations such as digital passthrough also work. All channels will produce sound as usual until a digital format playback is requested. When this happens all other channels will be muted and the latest incoming digital format will be allowed to pass through undisturbed. Multiple concurrent digital streams are supported, but the latest stream will take precedence and mute all other streams.adaptiveβ works like the"passthrough"mode, but is a bit smarter, especially for multiple sound channels with different format/rate. When a new channel is about to start, the entire list of virtual channels will be scanned, and the channel with the best format/rate (usually the highest/biggest) will be selected. This ensures that mixing quality depends on the best channel. The downside is that the hardware DMA mode needs to be restarted, which may cause annoying pops or clicks. π
dev.pcm.%d.[play|rec].vchanrateβ the sample rate speed for VCHAN mixing. All playback paths get converted to this sample rate before the mixing process begins.dev.pcm.%d.pollingβ experimental polling mode support where the driver operates by querying the device state on each tick using acallout(9)mechanism. Disabled by default and currently only available for a few device drivers.
π Statistics π
Channel statistics are only kept while the device is open. So for situations involving overruns and underruns, consider the output while the errant application is open and running. Timing is literally everything bestie β°
ποΈ IOCTL Support ποΈ
The driver supports most of the OSS ioctl() functions, and most applications work unmodified. A few differences exist, though: memory mapped playback is supported natively and in Linux emulation, but memory mapped recording is not β that's a VM system design thing. As a consequence, some applications may need to be recompiled with a slightly modified audio module. See <sys/soundcard.h> for a complete list of the supported ioctl() functions. π«‘
π FILES π
The sound drivers may create the following device nodes:
/dev/dsp%dβ Audio device. The number represents the unit number of the device./dev/dspβ Alias of/dev/dsp${hw.snd.default_unit}. Available only ifhw.snd.basename_cloneis set./dev/sndstatβ Current sound status, including all channels and drivers.
All sound devices are listed in /dev/sndstat. Additional messages are sometimes recorded when the device is probed and attached β you can view those with the dmesg(8) utility. π
π EXAMPLES π
Use the sound metadriver to load all sound bridge device drivers at once β for example if it's unclear which the correct driver to use is:
kldload snd_driver
Load a specific bridge device driver, in this case the Intel High Definition Audio driver:
kldload snd_hda
Check the status of all detected sound devices:
cat /dev/sndstat
Change the default sound device, in this case to the second device. This is handy if there are multiple sound devices available:
mixer -d pcm1
π©Ί DIAGNOSTICS π©Ί
pcm%d:play:%d:dsp%d.p%d: play interrupt timeout, channel deadβ the hardware does not generate interrupts to serve incoming (play) or outgoing (record) data. She's not okay πunsupported subdevice XXβ a device node is not created properly.
π SEE ALSO π
devfs(4), snd_ai2s(4), snd_als4000(4), snd_atiixp(4), snd_cmi(4), snd_cs4281(4), snd_csa(4), snd_davbus(4), snd_emu10k1(4), snd_emu10kx(4), snd_envy24(4), snd_envy24ht(4), snd_es137x(4), snd_fm801(4), snd_hda(4), snd_hdsp(4), snd_hdspe(4), snd_ich(4), snd_maestro3(4), snd_neomagic(4), snd_solo(4), snd_spicds(4), snd_t4dwave(4), snd_uaudio(4), snd_via8233(4), snd_via82c686(4), snd_vibes(4), device.hints(5), loader.conf(5), dmesg(8), kldload(8), mixer(8), sysctl(8)
- Cookbook formulae for audio EQ biquad filter coefficients (Audio-EQ-Cookbook.txt), by Robert Bristow-Johnson, https://www.musicdsp.org/en/latest/Filters/197-rbj-audio-eq-cookbook.html.
- Julius O'Smith's Digital Audio Resampling, http://ccrma.stanford.edu/~jos/resample/.
- Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo, http://yehar.com/blog/wp-content/uploads/2009/08/deip.pdf.
- The OSS API, http://www.opensound.com/pguide/oss.pdf.
π¦ HISTORY π¦
The sound device driver first appeared in FreeBSD 2.2.6 as pcm, written by Luigi Rizzo. It was later rewritten in FreeBSD 4.0 by Cameron Grant. The API evolved from the VOXWARE standard, which later became the OSS standard. Glow-up of the century ngl π
π«Ά AUTHORS π«Ά
Luigi Rizzo <luigi@iet.unipi.it> initially wrote the pcm device driver and this manual page. Cameron Grant <gandalf@vilnya.demon.co.uk> later revised the device driver for FreeBSD 4.0. Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp> revised this manual page. It was then rewritten for FreeBSD 5.2. Team effort fr fr π
π BUGS π
Some features of your sound card (e.g., global volume control) might not be supported on all devices. Not everyone gets the full feature set, and that's just how it is. π
Some audio devices might refuse to work properly unless the sample rate is configured the same for both recording and playback, even if only simplex is used. See the dev.pcm.%d.[play|rec].vchanrate sysctls. So yeah β matching rates, or she simply won't cooperate. π€
and that's the whole page bestie!! πβ¨ thanks for reading all the way through, ily π«Ά this one's from the Debian crew β dated February 15, 2025, and it's page SOUND(4) of your friendly neighbourhood manual set. go make some noise π π§
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2009-2011 Joel Dahl <joel@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms