0

I'm setting up alexa-pi and everything was going smoothly until the final step which is running a wake word engine. I'm keep getting " 'pcm' failed." error. I've read somewhere that in order to this to work first I need to make sure that arecord -d 10 -f S16_LE -r 16000 test.wav command would record my voice input, however when I try to run it I get

arecord: main:722: audio open error: No such file or directory

Here's some of my outputs

~$ cat /proc/asound/modules 
 0 snd_bcm2835
 1 snd_usb_audio

~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Mic122033996 [Wireless Mic #122033996], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Also I had to put this .conf file in /etc/modprobe.d/ so alsa can see my microphone (it couldn't before)

# This sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=1
options snd_bcm2835 index=0

# Does the reordering.
options snd slots=snd_bcm2835,snd_usb_audio

and here's whats wake word engine throws:

$ ./wakeWordAgent -e sensory
INFO:main: Starting Wake Word Agent
INFO:WakeWordAgent: State set to IDLE(2)
INFO:Initializing Sensory library | library name: TrulyHandsfree | library version: 5.0.0-avs.1 | model file: ../ext/resources/spot-alexa-rpi.snsr
WARNING:Library expires on: License expires on 28 Apr 2017 00:00:00 GMT
wakeWordAgent: pcm.c:694: snd_pcm_close: Assertion `pcm' failed.

2 Answers 2

0

Ok, I've solved my problem replacing ~/.asoundrc file with this content

pcm.!default { type asym playback.pcm { type plug slave.pcm "hw:0" } capture.pcm { type plug slave.pcm "hw:1" } }
2
  • I would suggest you instead just specify the device in the arecord command. Setting hot-pluggable devices as default in the asound file will cause you trouble later. From experience.
    – Hydranix
    Commented Jan 12, 2017 at 23:36
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Commented Dec 20, 2019 at 23:56
0

Try this command:

arecord -D hw:1,0 -d 10 -f S16_LE -r 22050 test.wav

-D sets the device specifically, otherwise it may be trying to use a non existant input device on hw:0.

You can also set your soundcard index for snd_usb_audio to index=0 and the snd_bcm2835 to index=1 but specifying the device in the command is more reliable.

Further, though maybe not required for this, make sure you have this line in your /boot/config.txt

dtparam=audio=on
3
  • Thanks, but like I said that doesn't solve my problem arecord -d 10 -f S16_LE -r 16000 test.wavshould work without specifing any devices and only then maybe I can get a wake word engine to work
    – gosu94
    Commented Jan 12, 2017 at 21:44
  • arecord without specifying a device will try to use the default device. The default device will be whatever you have set in your /etc/asound.conf or ~/.asoundrc.
    – Hydranix
    Commented Jan 12, 2017 at 23:32
  • See updated answer with the dtparam setting. I know on archlinux i had trouble with audio until I set that.
    – Hydranix
    Commented Jan 12, 2017 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.