xref: /freebsd/usr.sbin/mixer/mixer.8 (revision 81e0e7b9e36d6a25b3af6482811318e085537d2f)
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.\" $FreeBSD$
23.\"
24.Dd March 13, 2022
25.Dt MIXER 8
26.Os
27.Sh NAME
28.Nm mixer
29.Nd manipulate soundcard mixer controls
30.Sh SYNOPSIS
31.Nm
32.Op Fl f Ar device
33.Op Fl d Ar unit
34.Op Fl os
35.Op Ar dev Ns Op Cm \&. Ns Ar control Ns Op Cm \&= Ns Ar value
36.Ar ...
37.Nm
38.Op Fl d Ar unit
39.Op Fl os
40.Fl a
41.Nm
42.Fl h
43.Sh DESCRIPTION
44The
45.Nm
46utility is used to set and display soundcard mixer device controls.
47.Pp
48The options are as follows:
49.Bl -tag -width "-f device"
50.It Fl a
51Print the values for all mixer devices available in the system
52.Pq see Sx FILES .
53.It Fl d Ar unit
54Change the default audio card to
55.Ar unit .
56The unit has to be an integer value.
57To see what unit values are available, look
58at the number each mixer device has by running
59.Nm .
60.It Fl f Ar device
61Open
62.Ar device
63as the mixer device
64.Pq see Sx FILES .
65.It Fl h
66Print a help message.
67.It Fl o
68Print mixer values in a format suitable for use inside scripts.
69The mixer's header (name, audio card name, ...) will not be printed.
70.It Fl s
71Print only the recording source(s) of the mixer device.
72.El
73.Pp
74The list of mixer devices that may be modified are:
75.Bd -ragged -offset indent
76.Cm vol , bass , treble , synth , pcm , speaker , line , mic , cd , mix ,
77.Cm pcm2 , rec ,
78.Cm igain , ogain ,
79.Cm line1 , line2 , line3 ,
80.Cm dig1 , dig2 , dig3 ,
81.Cm phin , phout , video , radio ,
82and
83.Cm monitor .
84.Ed
85.Pp
86Not all mixer devices are available.
87.Pp
88Without any arguments,
89.Nm
90displays all information for each one of the mixer's supported devices to
91.Ar stdout .
92If the
93.Ar dev
94argument is specified,
95.Nm
96displays only the values for
97.Ar dev .
98More than one device may be specified.
99.Pp
100Commands use the following format:
101.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent
102.It Sy Name Ta Sy Action
103.It Ar dev Ta Display all controls
104.It Ar dev Ns Cm \&. Ns Ar control Ta Display only the specified control
105.It Ar dev Ns Cm \&. Ns Ar control Ns Cm \&= Ns Ar value Ta Set control value
106.El
107.Pp
108The available controls are as follows (replace
109.Ar dev
110with one of the available devices):
111.Sm off
112.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent
113.It Sy Name Ta Sy Value
114.It Ar dev Cm .volume Ta Xo
115.Ar vol |
116.Oo Cm \&+ | Cm \&- Oc Ar lvol
117.Oo Cm \&: Oo Cm \&+ | Cm \&- Oc Ar rvol Oc
118.Xc
119.It Ar dev Cm .mute Ta Cm 0 | 1 | ^
120.It Ar dev Cm .recsrc Ta Cm ^ | + | - | =
121.El
122.Sm on
123.Pp
124The
125.Ar dev Ns Cm .volume
126control modifies a device's volume.
127The optional
128.Ar lvol
129and/or
130.Ar rvol
131values have to be specified.
132The values have to be normalized 32-bit floats,
133from 0.0 to 1.0 inclusivly.
134If no
135.Ql \&.
136character is present, the value is treated
137like a percentage, for backwards compatibility.
138If the left or right volume values are prefixed with
139.Cm +
140or
141.Cm - ,
142the value following will be used as a relative adjustment, modifying the
143current settings by the amount specified.
144.Pp
145The
146.Ar dev Ns Cm .mute
147control (un)mutes a device.
148The following values are available:
149.Bl -tag -width = -offset indent
150.It Cm 0
151unmutes
152.Ar dev
153.It Cm 1
154mutes
155.Ar dev
156.It Cm ^
157toggles the mute of
158.Ar dev
159.El
160.Pp
161The
162.Ar dev Ns Cm .recsrc
163control modifies the recording sources of a mixer.
164.Nm
165marks devices which can be used as a recording source with
166.Sy rec .
167Recording sources are marked with
168.Sy src .
169To modify the recording source you can use one of the following modifiers
170on a
171.Sy rec
172device:
173.Bl -tag -width = -offset indent
174.It Cm ^
175toggles
176.Ar dev
177of possible recording devices
178.It Cm +
179adds
180.Ar dev
181to possible recording devices
182.It Cm -
183removes
184.Ar dev
185from possible recording devices
186.It Cm =
187sets the recording device to
188.Ar dev
189.El
190.Sh FILES
191.Bl -tag -width /dev/mixerN -compact
192.It Pa /dev/mixerN
193The mixer device, where
194.Ar N
195is the number of that device, for example
196.Ar /dev/mixer0 .
197PCM cards and mixers have a 1:1 relationship, which means that
198.Pa /dev/mixer0
199is the mixer for
200.Pa /dev/pcm0
201and so on.
202By default,
203.Nm
204prints both the audio card's number and the mixer associated with it
205in the form of
206.Ar pcmN:mixer .
207The
208.Pa /dev/mixer
209file, although it does not exist in the filesystem, points to the default
210mixer device and is the file
211.Nm
212opens when the
213.Fl f Ar device
214option has not been specified.
215.El
216.Sh EXAMPLES
217Change the volume for the
218.Cm vol
219device of the
220.Pa /dev/mixer0
221mixer device to 0.65:
222.Bd -literal -offset indent
223$ mixer -f /dev/mixer0 vol.volume=0.65
224.Ed
225.Pp
226Increase the
227.Cm mic
228device's left volume by 0.10 and decrease the right
229volume by 0.05:
230.Bd -literal -offset indent
231$ mixer mic.volume=+0.10:-0.05
232.Ed
233.Pp
234Toggle the mute for
235.Cm vol :
236.Bd -literal -offset indent
237$ mixer vol.mute=^
238.Ed
239.Pp
240Set
241.Cm mic
242and toggle
243.Cm line
244recording sources:
245.Bd -literal -offset indent
246$ mixer mic.recsrc=+ line.recsrc=^
247.Ed
248.Pp
249Dump
250.Pa /dev/mixer0
251information to a file and retrieve back later:
252.Bd -literal -offset indent
253$ mixer -f /dev/mixer0 -o > info
254\&...
255$ mixer -f /dev/mixer0 `cat info`
256.Ed
257.Sh SEE ALSO
258.Xr mixer 3 ,
259.Xr sound 4 ,
260.Xr sysctl 8
261.Sh HISTORY
262The
263.Nm
264utility first appeared in
265.Fx 2.0.5
266and was rewritten completely in
267.Fx 14.0 .
268.Sh AUTHORS
269.An Christos Margiolis Aq Mt christos@FreeBSD.org
270