Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import speech_recognition as sr
  2. print "say something1"
  3. r = sr.Recognizer()
  4. print "say something2"
  5. with sr.Microphone() as source: # use the default microphone as the audio source
  6. print "say something3"
  7. audio = r.listen(source,timeout=3) # listen for the first phrase and extract it into audio data
  8.  
  9. print "say something"
  10. try:
  11. print("You said " + r.recognize(audio)) # recognize speech using Google Speech Recognition
  12. except LookupError: # speech is unintelligible
  13. print("Could not understand audio")
  14.  
  15. say something1
  16. say something2
  17. ALSA lib pcm_dsnoop.c:606:(snd_pcm_dsnoop_open) unable to open slave
  18. ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
  19. ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
  20. ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
  21. ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
  22. ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
  23. say something3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement