xref: /freebsd/usr.sbin/sndctl/sndctl.8 (revision 9a37f1024cebfb89dcfa15c23bb287a5d09a9ae7)
1*9a37f102SChristos Margiolis.\"-
2*9a37f102SChristos Margiolis.\" SPDX-License-Identifier: BSD-2-Clause
3*9a37f102SChristos Margiolis.\"
4*9a37f102SChristos Margiolis.\" Copyright (c) 2024-2025 The FreeBSD Foundation
5*9a37f102SChristos Margiolis.\"
6*9a37f102SChristos Margiolis.\" Portions of this software were developed by Christos Margiolis
7*9a37f102SChristos Margiolis.\" <christos@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
8*9a37f102SChristos Margiolis.\"
9*9a37f102SChristos Margiolis.\" Redistribution and use in source and binary forms, with or without
10*9a37f102SChristos Margiolis.\" modification, are permitted provided that the following conditions
11*9a37f102SChristos Margiolis.\" are met:
12*9a37f102SChristos Margiolis.\" 1. Redistributions of source code must retain the above copyright
13*9a37f102SChristos Margiolis.\"    notice, this list of conditions and the following disclaimer.
14*9a37f102SChristos Margiolis.\" 2. Redistributions in binary form must reproduce the above copyright
15*9a37f102SChristos Margiolis.\"    notice, this list of conditions and the following disclaimer in the
16*9a37f102SChristos Margiolis.\"    documentation and/or other materials provided with the distribution.
17*9a37f102SChristos Margiolis.\"
18*9a37f102SChristos Margiolis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19*9a37f102SChristos Margiolis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*9a37f102SChristos Margiolis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*9a37f102SChristos Margiolis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22*9a37f102SChristos Margiolis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*9a37f102SChristos Margiolis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*9a37f102SChristos Margiolis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*9a37f102SChristos Margiolis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26*9a37f102SChristos Margiolis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27*9a37f102SChristos Margiolis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*9a37f102SChristos Margiolis.\" SUCH DAMAGE.
29*9a37f102SChristos Margiolis.\"
30*9a37f102SChristos Margiolis.Dd May 5, 2025
31*9a37f102SChristos Margiolis.Dt SNDCTL 8
32*9a37f102SChristos Margiolis.Os
33*9a37f102SChristos Margiolis.Sh NAME
34*9a37f102SChristos Margiolis.Nm sndctl
35*9a37f102SChristos Margiolis.Nd list and modify soundcard properties
36*9a37f102SChristos Margiolis.Sh SYNOPSIS
37*9a37f102SChristos Margiolis.Nm
38*9a37f102SChristos Margiolis.Op Fl f Ar device
39*9a37f102SChristos Margiolis.Op Fl hov
40*9a37f102SChristos Margiolis.Op Ar control Ns Oo = Ns Ar value Oc Ar ...
41*9a37f102SChristos Margiolis.Sh DESCRIPTION
42*9a37f102SChristos MargiolisThe
43*9a37f102SChristos Margiolis.Nm
44*9a37f102SChristos Margiolisutility is used to set and display sound card properties, using a
45*9a37f102SChristos Margioliscontrol-driven interface, in order to filter and/or set specific properties.
46*9a37f102SChristos Margiolis.Pp
47*9a37f102SChristos MargiolisThe options are as follows:
48*9a37f102SChristos Margiolis.Bl -tag -width "-f device"
49*9a37f102SChristos Margiolis.It Fl f Ar device
50*9a37f102SChristos MargiolisChoose a specific audio device
51*9a37f102SChristos Margiolis.Pq see Sx FILES .
52*9a37f102SChristos MargiolisUserland devices (e.g those registered by
53*9a37f102SChristos Margiolis.Xr virtual_oss 8
54*9a37f102SChristos Margioliscan also be selected.
55*9a37f102SChristos Margiolis.It Fl h
56*9a37f102SChristos MargiolisPrint a help message.
57*9a37f102SChristos Margiolis.It Fl o
58*9a37f102SChristos MargiolisPrint values in a format suitable for use inside scripts.
59*9a37f102SChristos Margiolis.It Fl v
60*9a37f102SChristos MargiolisRun in verbose mode.
61*9a37f102SChristos MargiolisThis option will print all of the device's channel properties.
62*9a37f102SChristos Margiolis.El
63*9a37f102SChristos Margiolis.Pp
64*9a37f102SChristos MargiolisThe device controls are as follows:
65*9a37f102SChristos Margiolis.Bl -column xxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxx -offset indent
66*9a37f102SChristos Margiolis.It Sy Name Ta Sy Type Ta Sy Read/Write Ta Sy Action
67*9a37f102SChristos Margiolis.It name Ta String Ta Read Ta Device name
68*9a37f102SChristos Margiolis.It desc Ta String Ta Read Ta Device description
69*9a37f102SChristos Margiolis.It status Ta String Ta Read Ta Device status
70*9a37f102SChristos Margiolis.It devnode Ta String Ta Read Ta Device node
71*9a37f102SChristos Margiolis.It from_user Ta Boolean Ta Read Ta Userland device
72*9a37f102SChristos Margiolis.It unit Ta Number Ta Read Ta Device unit
73*9a37f102SChristos Margiolis.It caps Ta String Ta Read Ta Device OSS capabitilies
74*9a37f102SChristos Margiolis.It bitperfect Ta Boolean Ta Read/Write Ta Bit-perfect mode enabled
75*9a37f102SChristos Margiolis.It autoconv Ta Boolean Ta Read/Write Ta Auto-conversions enabled
76*9a37f102SChristos Margiolis.It realtime Ta Boolean Ta Read/Write Ta Real-time mode enabled
77*9a37f102SChristos Margiolis.It play Ta Group Ta Read Ta Playback properties
78*9a37f102SChristos Margiolis.It play.format Ta String Ta Read/Write Ta Playback format
79*9a37f102SChristos Margiolis.It play.rate Ta Number Ta Read/Write Ta Playback sample rate
80*9a37f102SChristos Margiolis.It play.vchans Ta Boolean Ta Read/Write Ta Playback VCHANs (virtual channels) enabled
81*9a37f102SChristos Margiolis.It play.min_rate Ta Number Ta Read Ta Minimum playback sample rate
82*9a37f102SChristos Margiolis.It play.max_rate Ta Number Ta Read Ta Maximum playback sample rate
83*9a37f102SChristos Margiolis.It play.min_chans Ta Number Ta Read Ta Natively supported minimum playback sample channels
84*9a37f102SChristos Margiolis.It play.max_chans Ta Number Ta Read Ta Natively supported maximum playback sample channels
85*9a37f102SChristos Margiolis.It play.formats Ta String Ta Read Ta Natively supported playback formats
86*9a37f102SChristos Margiolis.It rec Ta Group Ta Read Ta Recording properties
87*9a37f102SChristos Margiolis.It rec.format Ta String Ta Read/Write Ta Recording format
88*9a37f102SChristos Margiolis.It rec.rate Ta Number Ta Read/Write Ta Recording sample rate
89*9a37f102SChristos Margiolis.It rec.vchans Ta Boolean Ta Read/Write Ta Recording VCHANs (virtual channels) enabled
90*9a37f102SChristos Margiolis.It rec.min_rate Ta Number Ta Read Ta Minimum recording sample rate
91*9a37f102SChristos Margiolis.It rec.max_rate Ta Number Ta Read Ta Maximum recording sample rate
92*9a37f102SChristos Margiolis.It rec.min_chans Ta Number Ta Read Ta Natively supported minimum recording sample channels
93*9a37f102SChristos Margiolis.It rec.max_chans Ta Number Ta Read Ta Natively supported maximum recording sample channels
94*9a37f102SChristos Margiolis.It rec.formats Ta String Ta Read Ta Natively supported recording formats
95*9a37f102SChristos Margiolis.El
96*9a37f102SChristos Margiolis.Pp
97*9a37f102SChristos MargiolisThe
98*9a37f102SChristos Margiolis.Pa play.format ,
99*9a37f102SChristos Margiolis.Pa play.rate ,
100*9a37f102SChristos Margiolis.Pa rec.format and
101*9a37f102SChristos Margiolis.Pa rec.rate
102*9a37f102SChristos Margioliscontrols will be read-only if VCHANs are disabled.
103*9a37f102SChristos Margiolis.Pp
104*9a37f102SChristos MargiolisThe device channel controls are as follows:
105*9a37f102SChristos Margiolis.Bl -column xxxxxxxxxxxxxxx xxxxx xxxxxxxx xxxxxxxxxxxxxxxxxxx -offset indent
106*9a37f102SChristos Margiolis.It Sy Name Ta Sy Type Ta Sy Read/Write Ta Sy Action
107*9a37f102SChristos Margiolis.It name Ta String Ta Read Ta Channel name
108*9a37f102SChristos Margiolis.It parentchan Ta String Ta Read Ta Parent (primary) channel name
109*9a37f102SChristos Margiolis.It unit Ta Number Ta Read Ta Channel unit
110*9a37f102SChristos Margiolis.It caps Ta String Ta Read Ta Channel OSS capabilities
111*9a37f102SChristos Margiolis.It latency Ta Number Ta Read Ta Channel latency
112*9a37f102SChristos Margiolis.It format Ta String Ta Read Ta Channel format
113*9a37f102SChristos Margiolis.It rate Ta Number Ta Read Ta Channel sample rate
114*9a37f102SChristos Margiolis.It pid Ta Number Ta Read Ta PID of process consuming channel
115*9a37f102SChristos Margiolis.It proc Ta String Ta Read Ta Name of process consuming channel
116*9a37f102SChristos Margiolis.It interrupts Ta Number Ta Read Ta Number of interrupts since channel was opened
117*9a37f102SChristos Margiolis.It xruns Ta Number Ta Read Ta Number of playback underruns/recoring overruns
118*9a37f102SChristos Margiolis.It feedcount Ta Number Ta Read Ta Number of bytes fed to channel
119*9a37f102SChristos Margiolis.It volume Ta Volume Ta Read Ta Channel left-right volume in normalized form (0.00 to 1.00).
120*9a37f102SChristos Margiolis.It hwbuf Ta Group Ta Read Ta Hardware buffer properties
121*9a37f102SChristos Margiolis.It hwbuf.format Ta String Ta Read Ta Hardware buffer format
122*9a37f102SChristos Margiolis.It hwbuf.rate Ta String Ta Read Ta Hardware buffer sample rate
123*9a37f102SChristos Margiolis.It hwbuf.size_bytes Ta Number Ta Read Ta Hardware buffer size in bytes
124*9a37f102SChristos Margiolis.It hwbuf.size_frames Ta Number Ta Read Ta Hardware buffer size in frames
125*9a37f102SChristos Margiolis.It hwbuf.blksz Ta Number Ta Read Ta Hardware buffer block size
126*9a37f102SChristos Margiolis.It hwbuf.blkcnt Ta Number Ta Read Ta Hardware buffer block count
127*9a37f102SChristos Margiolis.It hwbuf.free Ta Number Ta Read Ta Hardware buffer free space in bytes
128*9a37f102SChristos Margiolis.It hwbuf.ready Ta Number Ta Read Ta Hardware buffer ready space in bytes
129*9a37f102SChristos Margiolis.It swbuf Ta Group Ta Read Ta Software buffer properties
130*9a37f102SChristos Margiolis.It swbuf.format Ta String Ta Read Ta Software buffer format
131*9a37f102SChristos Margiolis.It swbuf.rate Ta String Ta Read Ta Software buffer sample rate
132*9a37f102SChristos Margiolis.It swbuf.size_bytes Ta Number Ta Read Ta Software buffer size in bytes
133*9a37f102SChristos Margiolis.It swbuf.size_frames Ta Number Ta Read Ta Software buffer size in frames
134*9a37f102SChristos Margiolis.It swbuf.blksz Ta Number Ta Read Ta Software buffer block size
135*9a37f102SChristos Margiolis.It swbuf.blkcnt Ta Number Ta Read Ta Software buffer block count
136*9a37f102SChristos Margiolis.It swbuf.free Ta Number Ta Read Ta Software buffer free space in bytes
137*9a37f102SChristos Margiolis.It swbuf.ready Ta Number Ta Read Ta Software buffer ready space in bytes
138*9a37f102SChristos Margiolis.It feederchain Ta String Ta Read Ta Channel feeder chain
139*9a37f102SChristos Margiolis.El
140*9a37f102SChristos Margiolis.Sh FILES
141*9a37f102SChristos Margiolis.Bl -tag -width /dev/dspX -compact
142*9a37f102SChristos Margiolis.It Pa /dev/dsp
143*9a37f102SChristos MargiolisThe default audio device.
144*9a37f102SChristos Margiolis.It Pa /dev/dspX
145*9a37f102SChristos MargiolisThe audio device file, where X is the unit of the device, for example
146*9a37f102SChristos Margiolis.Ar /dev/dsp0 .
147*9a37f102SChristos Margiolis.El
148*9a37f102SChristos Margiolis.Sh EXAMPLES
149*9a37f102SChristos MargiolisDisable auto-conversions and enable realtime mode to get as low latencies as
150*9a37f102SChristos Margiolispossible:
151*9a37f102SChristos Margiolis.Bd -literal -offset indent
152*9a37f102SChristos Margiolis$ sndctl autoconv=0 realtime=1
153*9a37f102SChristos Margiolis.Ed
154*9a37f102SChristos Margiolis.Pp
155*9a37f102SChristos MargiolisSet the playback sample format to 2-channel signed 24-bit low endian, and sample
156*9a37f102SChristos Margiolisrate to 48000 Hz:
157*9a37f102SChristos Margiolis.Bd -literal -offset indent
158*9a37f102SChristos Margiolis$ sndctl play.format=s24le:2.0 play.rate=48000
159*9a37f102SChristos Margiolis.Ed
160*9a37f102SChristos Margiolis.Pp
161*9a37f102SChristos MargiolisList the PIDs and process names of all channels for
162*9a37f102SChristos Margiolis.Pa /dev/dsp1 :
163*9a37f102SChristos Margiolis.Bd -literal -offset indent
164*9a37f102SChristos Margiolis$ sndctl -f /dev/dsp1 pid proc
165*9a37f102SChristos Margiolis.Ed
166*9a37f102SChristos Margiolis.Pp
167*9a37f102SChristos MargiolisDump
168*9a37f102SChristos Margiolis.Pa /dev/dsp0
169*9a37f102SChristos Margiolisinformation to a file and retrieve back later:
170*9a37f102SChristos Margiolis.Bd -literal -offset indent
171*9a37f102SChristos Margiolis$ sndctl -f /dev/dsp0 -o > info
172*9a37f102SChristos Margiolis\&...
173*9a37f102SChristos Margiolis$ sndctl -f /dev/dsp0 `cat info`
174*9a37f102SChristos Margiolis.Ed
175*9a37f102SChristos Margiolis.Sh SEE ALSO
176*9a37f102SChristos Margiolis.Xr sndstat 4 ,
177*9a37f102SChristos Margiolis.Xr sound 4 ,
178*9a37f102SChristos Margiolis.Xr mixer 8 ,
179*9a37f102SChristos Margiolis.Xr sysctl 8
180*9a37f102SChristos Margiolis.Sh AUTHORS
181*9a37f102SChristos MargiolisThe
182*9a37f102SChristos Margiolis.Nm
183*9a37f102SChristos Margiolisutility was implemented by
184*9a37f102SChristos Margiolis.An Christos Margiolis Aq Mt christos@FreeBSD.org
185*9a37f102SChristos Margiolisunder sponsorship from the
186*9a37f102SChristos Margiolis.Fx
187*9a37f102SChristos MargiolisFoundation.
188