2 .\" Copyright (c) 2009-2011 Joel Dahl <joel@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 PCM audio device infrastructure
37 To compile this driver into the kernel, place the following line in your
38 kernel configuration file:
39 .Bd -ragged -offset indent
45 driver is the main component of the
48 It works in conjunction with a bridge device driver on supported devices
49 and provides PCM audio record and playback once it attaches.
50 Each bridge device driver supports a specific set of audio chipsets and
51 needs to be enabled together with the
54 PCI and ISA PnP audio devices identify themselves so users are usually not
55 required to add anything to
56 .Pa /boot/device.hints .
58 Some of the main features of the
60 driver are: multichannel audio, per-application
61 volume control, dynamic mixing through virtual sound channels, true full
62 duplex operation, bit perfect audio, rate conversion and low latency
67 driver is enabled by default, along with several bridge device drivers.
68 Those not enabled by default can be loaded during runtime with
72 The following bridge device drivers are available:
76 .Xr snd_ai2s 4 (enabled by default on powerpc)
82 .Xr snd_cmi 4 (enabled by default on amd64, i386)
86 .Xr snd_csa 4 (enabled by default on amd64, i386)
88 .Xr snd_davbus 4 (enabled by default on powerpc)
92 .Xr snd_emu10kx 4 (enabled by default on amd64, i386)
98 .Xr snd_es137x 4 (enabled by default on amd64, i386)
102 .Xr snd_hda 4 (enabled by default on amd64, i386)
106 .Xr snd_ich 4 (enabled by default on amd64, i386)
116 .Xr snd_uaudio 4 (auto-loaded on device plug)
118 .Xr snd_via8233 4 (enabled by default on amd64, i386)
125 Refer to the manual page for each bridge device driver for driver specific
126 settings and information.
128 In general, the module
137 or from the command line using the
140 Options which can be specified in
141 .Pa /boot/loader.conf
143 .Bl -tag -width ".Va snd_driver_load" -offset indent
144 .It Va snd_driver_load
148 this option loads all available drivers.
153 only the Intel High Definition Audio bridge device driver and dependent
154 modules will be loaded.
159 load driver for card/chipset foo.
162 To define default values for the different mixer channels,
163 set the channel to the preferred value using hints, e.g.:
164 .Va hint.pcm.0.line Ns = Ns Qq Li 0 .
165 This will mute the input channel per default.
166 .Ss Multichannel Audio
167 Multichannel audio, popularly referred to as
169 is supported and enabled by default.
172 multichannel matrix processor supports up to 18 interleaved channels, but the
173 limit is currently set to 8 channels (as commonly used for 7.1 surround sound).
174 The internal matrix mapping can handle reduction, expansion or
175 re-routing of channels.
176 This provides a base interface for related multichannel
179 Multichannel audio works both with and without VCHANs.
181 Most bridge device drivers are still missing multichannel matrixing
182 support, but in most cases this should be trivial to implement.
184 .Va dev.pcm.%d.[play|rec].vchanformat
186 to adjust the number of channels used.
187 The current multichannel interleaved structure and arrangement was
188 implemented by inspecting various popular UNIX applications.
189 There were no single standard, so much care has been taken to try
190 to satisfy each possible scenario, despite the fact that each
191 application has its own conflicting standard.
193 The Parametric Software Equalizer (EQ) enables the use of
195 controls (bass and treble).
196 Commonly used for ear-candy or frequency compensation due to the vast
197 difference in hardware quality.
198 EQ is disabled by default, but can be enabled with the
202 Each device can optionally support more playback and recording channels
203 than physical hardware provides by using
206 VCHAN options can be configured via the
208 interface but can only be manipulated while the device is inactive.
211 supports independent and individual volume controls for each active
212 application, without touching the master
215 This is sometimes referred to as Volume Per Channel (VPC).
216 The VPC feature is enabled by default.
218 The following loader tunables are used to set driver configuration at the
220 prompt before booting the kernel, or they can be stored in
221 .Pa /boot/loader.conf
222 in order to automatically set them before booting the kernel.
223 It is also possible to use
225 to change these tunables before loading the
228 The following tunables can not be changed during runtime using
230 .Bl -tag -width indent
231 .It Va hint.pcm.%d.eq
232 Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer.
233 Requires a driver reload if changed.
234 Enabling this will make bass and treble controls appear in mixer applications.
235 This tunable is undefined by default.
236 Equalizing is disabled by default.
237 .It Va hint.pcm.%d.vpc
238 Set to 1 or 0 to explicitly enable (1) or disable (0) the VPC feature.
239 This tunable is undefined by default.
240 VPC is however enabled by default.
242 .Ss Runtime Configuration
243 There are a number of
245 variables available which can be modified during runtime.
246 These values can also be stored in
248 in order to automatically set them during the boot process.
250 are global settings and
253 .Bl -tag -width indent
254 .It Va hw.snd.compat_linux_mmap
258 The following values are supported (default is 0):
261 Force disabling/denying PROT_EXEC
265 Auto detect proc/ABI type, allow
267 for Linux applications, and deny for everything else.
269 Always allow PROT_EXEC page mappings.
271 .It Va hw.snd.default_auto
272 Automatically assign the default sound unit.
273 The following values are supported (default is 1):
276 Do not assign the default sound unit automatically.
278 Use the best available sound device based on playing and recording
279 capabilities of the device.
281 Use the most recently attached device.
283 .It Va hw.snd.default_unit
284 Default sound card for systems with multiple sound cards.
287 the default device for
289 Equivalent to a symlink from
292 .Pa /dev/dsp Ns Va ${hw.snd.default_unit} .
293 .It Va hw.snd.feeder_eq_exact_rate
294 Only certain rates are allowed for precise processing.
295 The default behavior is however to allow sloppy processing for all rates,
296 even the unsupported ones.
297 Enable to toggle this requirement and only allow processing for supported
299 .It Va hw.snd.feeder_rate_max
300 Maximum allowable sample rate.
301 .It Va hw.snd.feeder_rate_min
302 Minimum allowable sample rate.
303 .It Va hw.snd.feeder_rate_polyphase_max
304 Adjust to set the maximum number of allowed polyphase entries during the
305 process of building resampling filters.
306 Disabling polyphase resampling has the benefit of reducing memory usage, at
307 the expense of slower and lower quality conversion.
308 Only applicable when the SINC interpolator is used.
309 Default value is 183040.
310 Set to 0 to disable polyphase resampling.
311 .It Va hw.snd.feeder_rate_quality
312 Sample rate converter quality.
313 Default value is 1, linear interpolation.
314 Available options include:
317 Zero Order Hold, ZOH.
318 Very fast, but with poor quality.
320 Linear interpolation.
321 Fast, quality is subject to personal preference.
322 Technically the quality is poor however, due to the lack of anti-aliasing
325 Bandlimited SINC interpolator.
326 Implements polyphase banking to boost the conversion speed, at the cost of
327 memory usage, with multiple high quality polynomial interpolators to improve
328 the conversion accuracy.
329 100% fixed point, 64bit accumulator with 32bit coefficients and high precision
331 Quality values are 100dB stopband, 8 taps and 85% bandwidth.
333 Continuation of the bandlimited SINC interpolator, with 100dB stopband, 36
334 taps and 90% bandwidth as quality values.
336 Continuation of the bandlimited SINC interprolator, with 100dB stopband, 164
337 taps and 97% bandwidth as quality values.
339 .It Va hw.snd.feeder_rate_round
340 Sample rate rounding threshold, to avoid large prime division at the
342 All requested sample rates will be rounded to the nearest threshold value.
343 Possible values range between 0 (disabled) and 500.
345 .It Va hw.snd.latency
346 Configure the buffering latency.
347 Only affects applications that do not explicitly request
348 blocksize / fragments.
349 This tunable provides finer granularity than the
350 .Va hw.snd.latency_profile
352 Possible values range between 0 (lowest latency) and 10 (highest latency).
353 .It Va hw.snd.latency_profile
354 Define sets of buffering latency conversion tables for the
357 A value of 0 will use a low and aggressive latency profile which can result
358 in possible underruns if the application cannot keep up with a rapid irq
359 rate, especially during high workload.
360 The default value is 1, which is considered a moderate/safe latency profile.
361 .It Va hw.snd.maxautovchans
362 Global VCHAN setting that only affects devices with at least one playback or
363 recording channel available.
364 The sound system will dynamically create up to this many VCHANs.
367 if no VCHANs are desired.
368 Maximum value is 256.
369 .It Va hw.snd.report_soft_formats
370 Controls the internal format conversion if it is
371 available transparently to the application software.
372 When disabled or not available, the application will
373 only be able to select formats the device natively supports.
374 .It Va hw.snd.report_soft_matrix
375 Enable seamless channel matrixing even if the hardware does not support it.
376 Makes it possible to play multichannel streams even with a simple stereo
378 .It Va hw.snd.verbose
379 Level of verbosity for the
382 Higher values include more output and the highest level,
383 four, should be used when reporting problems.
384 Other options include:
387 Installed devices and their allocated bus resources.
389 The number of playback, record, virtual channels, and
392 Channel information per device including the channel's
393 current format, speed, and pseudo device statistics such as
394 buffer overruns and buffer underruns.
396 File names and versions of the currently loaded sound modules.
398 Various messages intended for debugging.
400 .It Va hw.snd.vpc_0db
404 Increase to give more room for attenuation control.
405 Decrease for more amplification, with the possible cost of sound clipping.
406 .It Va hw.snd.vpc_autoreset
407 When a channel is closed the channel volume will be reset to 0db.
408 This means that any changes to the volume will be lost.
409 Enabling this will preserve the volume, at the cost of possible confusion
410 when applications tries to re-open the same device.
411 .It Va hw.snd.vpc_mixer_bypass
412 The recommended way to use the VPC feature is to teach applications to use the
415 .Dv SNDCTL_DSP_GETPLAYVOL , SNDCTL_DSP_SETPLAYVOL ,
416 .Dv SNDCTL_DSP_SETRECVOL , SNDCTL_DSP_SETRECVOL .
417 This is however not always possible.
418 Enable this to allow applications to use their own existing mixer logic
419 to control their own channel volume.
420 .It Va hw.snd.vpc_reset
421 Enable to restore all channel volumes back to the default value of 0db.
422 .It Va dev.pcm.%d.bitperfect
423 Enable or disable bitperfect mode.
424 When enabled, channels will skip all dsp processing, such as channel
425 matrixing, rate converting and equalizing.
428 stream will be fed directly to the hardware.
429 If VCHANs are enabled, the bitperfect mode will use the VCHAN format/rate as
430 the definitive format/rate target.
431 The recommended way to use bitperfect mode is to disable VCHANs and enable this
434 .It Va dev.pcm.%d.[play|rec].vchans
435 The current number of VCHANs allocated per device.
436 This can be set to preallocate a certain number of VCHANs.
437 Setting this value to
439 will disable VCHANs for this device.
440 .It Va dev.pcm.%d.[play|rec].vchanformat
441 Format for VCHAN mixing.
442 All playback paths will be converted to this format before the mixing
444 By default only 2 channels are enabled.
445 Available options include:
450 Stereo, 2 channels (left, right).
452 3 channels (left, right, LFE).
454 3 channels (left, right, rear center).
456 Quadraphonic, 4 channels (front/rear left and right).
458 5 channels (4.0 + LFE).
460 5 channels (4.0 + center).
462 6 channels (4.0 + center + LFE).
464 6 channels (4.0 + front/rear center).
466 7 channels (6.0 + LFE).
468 8 channels (4.0 + center + LFE + left and right side).
470 .It Va dev.pcm.%d.[play|rec].vchanmode
471 VCHAN format/rate selection.
472 Available options include:
475 Channel mixing is done using fixed format/rate.
476 Advanced operations such as digital passthrough will not work.
477 Can be considered as a
480 This is the default mode for hardware channels which lack support for digital
483 Channel mixing is done using fixed format/rate, but advanced operations such
484 as digital passthrough also work.
485 All channels will produce sound as usual until a digital format playback is
487 When this happens all other channels will be muted and the latest incoming
488 digital format will be allowed to pass through undisturbed.
489 Multiple concurrent digital streams are supported, but the latest stream will
490 take precedence and mute all other streams.
494 mode, but is a bit smarter, especially for
497 channels with different format/rate.
498 When a new channel is about to start, the entire list of virtual channels will
499 be scanned, and the channel with the best format/rate (usually the
500 highest/biggest) will be selected.
501 This ensures that mixing quality depends on the best channel.
502 The downside is that the hardware DMA mode needs to be restarted, which may
503 cause annoying pops or clicks.
505 .It Va dev.pcm.%d.[play|rec].vchanrate
506 Sample rate speed for VCHAN mixing.
507 All playback paths will be converted to this sample rate before the mixing
509 .It Va dev.pcm.%d.polling
510 Experimental polling mode support where the driver operates by querying the
511 device state on each tick using a
514 Disabled by default and currently only available for a few device drivers.
517 Channel statistics are only kept while the device is open.
518 So with situations involving overruns and underruns, consider the output
519 while the errant application is open and running.
521 The driver supports most of the OSS
523 functions, and most applications work unmodified.
524 A few differences exist, while memory mapped playback is
525 supported natively and in Linux emulation, memory mapped recording is not due
527 As a consequence, some applications may need to be recompiled
528 with a slightly modified audio module.
531 for a complete list of the supported
537 drivers may create the following device nodes:
539 .Bl -tag -width ".Pa /dev/sndstat" -compact
542 The number represents the unit number of the device.
545 .Pa /dev/dsp${hw.snd.default_unit} .
547 .Pa hw.snd.basename_clone
552 status, including all channels and drivers.
560 Additional messages are sometimes recorded when the
561 device is probed and attached, these messages can be viewed with the
565 Use the sound metadriver to load all
567 bridge device drivers at once
568 (for example if it is unclear which the correct driver to use is):
570 .Dl kldload snd_driver
572 Load a specific bridge device driver, in this case the Intel
573 High Definition Audio driver:
577 Check the status of all detected
583 Change the default sound device, in this case to the second device.
584 This is handy if there are multiple
591 .It pcm%d:play:%d:dsp%d.p%d: play interrupt timeout, channel dead
592 The hardware does not generate interrupts to serve incoming (play)
593 or outgoing (record) data.
594 .It unsupported subdevice XX
595 A device node is not created properly.
621 .Xr snd_via82c686 4 ,
631 .%T "Cookbook formulae for audio EQ biquad filter coefficients (Audio-EQ-Cookbook.txt), by Robert Bristow-Johnson"
632 .%U "https://www.musicdsp.org/en/latest/Filters/197-rbj-audio-eq-cookbook.html"
635 .%T "Julius O'Smith's Digital Audio Resampling"
636 .%U "http://ccrma.stanford.edu/~jos/resample/"
639 .%T "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo"
640 .%U "http://yehar.com/blog/wp-content/uploads/2009/08/deip.pdf"
644 .%U "http://www.opensound.com/pguide/oss.pdf"
649 device driver first appeared in
660 The API evolved from the VOXWARE
661 standard which later became OSS standard.
664 .An Luigi Rizzo Aq Mt luigi@iet.unipi.it
667 device driver and this manual page.
668 .An Cameron Grant Aq Mt gandalf@vilnya.demon.co.uk
669 later revised the device driver for
671 .An Seigo Tanimura Aq Mt tanimura@r.dl.itc.u-tokyo.ac.jp
672 revised this manual page.
673 It was then rewritten for
676 Some features of your sound card (e.g., global volume control) might not
677 be supported on all devices.