1 查看系统audio设备
查看audio设备摘要信息
可能的输出:
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
查看audio详细信息
可能输出:
null
Discard all samples (playback) or generate zero samples (capture)
front:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, ALC662 rev1 Digital
IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
HDA NVidia, HDMI 0
HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
HDA NVidia, HDMI 0
HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
HDA NVidia, HDMI 0
HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
HDA NVidia, HDMI 0
HDMI Audio Output
2 配置文件
最简单的/etc/asound.conf格式如下(用户配置文件为~/.asoundrc):
其中card和device的确定从aplay -l命令得到。对比aplaya -l的输出,可以看到上面的配置文件使用了Intel的音频设备。
2.1 设置默认输出设备
首先根据aplay -l的输出来确定声卡ID和设备ID
把Intel模拟输出作为默认audio输出设备
另一种简化格式:
把Nvidia HDMI数字输出作为默认audio输出设备
另一种简化格式:
3 测试audio设备
测试指定audio设备
1 |
$ speaker-test-D front:Intel -c2 -r44100 -FS16_LE -twav |
或者
1 |
speaker-test-c 2 -r 48000 -D hw:1,7 |
测试默认audio设备
1 |
$ speaker-test-c2 -r44100 -FS16_LE -twav |
4 调节audio设备
1 |
$ alsamixer -c 0 <---[声卡编号] |
5 配置文件的保存和还原
1 |
$ alsactl store -f /var/lib/alsa/asound.state |
2 |
$ alsactl restore -f /var/lib/alsa/asound.state |
6 一些其它问题
怎样改变声卡的识别顺序
可以编辑/etc/modprobe.d/50-sound.conf文件,比如:
1 |
options snd slots=snd-hda-intel,snd-hda-intel |
2 |
# u1Nb.XgOz+05oSl4:Intel Corporation |
3 |
aliassnd-card-0 snd-hda-intel |
4 |
# NXNs.vUieta7noB9:nVidia Corporation |
5 |
aliassnd-card-1 snd-hda-intel |
7 |
options snd-hda-intel index=1,0 |
这里需要关心的是最后一行的index=1,0
重启机器后使用命令 cat /proc/asound/cards 参看输出:
0 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xeb000000 irq 17
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xeb300000 irq 42
ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html