0

I'm having trouble with this code, i have all the needed requirements downloaded, butt it hust gives me a blinking pointer.


import speech_recognition as sr

r=sr.Recognizer()
print(sr.Microphone.list_microphone_names())
with sr.Microphone() as source:
    # r.energy_threshold()
    print("say anything : ")
    r.adjust_for_ambient_noise(source,duration=2)
    audio= r.listen(source)
    try:
        text = r.recognize_google(audio)
        print(text)
    except:
        print("sorry, could not recognise")

0 Answers0