Advertisement
tosip

Untitled

Nov 27th, 2022
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import speech_recognition as sr
  2.  
  3. r = sr.Recognizer()
  4. with sr.Microphone() as source:
  5.     print("Speak Anything :")
  6.     audio = r.listen(source,timeout=1,phrase_time_limit=10)
  7.     print('Done, Please wait while we are processing what you said...')
  8.     try:
  9.         text = r.recognize_google(audio)
  10.         print("You said : {}".format(text))
  11.     except:
  12.         print("Sorry we could not recognize what you said. You can try again.")
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement