amixer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# amixer --help
Usage: amixer <options> [command]

Available options:
-h,--help this help
-c,--card N select the card
-D,--device N select the device, default 'default'
-d,--debug debug mode
-n,--nocheck do not perform range checking
-v,--version print version of this program
-q,--quiet be quiet
-i,--inactive show also inactive controls
-a,--abstract L select abstraction level (none or basic)
-s,--stdin Read and execute commands from stdin sequentially
-R,--raw-volume Use the raw value (default)
-M,--mapped-volume Use the mapped volume

Available commands:
scontrols show all mixer simple controls
scontents show contents of all mixer simple controls (default command)
sset sID P set contents for one mixer simple control
sget sID get contents for one mixer simple control
controls show all controls for given card
contents show contents of all controls for given card
cset cID P set control contents for one control
cget cID get control contents for one control

 使用 amixer scontrols 命令查看 audio driver 提供可以控制的接口,例如 WM8940 提供以下接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# amixer scontrols
Simple mixer control 'Speaker',0
Simple mixer control 'Speaker Mixer Line Bypass',0
Simple mixer control 'Speaker Playback ZC',0
Simple mixer control 'Mic Bias Level',0
Simple mixer control 'Mono Mixer Line Bypass',0
Simple mixer control 'Mono Out',0
Simple mixer control 'Capture',0
Simple mixer control 'Capture Boost Volue',0
Simple mixer control 'Capture PGA',0
Simple mixer control 'Capture PGA ZC',0
Simple mixer control 'ADC Companding',0
Simple mixer control 'ADC Inversion',0
Simple mixer control 'ALC',0
Simple mixer control 'ALC Capture Attach',0
Simple mixer control 'ALC Capture Decay',0
Simple mixer control 'ALC Capture Hold',0
Simple mixer control 'ALC Capture Max Gain',0
Simple mixer control 'ALC Capture Min Gain',0
Simple mixer control 'ALC Capture Noise Gate',0
Simple mixer control 'ALC Capture Noise Gate Threshold',0
Simple mixer control 'ALC Capture Target',0
Simple mixer control 'ALC Mode',0
Simple mixer control 'ALC ZC',0
Simple mixer control 'DAC Auto Mute',0
Simple mixer control 'DAC Companding',0
Simple mixer control 'DAC Inversion',0
Simple mixer control 'DAC Playback Limiter',0
Simple mixer control 'DAC Playback Limiter Attack',0
Simple mixer control 'DAC Playback Limiter Boost',0
Simple mixer control 'DAC Playback Limiter Decay',0
Simple mixer control 'DAC Playback Limiter Threshold',0
Simple mixer control 'DigiCapture',0
Simple mixer control 'DigiPlayback',0
Simple mixer control 'Digital Loopback',0
Simple mixer control 'High Pass Filter',0
Simple mixer control 'High Pass Filter Cut Off',0
Simple mixer control 'High Pass Filter Mode',0
Simple mixer control 'Input',0
Simple mixer control 'ZC Timeout Clock',0

 使用 amixer scontents 命令可以看到各個接口目前的數值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# amixer scontents
Simple mixer control 'Speaker',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 63
Mono: Playback 63 [100%] [6.00dB] [on]
Simple mixer control 'Speaker Mixer Line Bypass',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 1
Mono: 1 [100%] [0.00dB]
Simple mixer control 'Speaker Playback ZC',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'Mic Bias Level',0
Capabilities: enum
Items: '0.9' '0.65'
Item0: '0.9'
Simple mixer control 'Mono Mixer Line Bypass',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 1
Mono: 1 [100%] [0.00dB]
...

 使用 amixer sget 接口名稱 可以查看特定接口的數值

1
2
3
4
5
6
7
# amixer sget 'Capture PGA',0
Simple mixer control 'Capture PGA',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 63
Mono: 63 [100%] [35.25dB]

 使用 amixer sset 接口名稱 數值 可以設定特定接口的數值

1
2
3
4
5
6
7
# amixer sset 'Capture PGA',0 63
Simple mixer control 'Capture PGA',0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 63
Mono: 63 [100%] [35.25dB]