Tri*_*ian 102 command-line audio linux-mint
是否可以使用终端而不是单击顶部栏中的扬声器图标来设置音量?
我想这样做的原因是我的键盘没有音量增大/减小按钮,而且我觉得伸手去拿鼠标很烦人。
Ren*_*nan 112
对于交互式使用,您可以使用alsamixer. 对于脚本(例如绑定到组合键),请查看amixer.
alsamixer 在大多数系统中默认包含。
要设置主音量,请使用:
# Gets a list of simple mixer controls
$ amixer scontrols 
Run Code Online (Sandbox Code Playgroud)
然后将其设置为所需的音量,例如
$ amixer sset 'Master' 50%
Run Code Online (Sandbox Code Playgroud)
        enz*_*tib 53
在 Openbox 的配置文件中找到rc.xml:
# increase by 3%
amixer -q sset Master 3%+
# decrease by 3%
amixer -q sset Master 3%-
# mute/unmute
amixer -q sset Master toggle
Run Code Online (Sandbox Code Playgroud)
amixer 手册页可以提供更多详细信息。
don*_*sti 30
如果您的系统正在使用,pulseaudio您可以使用pactl:
pactl set-sink-volume 0 +15%
Run Code Online (Sandbox Code Playgroud)
或者
pactl set-sink-volume 0 -5dB
Run Code Online (Sandbox Code Playgroud)
虽然您也可以指定整数或线性因子:
set-sink-volume SINK VOLUME [VOLUME ...]
          Set the volume of the specified sink (identified by its symbolic name or numerical index). VOLUME can be speci?
          fied as an integer (e.g. 2000, 16384), a linear factor (e.g. 0.4, 1.100), a percentage (e.g. 10%, 100%) or a
          decibel value (e.g. 0dB, 20dB). If the volume specification start with a + or - the volume  adjustment  will  be
          relative to the current sink volume. A single volume value affects all channels; if multiple volume values are
          given their number has to match the sink's number of channels.
Run Code Online (Sandbox Code Playgroud)
        小智 12
我知道这是一个旧的。由于 Alsa 和 pulseaudio 如此紧密相连,askubuntu 的这个答案帮助我管理了主声音和 HDMI 的音量:
增加音量
amixer -q -D pulse sset Master 10%+
Run Code Online (Sandbox Code Playgroud)
减少音量
amixer -q -D pulse sset Master 10%-
Run Code Online (Sandbox Code Playgroud)
切换静音
amixer -q -D pulse sset Master toggle
Run Code Online (Sandbox Code Playgroud)
其他 amixer sset 命令也可以工作。
小智 7
这些“对人耳更自然”。
要在 alsamixer 单元中获取主设备,请使用:
amixer -M get Master
Run Code Online (Sandbox Code Playgroud)
要将 alsamixer 装置的音量提高 5%,例如:
amixer -M set Master 5%+
Run Code Online (Sandbox Code Playgroud)
https://bbs.archlinux.org/viewtopic.php?id=135348
在 OS X 中使用以下命令:
# highest
osascript -e "set Volume 7"
# lowest
osascript -e "set Volume 1"
# middle
osascript -e "set Volume 3.5"  
Run Code Online (Sandbox Code Playgroud)
您甚至可以将音量设置为其他分数级别:
# 25%
osascript -e "set Volume 1.75"
Run Code Online (Sandbox Code Playgroud)