synesthesiam / voice2json

Command-line tools for speech and intent recognition on Linux
MIT License
1.09k stars 63 forks source link

arecord: main:828: audio open error: No such file or directory #28

Closed juggledad closed 3 years ago

juggledad commented 4 years ago

So I'm slowly making progress. I've downloaded a profile (en-us_pocketsphinx-cmu) and ran the training and that all worked. But when I try a test voice2json transcribe-stream I get an error:

pi@coronapi:~ $ voice2json transcribe-stream
arecord: main:828: audio open error: No such file or directory
Ready

I went and checked my microphone

pi@coronapi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: MV5 [Shure MV5], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
pi@coronapi:~ $ arecord -D hw:1,0 -d 5 -f cd test.wav -c 1
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
arecord: set_params:1345: Channels count non available

but it wouldn't work with the -c 1 option. When I removed it, it recorded and played back fine.

pi@coronapi:~ $ arecord -D hw:1,0 -d 5 -f cd test.wav 
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
pi@coronapi:~ $ aplay test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

any thoughts?

synesthesiam commented 4 years ago

Try using arecord -L (capital L) and picking your microphone device where it says "Hardware device with all software conversions". That should allow for the right audio format to come right out of arecord.

juggledad commented 4 years ago

Thanks, that helps. When I used the record -L, at the end of a long output it showed

plughw:CARD=MV5,DEV=0
    Shure MV5, USB Audio
    Hardware device with all software conversions

however I still got the error:

pi@coronapi:~ $ arecord -D hw:MV5,0 -d 5 -f cd test.wav -c 1
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
arecord: set_params:1345: Channels count non available

so I tried changing the -c option to -c 0 but then I discovered it will work if I use -c 2 so if I use arecord -D hw:MV5,0 -d 5 -f cd test.wav -c 2 or arecord -D hw:1,0 -d 5 -f cd test.wav -c 2 it will work.