1903873ceSHans Petter Selasky.\"- 2903873ceSHans Petter Selasky.\" Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org> 334cf4302SMike Pritchard.\" 4903873ceSHans Petter Selasky.\" Permission is hereby granted, free of charge, to any person obtaining a copy 5903873ceSHans Petter Selasky.\" of this software and associated documentation files (the "Software"), to deal 6903873ceSHans Petter Selasky.\" in the Software without restriction, including without limitation the rights 7903873ceSHans Petter Selasky.\" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8903873ceSHans Petter Selasky.\" copies of the Software, and to permit persons to whom the Software is 9903873ceSHans Petter Selasky.\" furnished to do so, subject to the following conditions: 1034cf4302SMike Pritchard.\" 11903873ceSHans Petter Selasky.\" The above copyright notice and this permission notice shall be included in 12903873ceSHans Petter Selasky.\" all copies or substantial portions of the Software. 13903873ceSHans Petter Selasky.\" 14903873ceSHans Petter Selasky.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15903873ceSHans Petter Selasky.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16903873ceSHans Petter Selasky.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17903873ceSHans Petter Selasky.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18903873ceSHans Petter Selasky.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19903873ceSHans Petter Selasky.\" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20903873ceSHans Petter Selasky.\" THE SOFTWARE. 2134cf4302SMike Pritchard.\" 22*9aac2759SChristos Margiolis.Dd August 14, 2024 23ce74223aSChristos Margiolis.Dt MIXER 8 2434cf4302SMike Pritchard.Os 2534cf4302SMike Pritchard.Sh NAME 2634cf4302SMike Pritchard.Nm mixer 27903873ceSHans Petter Selasky.Nd manipulate soundcard mixer controls 2834cf4302SMike Pritchard.Sh SYNOPSIS 2934cf4302SMike Pritchard.Nm 30eddcf96dSJohn-Mark Gurney.Op Fl f Ar device 31*9aac2759SChristos Margiolis.Op Fl d Ar pcmN | N Op Fl V Ar voss_device:mode 32903873ceSHans Petter Selasky.Op Fl os 33c36d0422SMateusz Piotrowski.Op Ar dev Ns Op Cm \&. Ns Ar control Ns Op Cm \&= Ns Ar value 3422baecf2SMatthew N. Dodd.Ar ... 3522baecf2SMatthew N. Dodd.Nm 36903873ceSHans Petter Selasky.Op Fl os 37903873ceSHans Petter Selasky.Fl a 38a3a82ed8SMateusz Piotrowski.Nm 39a3a82ed8SMateusz Piotrowski.Fl h 4034cf4302SMike Pritchard.Sh DESCRIPTION 4134cf4302SMike PritchardThe 4234cf4302SMike Pritchard.Nm 43903873ceSHans Petter Selaskyutility is used to set and display soundcard mixer device controls. 44903873ceSHans Petter Selasky.Pp 45903873ceSHans Petter SelaskyThe options are as follows: 46*9aac2759SChristos Margiolis.Bl -tag -width "-V voss_device:mode" 47903873ceSHans Petter Selasky.It Fl a 48c36d0422SMateusz PiotrowskiPrint the values for all mixer devices available in the system 49c36d0422SMateusz Piotrowski.Pq see Sx FILES . 5075be886eSChristos Margiolis.It Fl d Ar pcmN | N 51903873ceSHans Petter SelaskyChange the default audio card to 5275be886eSChristos Margiolis.Ar pcmN , 5375be886eSChristos Margioliswhere N is the unit number (e.g for pcm0, the unit number is 0). 5475be886eSChristos MargiolisSee 5575be886eSChristos Margiolis.Sx EXAMPLES 5675be886eSChristos Margiolison how to list all available audio devices in the system. 57*9aac2759SChristos Margiolis.Pp 58*9aac2759SChristos MargiolisThere is also the possibility of hot-swapping to the new default device if 59*9aac2759SChristos Margiolis.Xr virtual_oss 8 60*9aac2759SChristos Margiolisexists in the system and is running, in which case the 61*9aac2759SChristos Margiolis.Fl V 62*9aac2759SChristos Margiolisoption needs to be specified as well. 63*9aac2759SChristos Margiolis.Pp 64*9aac2759SChristos MargiolisHot-swapping generally cannot happen with plain 65*9aac2759SChristos Margiolis.Xr sound 4 , 66*9aac2759SChristos Margiolisso the user has to restart the track in order to get sound coming out of the 67*9aac2759SChristos Margiolisnew default device. 68*9aac2759SChristos MargiolisThis is because applications usually open a device at the start of the track 69*9aac2759SChristos Margiolisand do not check for default device changes, in order to open the new device 70*9aac2759SChristos Margiolismid-track. 71*9aac2759SChristos Margiolis.Xr virtual_oss 8 , 72*9aac2759SChristos Margiolison the other hand, can do hot-swapping, because it creates a virtual device for 73*9aac2759SChristos Margiolisapplications to open, and then does all the necessary routing and conversions 74*9aac2759SChristos Margiolisto the appropriate device(s). 75*9aac2759SChristos Margiolis.Pp 76*9aac2759SChristos MargiolisNote that hot-swapping will work only for applications that are using 77*9aac2759SChristos Margiolis.Xr virtual_oss 8 78*9aac2759SChristos Margiolisdevices, and not plain 79*9aac2759SChristos Margiolis.Xr sound 4 80*9aac2759SChristos Margiolisones. 81903873ceSHans Petter Selasky.It Fl f Ar device 82903873ceSHans Petter SelaskyOpen 83903873ceSHans Petter Selasky.Ar device 84c36d0422SMateusz Piotrowskias the mixer device 85c36d0422SMateusz Piotrowski.Pq see Sx FILES . 86a3a82ed8SMateusz Piotrowski.It Fl h 87a3a82ed8SMateusz PiotrowskiPrint a help message. 88903873ceSHans Petter Selasky.It Fl o 89c36d0422SMateusz PiotrowskiPrint mixer values in a format suitable for use inside scripts. 90c36d0422SMateusz PiotrowskiThe mixer's header (name, audio card name, ...) will not be printed. 91903873ceSHans Petter Selasky.It Fl s 92903873ceSHans Petter SelaskyPrint only the recording source(s) of the mixer device. 93*9aac2759SChristos Margiolis.It Fl V Ar voss_device:mode 94*9aac2759SChristos MargiolisSpecify a 95*9aac2759SChristos Margiolis.Xr virtual_oss 8 96*9aac2759SChristos Margioliscontrol device, as well as a mode (see below), in order to hot-swap devices. 97*9aac2759SChristos MargiolisThis option is meant to only be used in combination with the 98*9aac2759SChristos Margiolis.Fl d 99*9aac2759SChristos Margiolisoption. 100*9aac2759SChristos Margiolis.Pp 101*9aac2759SChristos MargiolisThe available modes are as follows: 102*9aac2759SChristos Margiolis.Bl -column play 103*9aac2759SChristos Margiolis.It Sy Mode Ta Sy Action 104*9aac2759SChristos Margiolis.It all Ta Playback and recording 105*9aac2759SChristos Margiolis.It play Ta Playback 106*9aac2759SChristos Margiolis.It rec Ta Recording 107*9aac2759SChristos Margiolis.El 108*9aac2759SChristos Margiolis.Pp 109*9aac2759SChristos MargiolisThe 110*9aac2759SChristos Margiolis.Pa mode 111*9aac2759SChristos Margiolispart is needed, so that 112*9aac2759SChristos Margiolis.Nm 113*9aac2759SChristos Margioliswill not accidentally hot-swap both the recording and playback device in 114*9aac2759SChristos Margiolis.Xr virtual_oss 8 , 115*9aac2759SChristos Margiolisif only one direction is to be hot-swapped. 116*9aac2759SChristos Margiolis.Pp 117*9aac2759SChristos MargiolisSee 118*9aac2759SChristos Margiolis.Sx EXAMPLES 119*9aac2759SChristos Margiolison how to use this option. 120903873ceSHans Petter Selasky.El 121903873ceSHans Petter Selasky.Pp 122903873ceSHans Petter SelaskyThe list of mixer devices that may be modified are: 123eddcf96dSJohn-Mark Gurney.Bd -ragged -offset indent 124c36d0422SMateusz Piotrowski.Cm vol , bass , treble , synth , pcm , speaker , line , mic , cd , mix , 125c36d0422SMateusz Piotrowski.Cm pcm2 , rec , 126c36d0422SMateusz Piotrowski.Cm igain , ogain , 127c36d0422SMateusz Piotrowski.Cm line1 , line2 , line3 , 128c36d0422SMateusz Piotrowski.Cm dig1 , dig2 , dig3 , 129c36d0422SMateusz Piotrowski.Cm phin , phout , video , radio , 130c36d0422SMateusz Piotrowskiand 131c36d0422SMateusz Piotrowski.Cm monitor . 132eddcf96dSJohn-Mark Gurney.Ed 13334cf4302SMike Pritchard.Pp 134eddcf96dSJohn-Mark GurneyNot all mixer devices are available. 13534cf4302SMike Pritchard.Pp 136872e095cSGreg LeheyWithout any arguments, 13734cf4302SMike Pritchard.Nm 138903873ceSHans Petter Selaskydisplays all information for each one of the mixer's supported devices to 139903873ceSHans Petter Selasky.Ar stdout . 14034cf4302SMike PritchardIf the 141eddcf96dSJohn-Mark Gurney.Ar dev 142872e095cSGreg Leheyargument is specified, 143872e095cSGreg Lehey.Nm 144903873ceSHans Petter Selaskydisplays only the values for 145872e095cSGreg Lehey.Ar dev . 146903873ceSHans Petter SelaskyMore than one device may be specified. 14734cf4302SMike Pritchard.Pp 148903873ceSHans Petter SelaskyCommands use the following format: 149903873ceSHans Petter Selasky.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent 150c36d0422SMateusz Piotrowski.It Sy Name Ta Sy Action 151c36d0422SMateusz Piotrowski.It Ar dev Ta Display all controls 152c36d0422SMateusz Piotrowski.It Ar dev Ns Cm \&. Ns Ar control Ta Display only the specified control 153c36d0422SMateusz Piotrowski.It Ar dev Ns Cm \&. Ns Ar control Ns Cm \&= Ns Ar value Ta Set control value 154903873ceSHans Petter Selasky.El 155903873ceSHans Petter Selasky.Pp 156903873ceSHans Petter SelaskyThe available controls are as follows (replace 1575c7f33e1SGeorge C A Reid.Ar dev 158903873ceSHans Petter Selaskywith one of the available devices): 159c36d0422SMateusz Piotrowski.Sm off 160903873ceSHans Petter Selasky.Bl -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent 161c36d0422SMateusz Piotrowski.It Sy Name Ta Sy Value 162c36d0422SMateusz Piotrowski.It Ar dev Cm .volume Ta Xo 163c36d0422SMateusz Piotrowski.Ar vol | 1644014365eSKyle Evans.Oo Cm \&+ | Cm \&- Oc Ar lvol Oo % Oc 1654014365eSKyle Evans.Oo Cm \&: Oo Cm \&+ | Cm \&- Oc Ar rvol Oo % Oc Oc 166c36d0422SMateusz Piotrowski.Xc 167c36d0422SMateusz Piotrowski.It Ar dev Cm .mute Ta Cm 0 | 1 | ^ 168cc7479d7SChristos Margiolis.It Ar dev Cm .mute Ta Cm off | on | toggle 169c36d0422SMateusz Piotrowski.It Ar dev Cm .recsrc Ta Cm ^ | + | - | = 170cc7479d7SChristos Margiolis.It Ar dev Cm .recsrc Ta Cm toggle | add | remove | set 171903873ceSHans Petter Selasky.El 172c36d0422SMateusz Piotrowski.Sm on 17334cf4302SMike Pritchard.Pp 174903873ceSHans Petter SelaskyThe 175c36d0422SMateusz Piotrowski.Ar dev Ns Cm .volume 176c36d0422SMateusz Piotrowskicontrol modifies a device's volume. 177c36d0422SMateusz PiotrowskiThe optional 178903873ceSHans Petter Selasky.Ar lvol 179903873ceSHans Petter Selaskyand/or 180903873ceSHans Petter Selasky.Ar rvol 181c36d0422SMateusz Piotrowskivalues have to be specified. 1824014365eSKyle EvansThe values should typically be decimal numbers between 0 and 1 with at most 2 1834014365eSKyle Evansdigits after the decimal point. 1844014365eSKyle EvansA trailing percent sign indicates that the value should be treated as a 1854014365eSKyle Evanspercentage of 1.0, rather than an absolute value. 1864014365eSKyle EvansThus, 70% means the same as 0.7. 187c36d0422SMateusz PiotrowskiIf the left or right volume values are prefixed with 188f062eac4SRuslan Ermilov.Cm + 18922baecf2SMatthew N. Doddor 190f062eac4SRuslan Ermilov.Cm - , 19122baecf2SMatthew N. Doddthe value following will be used as a relative adjustment, modifying the 19222baecf2SMatthew N. Doddcurrent settings by the amount specified. 1934014365eSKyle EvansNote that relative percentages are still relative to 1.0, not to the current 1944014365eSKyle Evansvalue. 1954014365eSKyle EvansIf the volume is currently 0.40 and an adjustment of +20% is specified, then 1964014365eSKyle Evansthet final volume will be set to 0.60. 19722baecf2SMatthew N. Dodd.Pp 19895e96c00SHans Petter SelaskyVolume can also be set using the shorthand 19995e96c00SHans Petter Selasky.Ar dev Ns Cm =value . 20095e96c00SHans Petter SelaskyThis syntax does not apply to other controls. 20195e96c00SHans Petter Selasky.Pp 202903873ceSHans Petter SelaskyThe 203c36d0422SMateusz Piotrowski.Ar dev Ns Cm .mute 204c36d0422SMateusz Piotrowskicontrol (un)mutes a device. 205c36d0422SMateusz PiotrowskiThe following values are available: 206cc7479d7SChristos Margiolis.Bl -tag -width "xxxxxxxxxx" -offset indent 207cc7479d7SChristos Margiolis.It Cm 0 | off 208903873ceSHans Petter Selaskyunmutes 209c36d0422SMateusz Piotrowski.Ar dev 210cc7479d7SChristos Margiolis.It Cm 1 | on 211903873ceSHans Petter Selaskymutes 212c36d0422SMateusz Piotrowski.Ar dev 213cc7479d7SChristos Margiolis.It Cm ^ | toggle 214903873ceSHans Petter Selaskytoggles the mute of 215c36d0422SMateusz Piotrowski.Ar dev 216903873ceSHans Petter Selasky.El 2177a120348SJordan K. Hubbard.Pp 218a1039247SMatthew N. DoddThe 219c36d0422SMateusz Piotrowski.Ar dev Ns Cm .recsrc 220903873ceSHans Petter Selaskycontrol modifies the recording sources of a mixer. 221903873ceSHans Petter Selasky.Nm 222903873ceSHans Petter Selaskymarks devices which can be used as a recording source with 223c36d0422SMateusz Piotrowski.Sy rec . 224903873ceSHans Petter SelaskyRecording sources are marked with 225c36d0422SMateusz Piotrowski.Sy src . 226903873ceSHans Petter SelaskyTo modify the recording source you can use one of the following modifiers 227903873ceSHans Petter Selaskyon a 228c36d0422SMateusz Piotrowski.Sy rec 229903873ceSHans Petter Selaskydevice: 230cc7479d7SChristos Margiolis.Bl -tag -width "xxxxxxxxxx" -offset indent 231cc7479d7SChristos Margiolis.It Cm ^ | toggle 232eddcf96dSJohn-Mark Gurneytoggles 233903873ceSHans Petter Selasky.Ar dev 234eddcf96dSJohn-Mark Gurneyof possible recording devices 235cc7479d7SChristos Margiolis.It Cm + | add 236eddcf96dSJohn-Mark Gurneyadds 237903873ceSHans Petter Selasky.Ar dev 238eddcf96dSJohn-Mark Gurneyto possible recording devices 239cc7479d7SChristos Margiolis.It Cm - | remove 240eddcf96dSJohn-Mark Gurneyremoves 241903873ceSHans Petter Selasky.Ar dev 242eddcf96dSJohn-Mark Gurneyfrom possible recording devices 243cc7479d7SChristos Margiolis.It Cm = | set 244cc7479d7SChristos Margiolismakes 245903873ceSHans Petter Selasky.Ar dev 246cc7479d7SChristos Margiolisthe only recording device. 247903873ceSHans Petter Selasky.El 248903873ceSHans Petter Selasky.Sh FILES 249903873ceSHans Petter Selasky.Bl -tag -width /dev/mixerN -compact 250903873ceSHans Petter Selasky.It Pa /dev/mixerN 251903873ceSHans Petter SelaskyThe mixer device, where 252903873ceSHans Petter Selasky.Ar N 253903873ceSHans Petter Selaskyis the number of that device, for example 254903873ceSHans Petter Selasky.Ar /dev/mixer0 . 255903873ceSHans Petter SelaskyPCM cards and mixers have a 1:1 relationship, which means that 256c36d0422SMateusz Piotrowski.Pa /dev/mixer0 257903873ceSHans Petter Selaskyis the mixer for 258c36d0422SMateusz Piotrowski.Pa /dev/pcm0 259c36d0422SMateusz Piotrowskiand so on. 260c36d0422SMateusz PiotrowskiBy default, 261903873ceSHans Petter Selasky.Nm 262903873ceSHans Petter Selaskyprints both the audio card's number and the mixer associated with it 263903873ceSHans Petter Selaskyin the form of 264903873ceSHans Petter Selasky.Ar pcmN:mixer . 265903873ceSHans Petter SelaskyThe 266c36d0422SMateusz Piotrowski.Pa /dev/mixer 267c36d0422SMateusz Piotrowskifile, although it does not exist in the filesystem, points to the default 268903873ceSHans Petter Selaskymixer device and is the file 269903873ceSHans Petter Selasky.Nm 270903873ceSHans Petter Selaskyopens when the 271903873ceSHans Petter Selasky.Fl f Ar device 272903873ceSHans Petter Selaskyoption has not been specified. 273903873ceSHans Petter Selasky.El 274903873ceSHans Petter Selasky.Sh EXAMPLES 27575be886eSChristos MargiolisList all available audio devices in the system: 27675be886eSChristos Margiolis.Bd -literal -offset indent 27775be886eSChristos Margiolis$ mixer -a | grep ^pcm 27875be886eSChristos Margiolis.Ed 27975be886eSChristos Margiolis.Pp 2807bd14d09SChristos MargiolisIncrease the 281246e0457SAlexander Ziaee.Cm vol 2827bd14d09SChristos Margiolisdevice's volume by 5%: 283246e0457SAlexander Ziaee.Bd -literal -offset indent 2847bd14d09SChristos Margiolis$ mixer vol=+5% 285246e0457SAlexander Ziaee.Ed 286246e0457SAlexander Ziaee.Pp 287903873ceSHans Petter SelaskyChange the volume for the 288c36d0422SMateusz Piotrowski.Cm vol 289903873ceSHans Petter Selaskydevice of the 290c36d0422SMateusz Piotrowski.Pa /dev/mixer0 291903873ceSHans Petter Selaskymixer device to 0.65: 292c36d0422SMateusz Piotrowski.Bd -literal -offset indent 293c36d0422SMateusz Piotrowski$ mixer -f /dev/mixer0 vol.volume=0.65 294c36d0422SMateusz Piotrowski.Ed 295eddcf96dSJohn-Mark Gurney.Pp 296903873ceSHans Petter SelaskyIncrease the 297c36d0422SMateusz Piotrowski.Cm mic 298903873ceSHans Petter Selaskydevice's left volume by 0.10 and decrease the right 299903873ceSHans Petter Selaskyvolume by 0.05: 300c36d0422SMateusz Piotrowski.Bd -literal -offset indent 301c36d0422SMateusz Piotrowski$ mixer mic.volume=+0.10:-0.05 302c36d0422SMateusz Piotrowski.Ed 303eddcf96dSJohn-Mark Gurney.Pp 304903873ceSHans Petter SelaskyToggle the mute for 305c36d0422SMateusz Piotrowski.Cm vol : 306c36d0422SMateusz Piotrowski.Bd -literal -offset indent 307cc7479d7SChristos Margiolis$ mixer vol.mute=toggle 308c36d0422SMateusz Piotrowski.Ed 309eddcf96dSJohn-Mark Gurney.Pp 310cc7479d7SChristos MargiolisAdd 311c36d0422SMateusz Piotrowski.Cm mic 312cc7479d7SChristos Margiolisand remove 313c36d0422SMateusz Piotrowski.Cm line 314cc7479d7SChristos Margiolisfrom the recording devices: 315c36d0422SMateusz Piotrowski.Bd -literal -offset indent 316cc7479d7SChristos Margiolis$ mixer mic.recsrc=add line.recsrc=remove 317c36d0422SMateusz Piotrowski.Ed 318903873ceSHans Petter Selasky.Pp 319903873ceSHans Petter SelaskyDump 320c36d0422SMateusz Piotrowski.Pa /dev/mixer0 321c36d0422SMateusz Piotrowskiinformation to a file and retrieve back later: 322c36d0422SMateusz Piotrowski.Bd -literal -offset indent 323c36d0422SMateusz Piotrowski$ mixer -f /dev/mixer0 -o > info 324c36d0422SMateusz Piotrowski\&... 325c36d0422SMateusz Piotrowski$ mixer -f /dev/mixer0 `cat info` 326c36d0422SMateusz Piotrowski.Ed 327*9aac2759SChristos Margiolis.Pp 328*9aac2759SChristos MargiolisSuppose 329*9aac2759SChristos Margiolis.Xr virtual_oss 8 330*9aac2759SChristos Margiolisis running with 331*9aac2759SChristos Margiolis.Pa /dev/vdsp.ctl 332*9aac2759SChristos Margiolisas its control device, and 333*9aac2759SChristos Margiolis.Pa pcm0 334*9aac2759SChristos Margiolisas the playback device. 335*9aac2759SChristos MargiolisChange the default device to 336*9aac2759SChristos Margiolis.Pa pcm1 , 337*9aac2759SChristos Margiolisand hot-swap to it for both recording and playback in 338*9aac2759SChristos Margiolis.Xr virtual_oss 8 : 339*9aac2759SChristos Margiolis.Bd -literal -offset indent 340*9aac2759SChristos Margiolis$ mixer -d pcm1 -V /dev/vdsp.ctl:all 341*9aac2759SChristos Margiolis.Ed 34234cf4302SMike Pritchard.Sh SEE ALSO 343903873ceSHans Petter Selasky.Xr mixer 3 , 344903873ceSHans Petter Selasky.Xr sound 4 , 345*9aac2759SChristos Margiolis.Xr sysctl 8 , 346*9aac2759SChristos Margiolis.Xr virtual_oss 8 34734cf4302SMike Pritchard.Sh HISTORY 34834cf4302SMike PritchardThe 34934cf4302SMike Pritchard.Nm 350c36d0422SMateusz Piotrowskiutility first appeared in 351c36d0422SMateusz Piotrowski.Fx 2.0.5 352c36d0422SMateusz Piotrowskiand was rewritten completely in 353c36d0422SMateusz Piotrowski.Fx 14.0 . 35434cf4302SMike Pritchard.Sh AUTHORS 355db6ba1e0SHans Petter Selasky.An Christos Margiolis Aq Mt christos@FreeBSD.org 356