From 7c3f6359592b2aeb6d7145e64d1e2085dc3b5c87 Mon Sep 17 00:00:00 2001 From: Vaibhav9888 <88420365+Vaibhav9888@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:48:04 +0530 Subject: [PATCH 1/3] Add files via upload --- Speech2Text.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Speech2Text.py diff --git a/Speech2Text.py b/Speech2Text.py new file mode 100644 index 0000000..d1a407b --- /dev/null +++ b/Speech2Text.py @@ -0,0 +1,36 @@ +# Python program to translate speech to text + +import speech_recognition as sr +import pyttsx3 + +r = sr.Recognizer() + +def SpeakText(command): + + engine = pyttsx3.init() + engine.say(command) + engine.runAndWait() + + + +while(1): + + try: + + with sr.Microphone() as source: + + r.adjust_for_ambient_noise(source, duration=0.2) + + audio = r.listen(source) + + MyText = r.recognize_google(audio) + MyText = MyText.lower() + + print("Did you say "+MyText) + + + except sr.RequestError as e: + print("Could not request results; {0}".format(e)) + + except sr.UnknownValueError: + print("unknown error occured") From 41d0249020c2d986bed87030da4c0f44f3fbe563 Mon Sep 17 00:00:00 2001 From: Vaibhav9888 <88420365+Vaibhav9888@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:52:02 +0530 Subject: [PATCH 2/3] Create S2T.py --- Speech2Text/S2T.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Speech2Text/S2T.py diff --git a/Speech2Text/S2T.py b/Speech2Text/S2T.py new file mode 100644 index 0000000..50907f0 --- /dev/null +++ b/Speech2Text/S2T.py @@ -0,0 +1,36 @@ +# Python program to translate speech to text + +import speech_recognition as sr +import pyttsx3 + +r = sr.Recognizer() + +def SpeakText(command): + + engine = pyttsx3.init() + engine.say(command) + engine.runAndWait() + + + +while(1): + + try: + + with sr.Microphone() as source: + + r.adjust_for_ambient_noise(source, duration=0.2) + + audio = r.listen(source) + + MyText = r.recognize_google(audio) + MyText = MyText.lower() + + print("Did you say "+MyText) + + + except sr.RequestError as e: + print("Could not request results; {0}".format(e)) + + except sr.UnknownValueError: + print("unknown error occured") From e1dc693eb5840670c9b8f399726f1e9762ca8fbd Mon Sep 17 00:00:00 2001 From: Vaibhav9888 Date: Fri, 28 Oct 2022 15:59:22 +0530 Subject: [PATCH 3/3] removed unwanted file --- Speech2Text.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 Speech2Text.py diff --git a/Speech2Text.py b/Speech2Text.py deleted file mode 100644 index d1a407b..0000000 --- a/Speech2Text.py +++ /dev/null @@ -1,36 +0,0 @@ -# Python program to translate speech to text - -import speech_recognition as sr -import pyttsx3 - -r = sr.Recognizer() - -def SpeakText(command): - - engine = pyttsx3.init() - engine.say(command) - engine.runAndWait() - - - -while(1): - - try: - - with sr.Microphone() as source: - - r.adjust_for_ambient_noise(source, duration=0.2) - - audio = r.listen(source) - - MyText = r.recognize_google(audio) - MyText = MyText.lower() - - print("Did you say "+MyText) - - - except sr.RequestError as e: - print("Could not request results; {0}".format(e)) - - except sr.UnknownValueError: - print("unknown error occured")