1.安装
yum install alsa-utils -y
2.查看音频输出设备
[root@centos-rpi3 mp3]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 6/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
从上面可以看到两个设备0是耳机,1是HDMI,默认HDMI
3.播放音乐,用耳机
[root@centos-rpi3 mp3]# aplay -D hw:0,0 EverydayLove.wav
Playing WAVE 'EverydayLove.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
如果不带设备参数,则会出错,因为我的HDMI木有设备
[root@centos-rpi3 mp3]# aplay EverydayLove.wav
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: 拒绝连接
aplay: main:722: audio open error: 拒绝连接