Skip to content

Instantly share code, notes, and snippets.

@bottomoftheheap9000
Created December 19, 2016 18:09
Show Gist options
  • Save bottomoftheheap9000/88c7f9c285517a2136b4534fc0d8ac8f to your computer and use it in GitHub Desktop.
Save bottomoftheheap9000/88c7f9c285517a2136b4534fc0d8ac8f to your computer and use it in GitHub Desktop.
#from bing_voice import *
import speech_recognition as sr
# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
# recognize speech using Microsoft Bing Voice Recognition
BING_KEY = "6864f2c3183842f3945ccf32d9bf1906" # Microsoft Bing Voice Recognition API keys 32-character lowercase hexadecimal strings
try:
print("Microsoft Bing Voice Recognition thinks you said " + r.recognize_bing(audio, key=BING_KEY))
except sr.UnknownValueError:
print("Microsoft Bing Voice Recognition could not understand audio")
except sr.RequestError as e:
print("Could not request results from Microsoft Bing Voice Recognition service; {0}".format(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment