ubuntu音量设置

来源:互联网 发布:无主之地2mac 编辑:程序博客网 时间:2024/05/16 11:49

1.开机音量设置

在开机脚本中加入下面的内容

pulseaudio -D --system   //pulseaudio修改为系统启动#amixer cset numid=12,iface=MIXER,name='Master Playback Volume' 64#amixer cset numid=1,iface=MIXER,name='Headphone Playback Volume' 64#amixer cset numid=19,iface=MIXER,name='PCM Playback Volume' 255#amixer set PCM 100% unmute  //设置双声道的音量#amixer set Headphone 100% unmute#alsactl --file /root/.config/asound.state restore  //恢复之前保存的音量设置amixer set 'Mic Boost' 3amixer -c 0 sset 'Headphone',0 100%,0% unmute //设置单声道的音量amixer -c 0 sset 'PCM',0 100%,0% unmuteamixer set Master 100% unmute 

2.开机后的音量设置

1>首先解除Master和 Headphone 静音

sudo amixer set 'Master' unmute

sudo amixer set 'Headphone' unmute

执行

#amixer sset Master unmute

取消静音时,显示如下错误消息:

amixer: Unable to find simple control 'Master',0

执行

#speaker-test -c 2

测试声音时,显示错误:

ALSAlibpcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

-------------------------------------------------------------------------------------------

问题就在默认声卡不对,需要修改默认声卡。

解决如下:

执行

#aplay -l

显示如下(因声卡型号而异):

**** ListofPLAYBACKHardwareDevices ****card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices:1/1
  Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

此处选择声卡1,设备ID为0的声卡 (card 1, deice 0)

新建文件 ~/.asoundrc 或者 /etc/asound.conf,添加如下内容:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1


2>音量与Master、Headphone和PCM这三个参数有关,调节任意一个都可以改变音量

升高音量:
amixer set ‘Master’ 5%+
降低音量:
amixer set ‘Master’ 5%-

设置静音

sudo amixer set 'Master' mute 或者 sudo amixer set 'Headphone' mute

调节录音音量, 调节Mic Boost

sudo amixer set 'Mic Boost' 50%

其他操作命令amixer -h 查看



原创粉丝点击