怎么用命令行调整音量大小?

为当前最终发行版之前的所有版本提供支持
回复
头像
wisner
帖子: 172
注册时间: 2013-08-27 21:27
送出感谢: 0
接收感谢: 0

怎么用命令行调整音量大小?

#1

帖子 wisner » 2019-09-21 11:51

怎么在命令行调整系统的音量?我看了下alsamixer和pulseaudio的介绍,有点看不明白。怎么用命令行增大或减小音量?
头像
astolia
论坛版主
帖子: 4302
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 720 次

Re: 怎么用命令行调整音量大小?

#2

帖子 astolia » 2019-09-22 10:00

对于puleaudio:
先用

代码: 全选

pactl list sinks

代码: 全选

pacmd list-sinks
确定你当前的sink序号,再用

代码: 全选

pactl set-sink-volume sink序号 音量
音量除了50%这种绝对值外,还可以用+5%、-5%这种相对值

针对alsa

代码: 全选

amixer set Master 50%
amixer set Master 5%+
amixer set Master 5%-
头像
wisner
帖子: 172
注册时间: 2013-08-27 21:27
送出感谢: 0
接收感谢: 0

Re: 怎么用命令行调整音量大小?

#3

帖子 wisner » 2019-09-22 11:57

信宿 #0
状态:SUSPENDED
名称:alsa_output.pci-0000_00_1b.0.analog-stereo
描述:内置音频 模拟立体声
驱动程序:module-alsa-card.c
采样规格:s16le 2ch 44100Hz
声道映射:front-left,front-right
所有者模块:7
静音:否
音量:front-left: 46396 / 71% / -9.00 dB, front-right: 46396 / 71% / -9.00 dB
平衡 0.00
基础音量:65536 / 100% / 0.00 dB
监视器信源:alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
延迟:0 微秒,设置为 0 微秒
标记:HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
属性:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC662 rev1 Analog"
alsa.id = "ALC662 rev1 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xf7d10000 irq 31"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1b.0"
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "1e20"
device.product.name = "7 Series/C216 Chipset Family High Definition Audio Controller"
device.form_factor = "internal"
device.string = "front:0"
device.buffering.buffer_size = "65536"
device.buffering.fragment_size = "32768"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "模拟立体声"
device.description = "内置音频 模拟立体声"
alsa.mixer_name = "Realtek ALC662 rev1"
alsa.components = "HDA:10ec0662,10ec0662,00100101 HDA:80862806,80860101,00100000"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
端口:
analog-output-speaker: 扬声器 (priority: 10000)
analog-output-headphones: 模拟耳机 (priority: 9000, not available)
活动端口:analog-output-speaker
格式:
pcm

信宿 #1
状态:SUSPENDED
名称:bluez_sink.41_42_2B_54_7D_6C.a2dp_sink
描述:S109
驱动程序:module-bluez5-device.c
采样规格:s16le 2ch 48000Hz
声道映射:front-left,front-right
所有者模块:24
静音:否
音量:front-left: 39844 / 61% / -12.97 dB, front-right: 39844 / 61% / -12.97 dB
平衡 0.00
基础音量:65536 / 100% / 0.00 dB
监视器信源:bluez_sink.41_42_2B_54_7D_6C.a2dp_sink.monitor
延迟:0 微秒,设置为 0 微秒
标记:HARDWARE DECIBEL_VOLUME LATENCY
属性:
bluetooth.protocol = "a2dp_sink"
device.description = "S109"
device.string = "41:42:2B:54:7D:6C"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "headphone"
bluez.path = "/org/bluez/hci0/dev_41_42_2B_54_7D_6C"
bluez.class = "0x240418"
bluez.alias = "S109"
device.icon_name = "audio-headphones-bluetooth"
端口:
headphone-output: 头戴耳机 (priority: 0)
活动端口:headphone-output
格式:
pcm
头像
wisner
帖子: 172
注册时间: 2013-08-27 21:27
送出感谢: 0
接收感谢: 0

Re: 怎么用命令行调整音量大小?

#4

帖子 wisner » 2019-09-22 12:03

上面是我用pactl list sinks得到的结果。这个sink是什么?状态为什么都是SUSPENDED?#1是我的蓝牙耳机。哪个是sink序号?
这样增大音量吗?
pactl set-sink-volume sink #0 +5%
头像
astolia
论坛版主
帖子: 4302
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 720 次

Re: 怎么用命令行调整音量大小?

#5

帖子 astolia » 2019-09-22 13:12

sink你可以理解为声音输出设备。当前没有声音输出的情况下状态就是SUSPENDED。
pactl set-sink-volume 0 +5%
或者你用它的名称也行
pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +5%
回复

回到 “老旧版本支持”