-
Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

.Dd February 8, 2024 .Dt MIXER 8 .Os .Sh NAME .Nm mixer .Nd manipulate soundcard mixer controls .Sh SYNOPSIS .Nm .Op Fl f Ar device .Op Fl d Ar pcmN | N .Op Fl os .Op Ar dev Ns Op Cm . Ns Ar control Ns Op Cm = Ns Ar value .Ar ... .Nm .Op Fl os .Fl a .Nm .Fl h .Sh DESCRIPTION The .Nm utility is used to set and display soundcard mixer device controls.

p The options are as follows: l -tag -width "-d pcmN | N" t Fl a Print the values for all mixer devices available in the system

q see Sx FILES . t Fl d Ar pcmN | N Change the default audio card to .Ar pcmN , where N is the unit number (e.g for pcm0, the unit number is 0). See .Sx EXAMPLES on how to list all available audio devices in the system. t Fl f Ar device Open .Ar device as the mixer device

q see Sx FILES . t Fl h Print a help message. t Fl o Print mixer values in a format suitable for use inside scripts. The mixer's header (name, audio card name, ...) will not be printed. t Fl s Print only the recording source(s) of the mixer device. .El

p The list of mixer devices that may be modified are: d -ragged -offset indent .Cm vol , bass , treble , synth , pcm , speaker , line , mic , cd , mix , .Cm pcm2 , rec , .Cm igain , ogain , .Cm line1 , line2 , line3 , .Cm dig1 , dig2 , dig3 , .Cm phin , phout , video , radio , and .Cm monitor . .Ed

p Not all mixer devices are available.

p Without any arguments, .Nm displays all information for each one of the mixer's supported devices to .Ar stdout . If the .Ar dev argument is specified, .Nm displays only the values for .Ar dev . More than one device may be specified.

p Commands use the following format: l -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent t Sy Name Ta Sy Action t Ar dev Ta Display all controls t Ar dev Ns Cm . Ns Ar control Ta Display only the specified control t Ar dev Ns Cm . Ns Ar control Ns Cm = Ns Ar value Ta Set control value .El

p The available controls are as follows (replace .Ar dev with one of the available devices): .Sm off l -column xxxxxxxxxxxxxxxxxxxxxxxx -offset indent t Sy Name Ta Sy Value t Ar dev Cm .volume Ta Xo .Ar vol | .Oo Cm + | Cm - Oc Ar lvol Oo % Oc .Oo Cm : Oo Cm + | Cm - Oc Ar rvol Oo % Oc Oc .Xc t Ar dev Cm .mute Ta Cm 0 | 1 | ^ t Ar dev Cm .mute Ta Cm off | on | toggle t Ar dev Cm .recsrc Ta Cm ^ | + | - | = t Ar dev Cm .recsrc Ta Cm toggle | add | remove | set .El .Sm on

p The .Ar dev Ns Cm .volume control modifies a device's volume. The optional .Ar lvol and/or .Ar rvol values have to be specified. The values should typically be decimal numbers between 0 and 1 with at most 2 digits after the decimal point. A trailing percent sign indicates that the value should be treated as a percentage of 1.0, rather than an absolute value. Thus, 70% means the same as 0.7. If the left or right volume values are prefixed with .Cm + or .Cm - , the value following will be used as a relative adjustment, modifying the current settings by the amount specified. Note that relative percentages are still relative to 1.0, not to the current value. If the volume is currently 0.40 and an adjustment of +20% is specified, then thet final volume will be set to 0.60.

p Volume can also be set using the shorthand .Ar dev Ns Cm =value . This syntax does not apply to other controls.

p The .Ar dev Ns Cm .mute control (un)mutes a device. The following values are available: l -tag -width "xxxxxxxxxx" -offset indent t Cm 0 | off unmutes .Ar dev t Cm 1 | on mutes .Ar dev t Cm ^ | toggle toggles the mute of .Ar dev .El

p The .Ar dev Ns Cm .recsrc control modifies the recording sources of a mixer. .Nm marks devices which can be used as a recording source with .Sy rec . Recording sources are marked with .Sy src . To modify the recording source you can use one of the following modifiers on a .Sy rec device: l -tag -width "xxxxxxxxxx" -offset indent t Cm ^ | toggle toggles .Ar dev of possible recording devices t Cm + | add adds .Ar dev to possible recording devices t Cm - | remove removes .Ar dev from possible recording devices t Cm = | set makes .Ar dev the only recording device. .El .Sh FILES l -tag -width /dev/mixerN -compact t Pa /dev/mixerN The mixer device, where .Ar N is the number of that device, for example .Ar /dev/mixer0 . PCM cards and mixers have a 1:1 relationship, which means that

a /dev/mixer0 is the mixer for

a /dev/pcm0 and so on. By default, .Nm prints both the audio card's number and the mixer associated with it in the form of .Ar pcmN:mixer . The

a /dev/mixer file, although it does not exist in the filesystem, points to the default mixer device and is the file .Nm opens when the .Fl f Ar device option has not been specified. .El .Sh EXAMPLES List all available audio devices in the system: d -literal -offset indent $ mixer -a | grep ^pcm .Ed

p Increase the .Cm vol device's volume by 5%: d -literal -offset indent $ mixer vol=+5% .Ed

p Change the volume for the .Cm vol device of the

a /dev/mixer0 mixer device to 0.65: d -literal -offset indent $ mixer -f /dev/mixer0 vol.volume=0.65 .Ed

p Increase the .Cm mic device's left volume by 0.10 and decrease the right volume by 0.05: d -literal -offset indent $ mixer mic.volume=+0.10:-0.05 .Ed

p Toggle the mute for .Cm vol : d -literal -offset indent $ mixer vol.mute=toggle .Ed

p Add .Cm mic and remove .Cm line from the recording devices: d -literal -offset indent $ mixer mic.recsrc=add line.recsrc=remove .Ed

p Dump

a /dev/mixer0 information to a file and retrieve back later: d -literal -offset indent $ mixer -f /dev/mixer0 -o > info ... $ mixer -f /dev/mixer0 `cat info` .Ed .Sh SEE ALSO .Xr mixer 3 , .Xr sound 4 , .Xr sysctl 8 .Sh HISTORY The .Nm utility first appeared in .Fx 2.0.5 and was rewritten completely in .Fx 14.0 . .Sh AUTHORS .An Christos Margiolis Aq Mt christos@FreeBSD.org