xref: /netbsd-src/usr.bin/audio/ctl/audioctl.1 (revision 5a58ccfbecb506b305b6ec0fa77e4caac7faed71)
1.\" $NetBSD: audioctl.1,v 1.25 2022/08/07 11:06:19 andvar Exp $
2.\"
3.\" Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Author: Lennart Augustsson and Charles M. Hannum
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27.\" POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd March 21, 2021
30.Dt AUDIOCTL 1
31.Os
32.Sh NAME
33.Nm audioctl
34.Nd control software audio format
35.Sh SYNOPSIS
36.Nm
37.Op Fl n
38.Op Fl d Ar device
39.Fl a
40.Nm
41.Op Fl n
42.Op Fl d Ar device
43.Ar name ...
44.Nm
45.Op Fl n
46.Op Fl d Ar device
47.Fl w
48.Ar name=value ...
49.Sh DESCRIPTION
50The
51.Nm
52command displays or sets the parameters that determine the playback and
53recording format for software using an audio device.
54It is most useful when the full
55.Xr audio 4
56API is not available, e.g. when playing or recording raw audio data from a
57.Xr sh 1
58script, or from the command line.
59It does not control the underlying hardware format, which can be
60changed with
61.Xr audiocfg 1 .
62.Pp
63The variables that can be inspected and changed with
64.Nm
65are normally per-application and are reset when a
66.Pa /dev/audioX
67device is opened.
68This can be circumvented by using
69.Pa /dev/soundX
70instead, which retains global state.
71.Pp
72If a list of variables is present on the command line, then
73.Nm
74prints the current value of those variables for the specified device.
75If the
76.Fl a
77flag is specified, all variables for the device are printed.
78If the
79.Fl w
80flag is specified
81.Nm
82attempts to set the specified variables to the given values.
83.Pp
84The
85.Fl d
86flag can be used to give an alternative audio control device, the default is
87.Pa /dev/audioctl0 .
88.Pp
89The
90.Fl n
91flag suppresses printing of the variable name.
92.Sh ENVIRONMENT
93.Bl -tag -width AUDIOCTLDEVICE
94.It Pa AUDIOCTLDEVICE
95the audio control device to use.
96.El
97.Sh FILES
98.Bl -tag -width /dev/audioctl0 -compact
99.It Pa /dev/sound0
100audio I/O device
101.It Pa /dev/audioctl0
102audio control device
103.El
104.Sh EXAMPLES
105To set the playing sampling rate to 11025, you can use
106.Dl audioctl -w play.sample_rate=11025
107To set all of the play parameters for CD-quality audio, you can use
108.Dl audioctl -w play=44100,2,16,slinear_le
109.Sh COMPATIBILITY
110The old
111.Fl f
112flag is still supported.
113This support will be removed eventually.
114.Sh SEE ALSO
115.Xr audiocfg 1 ,
116.Xr audioplay 1 ,
117.Xr audiorecord 1 ,
118.Xr mixerctl 1 ,
119.Xr audio 4 ,
120.Xr sysctl 8
121.Sh HISTORY
122The
123.Nm
124command first appeared in
125.Nx 1.3 .
126.Sh CAVEATS
127Since the parameters controlled by
128.Nm
129are global, they can be changed unexpectedly if another application
130uses the same audio device.
131.Pp
132It is always preferable to use
133.Dv AUDIO_SETINFO
134on a per-process
135.Pa /dev/audioX
136device, if the
137.Xr audio 4
138ioctls are available in the programming environment.
139Similarly,
140.Xr audioplay 1
141and
142.Xr audiorecord 1
143are more safe for use in scripting.
144