speech_recognition
speech_recognition copied to clipboard
Segmentation fault while running speech recognition
Steps to reproduce
-
(How do you make the issue happen? Does it happen every time you try it?) This issue happens upon running the python script containing the following code
-
(Make sure to go into as much detail as needed to reproduce the issue. Posting your code here can help us resolve the problem much faster!) import speech_recognition as sr
Record Audio
r = sr.Recognizer() with sr.Microphone() as source: print("Say something!") audio = r.listen(source)
Speech recognition using Google Speech Recognition
try:
# for testing purposes, we're just using the default API key
# to use another API key, use r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")
# instead of r.recognize_google(audio)
print("You said: " + r.recognize_google(audio))
except sr.UnknownValueError:
print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))
- (If there are any files, like audio recordings, don't forget to include them.)
Expected behaviour
Should expect to record the sound and provide the transcript of the speech
(What did you expect to happen?) I expected it to record and print the speech as text on the console
Actual behaviour Segmentation Fault
(What happened instead? How is it different from what you expected?) It just showed as Segmentation Fault and halted. Its quite different as i hadnt expected Segmentation Fault
(If the library threw an exception, paste the full stack trace here)
System information
On a Raspberry Pi device running Raspbian
(Delete all the statements that don't apply.)
My system is Raspberry Pi with latest Raspbian version with 4.9 kernel version
My Python version is 2.7
My Pip version is 9.0.1
My SpeechRecognition library version is 3.7.1
My PyAudio library version is 0.2.11
I **installed PocketSphinx from github source code
Hi @surajhes,
Thanks for the report! I can't reproduce this issue, but my guess is that this is caused by a bad FLAC binary - can you try flac SOME_FILE.wav
and ensure it doesn't segfault?
Also, does python -m speech_recognition
work properly?
I have the same issue the "python -m speech_recognition" doesn't work it says "segmentation fault"
Hello, did you solved this problem ? I have the same issue :(
Hello, did you solved this problem ? I have the same issue