2 .\" Copyright (c) 1998, Luigi Rizzo
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
37 PCM audio device infrastructure
39 To compile this driver into the kernel, place the following line in your
40 kernel configuration file:
41 .Bd -ragged -offset indent
45 Non-PnP sound cards require the following lines in
47 .Bd -literal -offset indent
51 hint.pcm.0.flags="0x0"
56 driver provides support for
58 audio play and capture.
59 This driver also supports various
64 sound cards, AC97 mixer and High Definition Audio.
67 driver attaches, supported devices provide audio record and
71 sound system provides dynamic mixing
75 True full duplex operation is available on most sound cards.
77 If the sound card is supported by a bridge driver, the
79 driver works in conjunction with the bridge driver.
81 Apart from the usual parameters, the flags field is used to specify
84 channel (generally used for capture in full duplex cards).
85 Flags are set to 0 for cards not using a secondary
87 channel, or to 0x10 + C to specify channel C.
89 The driver does its best to recognize the installed hardware and drive
90 it correctly so the user is not required to add several lines in
91 .Pa /boot/device.hints .
97 cards this is actually easy
98 since they identify themselves.
101 cards, the driver looks for
103 cards at addresses 0x530 and 0x604 (unless overridden
105 .Pa /boot/device.hints ) .
107 In general, the module
116 or from the command line using the
119 Options which can be specified in
120 .Pa /boot/loader.conf
122 .Bl -tag -width ".Va snd_emu10k1_load" -offset indent
123 .It Va snd_driver_load
127 this option loads all available drivers.
128 .It Va snd_emu10k1_load
132 only the SoundBlaster 5.1 driver and dependent modules will be loaded.
137 load driver for card/chipset foo.
140 To define default values for the different mixer channels,
141 set the channel to the preferred value using hints, e.g.:
142 .Va hint.pcm.0.line Ns = Ns Qq Li 0 .
143 This will mute the input channel per default.
144 .Ss Multichannel Audio
145 Multichannel audio, popularly referred to as
147 is supported and enabled by default.
148 The FreeBSD multichannel matrix processor supports up to 18 interleaved
149 channels, but the limit is currently set to 8 channels (as commonly used
150 for 7.1 surround sound).
151 The internal matrix mapping can handle reduction, expansion or
152 re-routing of channels.
153 This provides a base interface for related multichannel
156 Multichannel audio works both with and without
158 Most bridge device drivers are still missing multichannel matrixing support
159 , but in most cases this should be trivial to implement.
161 .Va dev.pcm.%d.[play|rec].vchanformat
163 to adjust the number of channels used.
164 The current multichannel interleaved structure and arrangement was
165 implemented by inspecting various popular UNIX applications.
166 There were no single standard, so much care has been taken to try
167 to satisfy each possible scenario, despite the fact that each
168 application has its own conflicting standard.
170 The Parametric Software Equlizer (EQ) enables the use of
172 controls (bass and treble).
173 Commonly used for ear-candy or frequency compensation due to the vast
174 difference in hardware quality.
175 EQ is disabled by default, but can be enabled with the
176 .Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq
179 Each device can optionally support more playback and recording channels
180 than physical hardware provides by using
185 options can be configured via the
187 interface but can only be manipulated while the device is inactive.
189 FreeBSD supports independent and individual volume controls for each active
190 application, without touching the master
193 This is sometimes referred to as Volume Per Channel (VPC).
196 feature is enabled by default.
198 The following loader tunables are used to set driver configuration at the
200 prompt before booting the kernel, or they can be stored in
201 .Pa /boot/loader.conf
202 in order to automatically set them before booting the kernel.
203 It is also possible to use
205 to change these tunables before loading the
208 The following tunables can not be changed during runtime using
210 .Bl -tag -width indent
211 .It Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq
212 Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer.
213 Requires a driver reload if changed.
214 Enabling this will make bass and treble controls appear in mixer applications.
215 This tunable is undefined by default.
216 Equalizing is disabled by default.
217 .It Va hint.pcm. Ns Ao Ar X Ac Ns Va .vpc
218 Set to 1 or 0 to explicitly enable (1) or disable (0) the
221 This tunable is undefined by default.
223 is however enabled by default.
225 .Ss Runtime Configuration
226 There are a number of
228 variables available which can be modified during runtime.
229 These values can also be stored in
231 in order to automatically set them during the boot process.
233 are global settings and
236 .Bl -tag -width indent
237 .It Va hw.snd.compat_linux_mmap
241 The following values are supported (default is 0):
244 Force disabling/denying PROT_EXEC
248 Auto detect proc/ABI type, allow
250 for Linux applications, and deny for everything else.
252 Always allow PROT_EXEC page mappings.
254 .It Va hw.snd.default_auto
255 Enable to automatically assign default sound unit to the most recent
257 .It Va hw.snd.default_unit
258 Default sound card for systems with multiple sound cards.
261 the default device for
263 Equivalent to a symlink from
266 .Pa /dev/dsp Ns Va ${hw.snd.default_unit} .
267 .It Va hw.snd.feeder_eq_exact_rate
268 Only certain rates are allowed for precise processing.
269 The default behavior is however to allow sloppy processing for all rates,
270 even the unsupported ones.
271 Enable to toggle this requirement and only allow processing for supported
273 .It Va hw.snd.feeder_rate_max
274 Maximum allowable sample rate.
275 .It Va hw.snd.feeder_rate_min
276 Minimum allowable sample rate.
277 .It Va hw.snd.feeder_rate_polyphase_max
278 Adjust to set the maximum number of allowed polyphase entries during the
279 process of building resampling filters.
280 Disabling polyphase resampling has the benefit of reducing memory usage, at
281 the expense of slower and lower quality conversion.
282 Only applicable when the SINC interpolator is used.
283 Default value is 183040.
284 Set to 0 to disable polyphase resampling.
285 .It Va hw.snd.feeder_rate_quality
286 Sample rate converter quality.
287 Default value is 1, linear interpolation.
288 Available options include:
291 Zero Order Hold, ZOH.
292 Very fast, but with poor quality.
294 Linear interpolation.
295 Fast, quality is subject to personal preference.
296 Technically the quality is poor however, due to the lack of anti-aliasing
299 Bandlimited SINC interpolator.
300 Implements polyphase banking to boost the conversion speed, at the cost of
301 memory usage, with multiple high quality polynomial interpolators to improve
302 the conversion accuracy.
303 100% fixed point, 64bit accumulator with 32bit coefficients and high precision
305 Quality values are 100dB stopband, 8 taps and 85% bandwidth.
307 Continuation of the bandlimited SINC interpolator, with 100dB stopband, 36
308 taps and 90% bandwidth as quality values.
310 Continuation of the bandlimited SINC inteprolator, with 100dB stopband, 164
311 taps and 97% bandwidth as quality values.
313 .It Va hw.snd.feeder_rate_round
314 Sample rate rounding threshold, to avoid large prime division at the
316 All requested sample rates will be rounded to the nearest threshold value.
317 Possible values range between 0 (disabled) and 500.
319 .It Va hw.snd.latency
320 Configure the buffering latency.
321 Only affects applications that do not explicitly request
322 blocksize / fragments.
323 This tunable provides finer granularity than the
324 .Va hw.snd.latency_profile
326 Possible values range between 0 (lowest latency) and 10 (highest latency).
327 .It Va hw.snd.latency_profile
328 Define sets of buffering latency conversion tables for the
331 A value of 0 will use a low and aggressive latency profile which can result
332 in possible underruns if the application cannot keep up with a rapid irq
333 rate, especially during high workload.
334 The default value is 1, which is considered a moderate/safe latency profile.
335 .It Va hw.snd.maxautovchans
338 setting that only affects devices with at least one playback or recording channel available.
339 The sound system will dynamically create up to this many
346 Maximum value is 256.
347 .It Va hw.snd.report_soft_formats
348 Controls the internal format conversion if it is
349 available transparently to the application software.
350 When disabled or not available, the application will
351 only be able to select formats the device natively supports.
352 .It Va hw.snd.report_soft_matrix
353 Enable seamless channel matrixing even if the hardware does not support it.
354 Makes it possible to play multichannel streams even with a simple stereo
356 .It Va hw.snd.verbose
357 Level of verbosity for the
360 Higher values include more output and the highest level,
361 four, should be used when reporting problems.
362 Other options include:
365 Installed devices and their allocated bus resources.
367 The number of playback, record, virtual channels, and
370 Channel information per device including the channel's
371 current format, speed, and pseudo device statistics such as
372 buffer overruns and buffer underruns.
374 File names and versions of the currently loaded sound modules.
376 Various messages intended for debugging.
378 .It Va hw.snd.vpc_0db
382 Increase to give more room for attenuation control.
383 Decrease for more amplification, with the possible cost of sound clipping.
384 .It Va hw.snd.vpc_autoreset
385 When a channel is closed the channel volume will be reset to 0db.
386 This means that any changes to the volume will be lost.
387 Enabling this will preserve the volume, at the cost of possible confusion
388 when applications tries to re-open the same device.
389 .It Va hw.snd.vpc_mixer_bypass
390 The recommended way to use the
392 feature is to teach applications to use
395 .Dv SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL,
396 .Dv SNDCTL_DSP_SETRECVOL, SNDCTL_DSP_SETRECVOL.
397 This is however not always possible.
398 Enable this to allow applications to use their own existing mixer logic
399 to control their own channel volume.
400 .It Va hw.snd.vpc_reset
401 Enable to restore all channel volumes back to the default value of 0db.
402 .It Va dev.pcm.%d.bitperfect
403 Enable or disable bitperfect mode.
404 When enabled, channels will skip all dsp processing, such as channel
405 matrixing, rate converting and equalizing.
408 stream will be fed directly to the hardware.
411 are enabled, the bitperfect mode will use the
413 format/rate as the definitive format/rate target.
414 The recommended way to use bitperfect mode is to disable
416 and enable this sysctl.
418 .It Va dev.pcm.%d.[play|rec].vchans
419 The current number of
421 allocated per device.
422 This can be set to preallocate a certain number of
424 Setting this value to
429 .It Va dev.pcm.%d.[play|rec].vchanformat
433 All playback paths will be converted to this format before the mixing
435 By default only 2 channels are enabled.
436 Available options include:
441 Stereo, 2 channels (left, right).
443 3 channels (left, right, LFE).
445 3 channels (left, right, rear center).
447 Quadraphonic, 4 channels (front/rear left and right).
449 5 channels (4.0 + LFE).
451 5 channels (4.0 + center).
453 6 channels (4.0 + center + LFE).
455 6 channels (4.0 + front/rear center).
457 7 channels (6.0 + LFE).
459 8 channels (4.0 + center + LFE + left and right side).
461 .It Va dev.pcm.%d.[play|rec].vchanmode
463 format/rate selection.
464 Available options include:
467 Channel mixing is done using fixed format/rate.
468 Advanced operations such as digital passthrough will not work.
469 Can be considered as a
472 This is the default mode for hardware channels which lack support for digital
475 Channel mixing is done using fixed format/rate, but advanced operations such
476 as digital passthrough also work.
477 All channels will produce sound as usual until a digital format playback is
479 When this happens all other channels will be muted and the latest incoming
480 digital format will be allowed to pass through undisturbed.
481 Multiple concurrent digital streams are supported, but the latest stream will
482 take precedence and mute all other streams.
486 mode, but is a bit smarter, especially for
489 channels with different format/rate.
490 When a new channel is about to start, the entire list of virtual channels will
491 be scanned, and the channel with the best format/rate (usually the
492 highest/biggest) will be selected.
493 This ensures that mixing quality depends on the best channel.
494 The downside is that the hardware DMA mode needs to be restarted, which may
495 cause annoying pops or clicks.
497 .It Va dev.pcm.%d.[play|rec].vchanrate
498 Sample rate speed for
501 All playback paths will be converted to this sample rate before the mixing
503 .It Va dev.pcm.%d.polling
504 Experimental polling mode support where the driver operates by querying the
505 device state on each tick using a
508 Disabled by default and currently only available for a few device drivers.
510 .Ss Recording Channels
511 On devices that have more than one recording source (ie: mic and line),
512 there is a corresponding
516 Channel statistics are only kept while the device is open.
517 So with situations involving overruns and underruns, consider the output
518 while the errant application is open and running.
520 The driver supports most of the
523 functions, and most applications work unmodified.
524 A few differences exist, while memory mapped playback is
525 supported natively and in
527 emulation, memory mapped recording is
531 As a consequence, some applications may need to be recompiled
532 with a slightly modified audio module.
535 for a complete list of the supported
541 drivers may create the following
544 .Bl -tag -width ".Pa /dev/audio%d.%d" -compact
545 .It Pa /dev/audio%d.%d
546 Sparc-compatible audio device.
548 Digitized voice device.
549 .It Pa /dev/dspW%d.%d
552 but 16 bits per sample.
553 .It Pa /dev/dsp%d.p%d
555 .It Pa /dev/dsp%d.r%d
557 .It Pa /dev/dsp%d.vp%d
558 Virtual playback channel.
559 .It Pa /dev/dsp%d.vr%d
560 Virtual recording channel.
564 status, including all channels and drivers.
567 The first number in the device node
568 represents the unit number of the
576 Additional messages are sometimes recorded when the
577 device is probed and attached, these messages can be viewed with the
581 The above device nodes are only created on demand through the dynamic
584 Users are strongly discouraged to access them directly.
585 For specific sound card access, please instead use
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.
626 .Xr snd_via82c686 4 ,
635 .%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert Bristow-Johnson"
636 .%O "http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt"
639 .%T "Julius O'Smith's Digital Audio Resampling"
640 .%O "http://ccrma.stanford.edu/~jos/resample/"
643 .%T "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo"
644 .%O "http://www.student.oulu.fi/~oniemita/dsp/deip.pdf"
648 .%O "http://www.opensound.com/pguide/oss.pdf"
653 device driver first appeared in
664 The API evolved from the VOXWARE
665 standard which later became OSS standard.
668 .An Luigi Rizzo Aq luigi@iet.unipi.it
671 device driver and this manual page.
672 .An Cameron Grant Aq gandalf@vilnya.demon.co.uk
673 later revised the device driver for
675 .An Seigo Tanimura Aq tanimura@r.dl.itc.u-tokyo.ac.jp
676 revised this manual page.
677 It was then rewritten for
680 Some features of your sound card (e.g., global volume control) might not
681 be supported on all devices.