From a730fbb2f513ad7f63becc8f916152a80f418bcf Mon Sep 17 00:00:00 2001 From: Sandro Zimmermann Date: Sat, 6 Dec 2025 10:46:59 +0100 Subject: [PATCH] speech recognition --- py/speech.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 py/speech.py 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))