问题
i am working on speech recognition . for this i am using "alsa-utils" but when i try to use this script
#!/bin/bash
echo “Recording… Press Ctrl+C to Stop.”
arecord -D plughw:1,0 -q -f cd -t wav | ffmpeg -loglevel panic -y -i – -ar 16000 -acodec flac file.flac > /dev/null 2>&1
echo “Processing…”
wget -q -U “Mozilla/5.0” –post-file file.flac –header “Content-Type: audio/x-flac; rate=16000” -O – “http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium” | cut -d” -f12 >stt.txt
echo -n “You Said: ”
cat stt.txt
rm file.flac > /dev/null 2>&1
i am getting this error
“Recording… Press Ctrl+C to Stop.”
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
arecord: main:722: audio open error: No such file or directory
“Processing…”
please help :(
回答1:
From the pastebin I see card 0
then device 0
or device 1
, so try lining up the arecord
command with card,device
in that order like one of these,
arecord -D plughw:0,0 -q -f cd -t wav | ...
arecord -D plughw:0,1 -q -f cd -t wav | ...
来源:https://stackoverflow.com/questions/35398435/alsa-lib-pcm-hw-c1667-snd-pcm-hw-open-invalid-value-for-card-arecord-main7