diff --git a/py/speech.py b/py/speech.py new file mode 100644 index 0000000..c557f7a --- /dev/null +++ b/py/speech.py @@ -0,0 +1,13 @@ +import speech_recognition as sr + +recognizer = sr.Recognizer() +with sr.Microphone() as source: + print("Speak something...") + audio = recognizer.listen(source) + try: + text = recognizer.recognize_google(audio) + print("You said: {}".format(text)) + except sr.UnknownValueError: + print("Could not understand audio.") + except sr.RequestError as e: + print("Error with API: {}".format(e))