Created
October 16, 2019 05:05
-
-
Save pranav1698/0b70b51fbe8ca42070afbca07e2b6b5c to your computer and use it in GitHub Desktop.
Microphone Speech Recognition
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 | |
r=sr.Recognizer() | |
with sr.Microphone() as source: | |
r.adjust_for_ambient_noise(source, duration=5) | |
print("Say") | |
audio = r.listen(source) | |
try: | |
print(r.recognize_sphinx(audio)) | |
except sr.UnknownValueError: | |
print("error") | |
except sr.RequestError as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment