我想从.arecordrc文件中读取播放内容,但失败。

pi@raspberrypi:~ $ aplay numnuts.wav
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
aplay: main:722: audio open error: No such device

当我在命令行中提供硬件时,它可以工作
pi@raspberrypi:~ $ aplay -D hw:0,0 numnuts.wav
Playing WAVE 'numnuts.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono

我的.asoundrc:
pi@raspberrypi:~ $ cat .asoundrc
pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:0:0"
  }
}

谁能建议我pcm的变化。扬声器

aplay -l输出
pi@raspberrypi:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/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

最佳答案

解决它,这是一个错字错误:

在pcm.speaker中

replace pcm "hw:0:0"


pcm "hw:0,0"

关于linux - aplay无法从config .asoundrc中读取,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47605535/

10-13 04:18