linux 终端使用aplay播放wav

aplay -D plughw:0,0 xxx.wav

plughw后面的0,0指的是card0,device0.(声卡id和设备id),根据个人情况会有不同

声卡id和设备id可以通过aplay -l命令来查看

比如:

upsquared@ubuntu:~/work18.7.12$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
 

从上面可以看出我的audio设备是最后一个:

card 2: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

声卡id为2(因为是card2),设备id为0,所以aplay -D plughw:2,0 xxx.wav 即可。

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注