5

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
David Xanatos
  • 75
  • 1
  • 9
  • 1
    If nobody responds here, try reposting on the Raspberry PI StackExchange. – Frank Merrow Aug 26 '20 at 04:53
  • 1
    David was this ever resolved? Having the same issue. Can't use PyAudio to record from my USB mic. I can, however, you Alexa through my Pi just fine. If only they had a simple speech capture skill. – Azurespot Mar 23 '21 at 02:27
  • 1
    @Azurespot I did get it resolved, and when I get back on my main systems tomorrow I'll review the solution & post. Iirc it was pretty simple but non-obvious. I'm now using a Pi 4B 8gig running Raspbian OS64, and everything remains awesome. SR nearly perfect, low latency. They changed over from Alsa to PyAudio, too, which added a few challenges, but all were solvable. More tomorrow. – David Xanatos Mar 23 '21 at 02:37
  • Oh interesting, good to know. I have the Pi 4 model B 8GB Buster (I think it's 64-bit?) I notice there is both on mine, Alsa and PyAudio. I did finally read that the messages are actually warnings and can be suppressed. Still trying out Python samples to do that. But would love to see your solution if you get a chance. Thanks! – Azurespot Mar 23 '21 at 03:21

0 Answers0