Created
March 18, 2018 17:58
-
-
Save abdul-rehman-2050/bf31d480fab71845dd38ec287b6e3b46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 Sphinx | |
try: | |
print("Sphinx thinks you said " + r.recognize_sphinx(audio)) | |
except sr.UnknownValueError: | |
print("Sphinx could not understand audio") | |
except sr.RequestError as e: | |
print("Sphinx error; {0}".format(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment