speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

Segmentation fault while running speech recognition

Open surajhes opened this issue 7 years ago • 4 comments

Steps to reproduce

  1. (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

  2. (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))

  1. (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

surajhes avatar Jul 18 '17 17:07 surajhes

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?

Uberi avatar Dec 05 '17 10:12 Uberi

I have the same issue the "python -m speech_recognition" doesn't work it says "segmentation fault"

ajaysanity avatar Nov 05 '18 16:11 ajaysanity

Hello, did you solved this problem ? I have the same issue :(

mart1435 avatar Feb 12 '19 06:02 mart1435

Hello, did you solved this problem ? I have the same issue

dgrugur avatar Jan 17 '23 10:01 dgrugur