修改firefly ubuntu 系统音量

修改firefly系统音量(ubuntu)

新建.asoundrc文件(如果设备存在,可以不新建.asoundrc

vi ~/.asoundrc 

插入内容:

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

测试amixer,查看设备和numid等信息

firefly@firefly:~$ amixer controlsnumid=20,iface=MIXER,name='PCM Volume'numid=14,iface=MIXER,name='Capture 
Digital Volume'numid=15,iface=MIXER,name='Capture Mute'numid=19,iface=MIXER,name='Capture 
Polarity'numid=18,iface=MIXER,name='Playback De-emphasis'numid=1,iface=MIXER,name='3D 
Mode'numid=9,iface=MIXER,name='ALC Capture Attack Time'numid=8,iface=MIXER,name='ALC Capture Decay 
Time'numid=5,iface=MIXER,name='ALC Capture Function'numid=7,iface=MIXER,name='ALC Capture Hold 
Time'numid=3,iface=MIXER,name='ALC Capture Max PGA'numid=4,iface=MIXER,name='ALC Capture Min 
PGA'numid=12,iface=MIXER,name='ALC Capture NG Switch'numid=10,iface=MIXER,name='ALC Capture NG 
Threshold'numid=11,iface=MIXER,name='ALC Capture NG Type'numid=2,iface=MIXER,name='ALC Capture Target 
Volume'numid=6,iface=MIXER,name='ALC Capture ZC Switch'numid=16,iface=MIXER,name='Left Channel Capture 
Volume'numid=21,iface=MIXER,name='Left Mixer Left Bypass Volume'numid=23,iface=MIXER,name='Output 1 
Playback Volume'numid=24,iface=MIXER,name='Output 2 Playback Volume'numid=17,iface=MIXER,name='Right 
Channel Capture Volume'numid=22,iface=MIXER,name='Right Mixer Right Bypass 
Volume'numid=13,iface=MIXER,name='ZC Timeout Switch'numid=26,iface=PCM,name='AUDIO 
MODE'numid=25,iface=PCM,name='ELD'

设置系统音量大小设置音量大小命令:

amixer cset numid=20 255
amixer cset numid=20 100%
amixer cset numid=20,iface=MIXER,name='PCM Volume' 255

设置音量大小:

firefly@firefly:~$ amixer cset numid=20,iface=MIXER,name='PCM Volume' 255numid=20,iface=MIXER,name='PCM Volume'  ; type=INTEGER,access=rw---R--,values=2,min=0,max=255,step=0  : values=255,255  | dBscale-min=-96.00dB,step=0.50dB,mute=1

查看设置后结果:

firefly@firefly:~$ amixer scontentsSimple mixer control 'PCM',0  Capabilities: volume  Playback channels: Front Left - Front Right  Capture channels: Front Left - Front Right  Limits: 0 - 255  Front Left: 255 [100%] [31.50dB]  Front Right: 255 [100%] [31.50dB]```设置值和DB值对比:```Front Left: 255 [100%] [31.50dB]  Front Right: 255 [100%] [31.50dB]
  Front Left: 220 [86%] [14.00dB]  Front Right: 220 [86%] [14.00dB]
  Front Left: 200 [78%] [4.00dB]  Front Right: 200 [78%] [4.00dB]
  Front Left: 180 [71%] [-6.00dB]  Front Right: 180 [71%] [-6.00dB]
  Front Left: 100 [39%] [-46.00dB]  Front Right: 100 [39%] [-46.00dB]
  Front Left: 20 [8%] [-86.00dB]  Front Right: 20 [8%] [-86.00dB]
  Front Left: 15 [6%] [-88.50dB]  Front Right: 15 [6%] [-88.50dB]
  Front Left: 1 [0%] [-95.50dB]  Front Right: 1 [0%] [-95.50dB]
  Front Left: 0 [0%] [-99999.99dB]  Front Right: 0 [0%] [-99999.99dB]

你可能感兴趣的:(Liux嵌入式开发)