Running a Raspberry Pi 4 8-gig, Buster, Python 3.7.3
I have been running Speech Recognition for about a year just fine (first on RPi 3B+, then 4 - 4gig, now on 4 - 8gig). Recent update seems to have disabled my microphone input through my USB Sound Card.
I am apparently not alone, but the info I find everywhere pertains to audio OUTPUT, little or nothing about audio INPUT:
https://retropie.org.uk/forum/topic/26434/usb-audio-broke-after-latest-updates/4
Anyway, I noticed that the sound card had been Card 1, but when I ran
cat /proc/asound/cards
The output showed a new card in position 1: Headphones. The USB Device had been moved to 2:
0 [b1 ]: bcm2835_hdmi - bcm2835 HDMI 1
bcm2835 HDMI 1
1 [Headphones ]: bcm2835_headphonbcm2835 Headphones - bcm2835 Headphones
bcm2835 Headphones
2 [Device ]: USB-Audio - USB Audio Device
GeneralPlus USB Audio Device at usb-0000:01:00.0-1.4, full speed
So to verify that the hardware was working, I tested successfully:
arecord -D plughw:2,0 -d 4 test.wav && aplay -D plughw:2,0 test.wav
Whereas in the past that test required plughw:1,0
There is no setting I know of in python Speech_Recognition to specify the sound card. It appears to just use whatever the default is. So I tried to set the defaults.
I changed card from 1 to 2 in /home/pi/.asoundrc
I tried sudo nano /etc/asound.conf
pcm.!default {
type hw card 2
}
ctl.!default {
type hw card 2
}
Rebooting of course. None of that worked.
So I tried editing /boot/config.txt to turn off the on-board sound by changing dtparam=audio=on to dtparam=audio=off and rebooting.
This did disable the onboard sound, and showed only the USB card as available, and on Card 1. So I changed everything back from card 2 to card 1 that I had edited previously, still no luck.
I tried using the lower-right audio icon in the tray, right-clicking and selecting teh USB Device as the input, and a few other things I tried, found didn't work, and have forgotten already. Somewhere, there's a setting or something to make this work again.... there has to be.
The REALLY odd thing is that I never lost audio OUTPUT despite all of these changes. My audio output is through the USB card. You'd think that that would change too - but it seems it's ONLY the microphone input.
I know the microphone input works because the arecord & aplay DO work.
This is frustrating. No changes were made to any of the code I was using, which had worked flawlessly for over a year.
Below is the output when I attempt to run SpeechRecognition.py from the command line. I get a boatload of errors and it hangs at "Calibrating Microphone" permanently. I have to do a Control-C to exit.
I'm hoping someone will recognize what's going on here and can help. It's enormously frustrating that something I worked so hard on to tweak perfectly would get blown up by an update. My system depends on voice input. Now it's deaf.
Thanks for any help. I really need help here... completely stuck & lost.
ERROR ON RUN OF SpeechRecognition.py:
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Calibrating microphone