SHARE
TWEET

Untitled

a guest Jun 17th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def listen(rec, mic):
  2.   with mic as source:
  3.     print('adjusting mic for ambient noise..')
  4.     rec.adjust_for_ambient_noise(source)
  5.     print('listening..')
  6.     # timeout is not max record time but max time it will wait for audio to start
  7.     audio = rec.listen(source, timeout=5)
  8.  
  9. rec = sr.Recognizer()
  10. mic = sr.Microphone()
  11. outputString = listen(rec, mic)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top