I am trying to use the Speech Recognition library on Python 3.7 (OS X/internal microphone)
Here's the code I am using so far:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
However, there is no output and no error message when I run the program. But when I hit the "stop" button, this error message turns up
Traceback (most recent call last): File "/Users/diandraelmira/PycharmProjects/untitled/venv/APP.py", line 6, in audio = r.listen(source) File "/Users/diandraelmira/PycharmProjects/untitled/venv/lib/python3.7/site-packages/speech_recognition/init.py", line 620, in listen buffer = source.stream.read(source.CHUNK) File "/Users/diandraelmira/PycharmProjects/untitled/venv/lib/python3.7/site-packages/speech_recognition/init.py", line 161, in read return self.pyaudio_stream.read(size, exception_on_overflow=False) File "/Users/diandraelmira/PycharmProjects/untitled/venv/lib/python3.7/site-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) KeyboardInterrupt
How can I fix this?