Reference

sndctl(8)

list and modify soundcard properties

NAME

sndctl – list and modify soundcard properties

SYNOPSIS

sndctl [--libxo] [-f device] [-hov] [control[=value] ...]

DESCRIPTION

The sndctl utility is used to set and display sound card properties, using a control-driven interface, in order to filter and/or set specific properties.

The options are as follows:

--libxo

Generate output via libxo(3) in a selection of different human and machine readable formats. See xo_options(7) for details on command line arguments.

-f device

Choose a specific audio device (see FILES). Userland devices (e.g those registered by virtual_oss(8) can also be selected.

-h

Print a help message.

-o

Print values in a format suitable for use inside scripts.

-v

Run in verbose mode. This option will print all of the device's channel properties.

The device controls are as follows:

NameTypeRead/WriteAction
nameStringReadDevice name
descStringReadDevice description
statusStringReadDevice status
devnodeStringReadDevice node
from_userBooleanReadUserland device
unitNumberReadDevice unit
capsStringReadDevice OSS capabitilies
bitperfectBooleanRead/WriteBit-perfect mode enabled
autoconvBooleanRead/WriteAuto-conversions enabled
realtimeBooleanRead/WriteReal-time mode enabled
eqBooleanRead/WriteEqualization enabled
eq_preampStringRead/WriteEqualization preamp value (in dB)
playGroupReadPlayback properties
play.formatStringRead/WritePlayback format
play.rateNumberRead/WritePlayback sample rate
play.vchansBooleanRead/WritePlayback VCHANs (virtual channels) enabled
play.min_rateNumberReadMinimum playback sample rate
play.max_rateNumberReadMaximum playback sample rate
play.min_chansNumberReadNatively supported minimum playback sample channels
play.max_chansNumberReadNatively supported maximum playback sample channels
play.formatsStringReadNatively supported playback formats
recGroupReadRecording properties
rec.formatStringRead/WriteRecording format
rec.rateNumberRead/WriteRecording sample rate
rec.vchansBooleanRead/WriteRecording VCHANs (virtual channels) enabled
rec.min_rateNumberReadMinimum recording sample rate
rec.max_rateNumberReadMaximum recording sample rate
rec.min_chansNumberReadNatively supported minimum recording sample channels
rec.max_chansNumberReadNatively supported maximum recording sample channels
rec.formatsStringReadNatively supported recording formats

The play.format, play.rate, rec.format and rec.rate controls will be read-only if VCHANs are disabled.

The device channel controls are as follows:

NameTypeRead/WriteAction
nameStringReadChannel name
parentchanStringReadParent (primary) channel name
unitNumberReadChannel unit
capsStringReadChannel OSS capabilities
latencyNumberReadChannel latency
formatStringReadChannel format
rateNumberReadChannel sample rate
pidNumberReadPID of process consuming channel
procStringReadName of process consuming channel
interruptsNumberReadNumber of interrupts since channel was opened
xrunsNumberReadNumber of playback underruns/recoring overruns
feedcountNumberReadNumber of bytes fed to channel
volumeVolumeReadChannel left-right volume in normalized form (0.00 to 1.00).
hwbufGroupReadHardware buffer properties
hwbuf.formatStringReadHardware buffer format
hwbuf.rateStringReadHardware buffer sample rate
hwbuf.size_bytesNumberReadHardware buffer size in bytes
hwbuf.size_framesNumberReadHardware buffer size in frames
hwbuf.blkszNumberReadHardware buffer block size
hwbuf.blkcntNumberReadHardware buffer block count
hwbuf.freeNumberReadHardware buffer free space in bytes
hwbuf.readyNumberReadHardware buffer ready space in bytes
swbufGroupReadSoftware buffer properties
swbuf.formatStringReadSoftware buffer format
swbuf.rateStringReadSoftware buffer sample rate
swbuf.size_bytesNumberReadSoftware buffer size in bytes
swbuf.size_framesNumberReadSoftware buffer size in frames
swbuf.blkszNumberReadSoftware buffer block size
swbuf.blkcntNumberReadSoftware buffer block count
swbuf.freeNumberReadSoftware buffer free space in bytes
swbuf.readyNumberReadSoftware buffer ready space in bytes
feederchainStringReadChannel feeder chain

FILES

/dev/dsp

The default audio device.

/dev/dspX

The audio device file, where X is the unit of the device, for example /dev/dsp0.

EXAMPLES

Disable auto-conversions and enable realtime mode to get as low latencies as possible:

$ sndctl autoconv=0 realtime=1

Set the playback sample format to 2-channel signed 24-bit low endian, and sample rate to 48000 Hz:

$ sndctl play.format=s24le:2.0 play.rate=48000

List the PIDs and process names of all channels for /dev/dsp1:

$ sndctl -f /dev/dsp1 pid proc

Dump /dev/dsp0 information to a file and retrieve back later:

$ sndctl -f /dev/dsp0 -o > info
...
$ sndctl -f /dev/dsp0 `cat info`

SEE ALSO

sndstat(4), sound(4), xo_options(7), mixer(8), sysctl(8)

AUTHORS

The sndctl utility was implemented by Christos Margiolis ⟨[email protected]⟩ under sponsorship from the FreeBSD Foundation.

History

--libxo since FreeBSD 15.1-RELEASE.