speech_recognition
speech_recognition copied to clipboard
Using SpeechRecognition on a Raspberry Pi 400 doesn't work
Steps to reproduce
As far as I'm aware, just trying to use the library on the raspberry pi causes issues. This was the code I used: import speech_recognition as sr def getMic(parent): r = sr.Recognizer() with sr.Microphone as source: audioData = r.listen(source) #Reads mic data until there is a significant pause try: words = parent.r.recognize_google(audioData) #Attempts to convert audio to a string except: return 'asdsafdfa' return words.lower()
Expected behaviour
I expected it to work fine and convert the audiodata to text. I have saved the audiodata as a wav and checked that it is fine.
Actual behaviour
An error occurs at 'words = parent.r.recognize_google(audioData)' and it just returns 'asdsafdfa'.
https://pastebin.com/iDmkugFK
System information
My raspberry pi 400 uses raspbian 64bit, latest
My Python version is 3.9.
My Pip version is latest.
My SpeechRecognition library version is latest.
My PyAudio library version is latest
The pastebin shows that the c library is having errors. The pi's c library is different sometimes and is not compatible with a lot of libraries.
Are you stupid? It's because you have " return 'asdsafdfa' " in your code.
Are you stupid? It's because you have " return 'asdsafdfa' " in your code.
This is a year old post and I've already resolved the issue. That return line is a flag for the try except lines and I was having issue with the line that converted the audio file to a string. You are a donut.
No shit its a year old, I just had to comment sum because I just dont understand your logic. It says " return 'asdsafdfa' " and ur saying "it not work because it say 'asdsafdfa' 🤓🤓"
Mate it's a try except block. It executes 'words = parent.r.recognize_google(audioData) #Attempts to convert audio to a string' and in the case that an error occurs, it goes to the exception line which returns an error flag so the program doesn't crash and I can keep testing. Highlighting that it returns the 'asdsafda' string shows that the issue occurs in the try block.
Then don't be a re. U known where the error was coming from so fix it. It not SpeechRecog issue it a u issue it a skill issue.
Then don't be a re. U known where the error was coming from so fix it. It not SpeechRecog issue it a u issue it a skill issue. Mans mind wandered and never came back. It was a known compatibility issue with the audio drivers
No its not.