i am having error in python while working on speech recognition module

0 votes
import speech_recognition as sr


def takecommand():
    r = sr.Recognizer()
    with sr.Microphone() as source:
        print("Listening....")
        r.pause_threshold = 1
        audio = r.listen(source,phrase_time_limit=5)
    try:
       print("Recognizing....")
       query = r.recognize_google(audio, language='en-in')
       print(f"user said: {query}\n")
    except Exception as e:
        print(e)
        return "None"
    return query

takecommand()




error showing
Traceback (most recent call last):
  File "C:/Users/sumit/PycharmProjects/speech reco/sss.py", line 20, in <module>
    takecommand()
  File "C:/Users/sumit/PycharmProjects/speech reco/sss.py", line 10, in takecommand
    audio = r.listen(source,phrase_time_limit=5)
  File "C:\python 37\lib\site-packages\speech_recognition\__init__.py", line 620, in listen
    buffer = source.stream.read(source.CHUNK)
  File "C:\python 37\lib\site-packages\speech_recognition\__init__.py", line 161, in read
    return self.pyaudio_stream.read(size, exception_on_overflow=False)

May 14, 2022 in Python by anonymous

edited Mar 4 80 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP