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