xref: /freebsd/usr.sbin/mixer/mixer.8 (revision 1edb7116)
1.\"-
2.\" Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org>
3.\"
4.\" Permission is hereby granted, free of charge, to any person obtaining a copy
5.\" of this software and associated documentation files (the "Software"), to deal
6.\" in the Software without restriction, including without limitation the rights
7.\" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8.\" copies of the Software, and to permit persons to whom the Software is
9.\" furnished to do so, subject to the following conditions:
10.\"
11.\" The above copyright notice and this permission notice shall be included in
12.\" all copies or substantial portions of the Software.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19.\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20.\" THE SOFTWARE.
21.\"
22.Dd February 8, 2024
23.Dt MIXER 8
24.Os
25.Sh NAME
26.Nm mixer
27.Nd manipulate soundcard mixer controls
28.Sh SYNOPSIS
29.Nm
30.Op Fl f Ar device
31.Op Fl d Ar pcmN | N
32.Op Fl os
33.Op Ar dev Ns Op Cm \&. Ns Ar control Ns Op Cm \&= Ns Ar value
34.Ar ...
35.Nm
36.Op Fl os
37.Fl a
38.Nm
39.Fl h
40.Sh DESCRIPTION
41The
42.Nm
43utility is used to set and display soundcard mixer device controls.
44.Pp
45The options are as follows:
46.Bl -tag -width "-d pcmN | N"
47.It Fl a
48Print the values for all mixer devices available in the system
49.Pq see Sx FILES .
50.It Fl d Ar pcmN | N
51Change the default audio card to
52.Ar pcmN ,
53where N is the unit number (e.g for pcm0, the unit number is 0).
54See
55.Sx EXAMPLES
56on how to list all available audio devices in the system.
57.It Fl f Ar device
58Open
59.Ar device
60as the mixer device
61.Pq see Sx FILES .
62.It Fl h
63Print a help message.
64.It Fl o
65Print mixer values in a format suitable for use inside scripts.
66The mixer's header (name, audio card name, ...) will not be printed.
67.It Fl s
68Print only the recording source(s) of the mixer device.
69.El
70.Pp
71The list of mixer devices that may be modified are:
72.Bd -ragged -offset indent
73.Cm vol , bass , treble , synth , pcm , speaker , line , mic , cd , mix ,
74.Cm pcm2 , rec ,
75.Cm igain , ogain ,
76.Cm line1 , line2 , line3 ,
77.Cm dig1 , dig2 , dig3 ,
78.Cm phin , phout , video , radio ,
79and
80.Cm monitor .
81.Ed
82.Pp
83Not all mixer devices are available.
84.Pp
85Without any arguments,
86.Nm
87displays all information for each one of the mixer's supported devices to
88.Ar stdout .
89If the
90.Ar dev
91argument is specified,
92.Nm
93displays only the values for
94.Ar dev .
95More than one device may be specified.
96.Pp
97Commands use the following format:
98.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent
99.It Sy Name Ta Sy Action
100.It Ar dev Ta Display all controls
101.It Ar dev Ns Cm \&. Ns Ar control Ta Display only the specified control
102.It Ar dev Ns Cm \&. Ns Ar control Ns Cm \&= Ns Ar value Ta Set control value
103.El
104.Pp
105The available controls are as follows (replace
106.Ar dev
107with one of the available devices):
108.Sm off
109.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent
110.It Sy Name Ta Sy Value
111.It Ar dev Cm .volume Ta Xo
112.Ar vol |
113.Oo Cm \&+ | Cm \&- Oc Ar lvol Oo % Oc
114.Oo Cm \&: Oo Cm \&+ | Cm \&- Oc Ar rvol Oo % Oc Oc
115.Xc
116.It Ar dev Cm .mute Ta Cm 0 | 1 | ^
117.It Ar dev Cm .mute Ta Cm off | on | toggle
118.It Ar dev Cm .recsrc Ta Cm ^ | + | - | =
119.It Ar dev Cm .recsrc Ta Cm toggle | add | remove | set
120.El
121.Sm on
122.Pp
123The
124.Ar dev Ns Cm .volume
125control modifies a device's volume.
126The optional
127.Ar lvol
128and/or
129.Ar rvol
130values have to be specified.
131The values should typically be decimal numbers between 0 and 1 with at most 2
132digits after the decimal point.
133A trailing percent sign indicates that the value should be treated as a
134percentage of 1.0, rather than an absolute value.
135Thus, 70% means the same as 0.7.
136If the left or right volume values are prefixed with
137.Cm +
138or
139.Cm - ,
140the value following will be used as a relative adjustment, modifying the
141current settings by the amount specified.
142Note that relative percentages are still relative to 1.0, not to the current
143value.
144If the volume is currently 0.40 and an adjustment of +20% is specified, then
145thet final volume will be set to 0.60.
146.Pp
147Volume can also be set using the shorthand
148.Ar dev Ns Cm =value .
149This syntax does not apply to other controls.
150.Pp
151The
152.Ar dev Ns Cm .mute
153control (un)mutes a device.
154The following values are available:
155.Bl -tag -width "xxxxxxxxxx" -offset indent
156.It Cm 0 | off
157unmutes
158.Ar dev
159.It Cm 1 | on
160mutes
161.Ar dev
162.It Cm ^ | toggle
163toggles the mute of
164.Ar dev
165.El
166.Pp
167The
168.Ar dev Ns Cm .recsrc
169control modifies the recording sources of a mixer.
170.Nm
171marks devices which can be used as a recording source with
172.Sy rec .
173Recording sources are marked with
174.Sy src .
175To modify the recording source you can use one of the following modifiers
176on a
177.Sy rec
178device:
179.Bl -tag -width "xxxxxxxxxx" -offset indent
180.It Cm ^ | toggle
181toggles
182.Ar dev
183of possible recording devices
184.It Cm + | add
185adds
186.Ar dev
187to possible recording devices
188.It Cm - | remove
189removes
190.Ar dev
191from possible recording devices
192.It Cm = | set
193makes
194.Ar dev
195the only recording device.
196.El
197.Sh FILES
198.Bl -tag -width /dev/mixerN -compact
199.It Pa /dev/mixerN
200The mixer device, where
201.Ar N
202is the number of that device, for example
203.Ar /dev/mixer0 .
204PCM cards and mixers have a 1:1 relationship, which means that
205.Pa /dev/mixer0
206is the mixer for
207.Pa /dev/pcm0
208and so on.
209By default,
210.Nm
211prints both the audio card's number and the mixer associated with it
212in the form of
213.Ar pcmN:mixer .
214The
215.Pa /dev/mixer
216file, although it does not exist in the filesystem, points to the default
217mixer device and is the file
218.Nm
219opens when the
220.Fl f Ar device
221option has not been specified.
222.El
223.Sh EXAMPLES
224List all available audio devices in the system:
225.Bd -literal -offset indent
226$ mixer -a | grep ^pcm
227.Ed
228.Pp
229Increase the
230.Cm vol
231device's volume by 5%:
232.Bd -literal -offset indent
233$ mixer vol=+5%
234.Ed
235.Pp
236Change the volume for the
237.Cm vol
238device of the
239.Pa /dev/mixer0
240mixer device to 0.65:
241.Bd -literal -offset indent
242$ mixer -f /dev/mixer0 vol.volume=0.65
243.Ed
244.Pp
245Increase the
246.Cm mic
247device's left volume by 0.10 and decrease the right
248volume by 0.05:
249.Bd -literal -offset indent
250$ mixer mic.volume=+0.10:-0.05
251.Ed
252.Pp
253Toggle the mute for
254.Cm vol :
255.Bd -literal -offset indent
256$ mixer vol.mute=toggle
257.Ed
258.Pp
259Add
260.Cm mic
261and remove
262.Cm line
263from the recording devices:
264.Bd -literal -offset indent
265$ mixer mic.recsrc=add line.recsrc=remove
266.Ed
267.Pp
268Dump
269.Pa /dev/mixer0
270information to a file and retrieve back later:
271.Bd -literal -offset indent
272$ mixer -f /dev/mixer0 -o > info
273\&...
274$ mixer -f /dev/mixer0 `cat info`
275.Ed
276.Sh SEE ALSO
277.Xr mixer 3 ,
278.Xr sound 4 ,
279.Xr sysctl 8
280.Sh HISTORY
281The
282.Nm
283utility first appeared in
284.Fx 2.0.5
285and was rewritten completely in
286.Fx 14.0 .
287.Sh AUTHORS
288.An Christos Margiolis Aq Mt christos@FreeBSD.org
289