What do I need to do to get my microphone detected?

Viewed 71

I tired to make a simple "voice to text" program in python. It's not a difficult task as I see, but my code doesn't work. I don't get any error or warning messages, the program doesn't detect my voice in PyCharm. I checked my microphone, and it's working.

My code:

import speech_recognition as sr

r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak Anything :")
    audio = r.listen(source)
    try:
        text = r.recognize_google(audio)
        print("You said : {}".format(text))
    except:
        print("Sorry could not recognize what you said")
0 Answers
Related