aplay无法从config .asoundrc中读取

时间:2017-12-02 07:12:21

标签: linux audio raspberry-pi raspberry-pi3 alsa

我希望aplay从.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 output

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

1 个答案:

答案 0 :(得分:0)

解决了它,这是一个错误的错误:

在pcm.speaker中

operator new

replace pcm "hw:0:0"