arecord:set_params:1233:样本格式不可用可用格式: - S16_LE

时间:2016-03-24 19:08:26

标签: audio raspberry-pi3

我有一个连接到树莓派3的USB麦克风和扬声器适配器。我已经在alsamixer上设置了所有内容。我还在主目录中的pcm.!default sysdefault:0文件中设置.asoundrc,将usb音频适配器设置为默认音频卡。

我已经运行:aplay -l,输出为:

card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
 Subdevices: 7/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
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

然后我在主目录的.asoundrc文件中设置pcm。!default sysdefault:0。

当我运行命令时:arecord -d 5 -r 48000 test.wav

我收到此错误:

  

arecord:set_params:1233:样本格式不可用可用   格式: - S16_LE

2 个答案:

答案 0 :(得分:9)

解决方案是将.asoundrc更改为:

pcm.!default {
  type plug
  slave {
    pcm "hw:1,0"
  }
}

ctl.!default {
    type hw
    card 1
}

答案 1 :(得分:0)

有效的通用配置为:

$ sudo nano ~/.asoundrc

pcm.!default {
    type asym
    playback.pcm {
    type plughw
    slave.pcm "output"
    }
    capture.pcm {
    type plughw
    slave.pcm "input"
    }
}

pcm.output{
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}