Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement