mixer
— manipulate
soundcard mixer controls
mixer |
[-f device]
[-d pcmN |
N [-V
voss_device:mode]] [-os ]
[dev[. control[= value]]]
... |
The mixer
utility is used to set and
display soundcard mixer device controls.
The options are as follows:
-a
- Print the values for all mixer devices available in the system (see
FILES).
-d
pcmN | N
- Change the default audio card to pcmN, where N is
the unit number (e.g for pcm0, the unit number is 0). See
EXAMPLES on how to list all available
audio devices in the system.
There is also the possibility of hot-swapping to the new
default device if
virtual_oss(8)
exists in the system and is running, in which case the
-V
option needs to be specified as well.
Hot-swapping generally cannot happen with plain
sound(4),
so the user has to restart the track in order to get sound coming out of
the new default device. This is because applications usually open a
device at the start of the track and do not check for default device
changes, in order to open the new device mid-track.
virtual_oss(8),
on the other hand, can do hot-swapping, because it creates a virtual
device for applications to open, and then does all the necessary routing
and conversions to the appropriate device(s).
Note that hot-swapping will work only for applications that
are using
virtual_oss(8)
devices, and not plain
sound(4)
ones.
-f
device
- Open device as the mixer device (see
FILES).
-h
- Print a help message.
-o
- Print mixer values in a format suitable for use inside scripts. The
mixer's header (name, audio card name, ...) will not be printed.
-s
- Print only the recording source(s) of the mixer device.
-V
voss_device:mode
- Specify a
virtual_oss(8)
control device, as well as a mode (see below), in order to hot-swap
devices. This option is meant to only be used in combination with the
-d
option.
The available modes are as follows:
Mode |
Action |
all |
Playback and recording |
play |
Playback |
rec |
Recording |
The mode part is needed, so that
mixer
will not accidentally hot-swap both the
recording and playback device in
virtual_oss(8),
if only one direction is to be hot-swapped.
See EXAMPLES on how to use
this option.
The list of mixer devices that may be modified are:
vol
,
bass
, treble
,
synth
, pcm
,
speaker
, line
,
mic
, cd
,
mix
, pcm2
,
rec
, igain
,
ogain
, line1
,
line2
, line3
,
dig1
, dig2
,
dig3
, phin
,
phout
, video
,
radio
, and monitor
.
Not all mixer devices are available.
Without any arguments, mixer
displays all
information for each one of the mixer's supported devices to
stdout. If the dev argument is
specified, mixer
displays only the values for
dev. More than one device may be specified.
Commands use the following format:
Name |
Action |
dev |
Display all controls |
dev. control |
Display only the specified control |
dev. control= value |
Set control value |
The available controls are as follows (replace
dev with one of the available devices):
The dev.volume
control modifies a device's volume. The optional lvol
and/or 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 +
or -
, 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.
Volume can also be set using the shorthand
dev=value
. This syntax does
not apply to other controls.
The dev.mute
control
(un)mutes a device. The following values are available:
0
|
off
- unmutes dev
1
|
on
- mutes dev
^
|
toggle
- toggles the mute of dev
The
dev.recsrc
control modifies
the recording sources of a mixer. mixer
marks
devices which can be used as a recording source with rec.
Recording sources are marked with
src. To modify the
recording source you can use one of the following modifiers on a
rec device:
^
|
toggle
- toggles dev of possible recording devices
+
|
add
- adds dev to possible recording devices
-
|
remove
- removes dev from possible recording devices
=
|
set
- makes dev the only recording device.
- /dev/mixerN
- The mixer device, where N is the number of that
device, for example /dev/mixer0. PCM cards and
mixers have a 1:1 relationship, which means that
/dev/mixer0 is the mixer for
/dev/pcm0 and so on. By default,
mixer
prints both the audio card's number and the
mixer associated with it in the form of pcmN:mixer.
The /dev/mixer file, although it does not exist in
the filesystem, points to the default mixer device and is the file
mixer
opens when the -f
device option has not been specified.
List all available audio devices in the system:
Increase the vol
device's volume by
5%:
Change the volume for the vol
device of
the /dev/mixer0 mixer device to 0.65:
$ mixer -f /dev/mixer0 vol.volume=0.65
Increase the mic
device's left volume by
0.10 and decrease the right volume by 0.05:
$ mixer mic.volume=+0.10:-0.05
Toggle the mute for vol
:
Add mic
and remove
line
from the recording devices:
$ mixer mic.recsrc=add line.recsrc=remove
Dump /dev/mixer0 information to a file and
retrieve back later:
$ mixer -f /dev/mixer0 -o > info
...
$ mixer -f /dev/mixer0 `cat info`
Suppose
virtual_oss(8)
is running with /dev/vdsp.ctl as its control device,
and pcm0 as the playback device. Change the default
device to pcm1, and hot-swap to it for both
recording and playback in
virtual_oss(8):
$ mixer -d pcm1 -V /dev/vdsp.ctl:all
The mixer
utility first appeared in
FreeBSD 2.0.5 and was rewritten completely in
FreeBSD 14.0.