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 April 29, 2022 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 unit 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 d Ar unit 37.Op Fl os 38.Fl a 39.Nm 40.Fl h 41.Sh DESCRIPTION 42The 43.Nm 44utility is used to set and display soundcard mixer device controls. 45.Pp 46The options are as follows: 47.Bl -tag -width "-f device" 48.It Fl a 49Print the values for all mixer devices available in the system 50.Pq see Sx FILES . 51.It Fl d Ar unit 52Change the default audio card to 53.Ar unit . 54The unit has to be an integer value. 55To see what unit values are available, look at the number each mixer device has by running 56.Nm . 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 .recsrc Ta Cm ^ | + | - | = 118.El 119.Sm on 120.Pp 121The 122.Ar dev Ns Cm .volume 123control modifies a device's volume. 124The optional 125.Ar lvol 126and/or 127.Ar rvol 128values have to be specified. 129The values should typically be decimal numbers between 0 and 1 with at most 2 130digits after the decimal point. 131A trailing percent sign indicates that the value should be treated as a 132percentage of 1.0, rather than an absolute value. 133Thus, 70% means the same as 0.7. 134If the left or right volume values are prefixed with 135.Cm + 136or 137.Cm - , 138the value following will be used as a relative adjustment, modifying the 139current settings by the amount specified. 140Note that relative percentages are still relative to 1.0, not to the current 141value. 142If the volume is currently 0.40 and an adjustment of +20% is specified, then 143thet final volume will be set to 0.60. 144.Pp 145Volume can also be set using the shorthand 146.Ar dev Ns Cm =value . 147This syntax does not apply to other controls. 148.Pp 149The 150.Ar dev Ns Cm .mute 151control (un)mutes a device. 152The following values are available: 153.Bl -tag -width = -offset indent 154.It Cm 0 155unmutes 156.Ar dev 157.It Cm 1 158mutes 159.Ar dev 160.It Cm ^ 161toggles the mute of 162.Ar dev 163.El 164.Pp 165The 166.Ar dev Ns Cm .recsrc 167control modifies the recording sources of a mixer. 168.Nm 169marks devices which can be used as a recording source with 170.Sy rec . 171Recording sources are marked with 172.Sy src . 173To modify the recording source you can use one of the following modifiers 174on a 175.Sy rec 176device: 177.Bl -tag -width = -offset indent 178.It Cm ^ 179toggles 180.Ar dev 181of possible recording devices 182.It Cm + 183adds 184.Ar dev 185to possible recording devices 186.It Cm - 187removes 188.Ar dev 189from possible recording devices 190.It Cm = 191sets the recording device to 192.Ar dev 193.El 194.Sh FILES 195.Bl -tag -width /dev/mixerN -compact 196.It Pa /dev/mixerN 197The mixer device, where 198.Ar N 199is the number of that device, for example 200.Ar /dev/mixer0 . 201PCM cards and mixers have a 1:1 relationship, which means that 202.Pa /dev/mixer0 203is the mixer for 204.Pa /dev/pcm0 205and so on. 206By default, 207.Nm 208prints both the audio card's number and the mixer associated with it 209in the form of 210.Ar pcmN:mixer . 211The 212.Pa /dev/mixer 213file, although it does not exist in the filesystem, points to the default 214mixer device and is the file 215.Nm 216opens when the 217.Fl f Ar device 218option has not been specified. 219.El 220.Sh EXAMPLES 221Change the volume for the 222.Cm vol 223device of the 224.Pa /dev/mixer0 225mixer device to 0.65: 226.Bd -literal -offset indent 227$ mixer -f /dev/mixer0 vol.volume=0.65 228.Ed 229.Pp 230Increase the 231.Cm mic 232device's left volume by 0.10 and decrease the right 233volume by 0.05: 234.Bd -literal -offset indent 235$ mixer mic.volume=+0.10:-0.05 236.Ed 237.Pp 238Toggle the mute for 239.Cm vol : 240.Bd -literal -offset indent 241$ mixer vol.mute=^ 242.Ed 243.Pp 244Set 245.Cm mic 246and toggle 247.Cm line 248recording sources: 249.Bd -literal -offset indent 250$ mixer mic.recsrc=+ line.recsrc=^ 251.Ed 252.Pp 253Dump 254.Pa /dev/mixer0 255information to a file and retrieve back later: 256.Bd -literal -offset indent 257$ mixer -f /dev/mixer0 -o > info 258\&... 259$ mixer -f /dev/mixer0 `cat info` 260.Ed 261.Sh SEE ALSO 262.Xr mixer 3 , 263.Xr sound 4 , 264.Xr sysctl 8 265.Sh HISTORY 266The 267.Nm 268utility first appeared in 269.Fx 2.0.5 270and was rewritten completely in 271.Fx 14.0 . 272.Sh AUTHORS 273.An Christos Margiolis Aq Mt christos@FreeBSD.org 274