Skip to content

Uploaded a python project that converts speech into text #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions speech_to_text_converter/speech_to_text_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import speech_recognition as sr
recognizer= sr.Recognizer()

#Asks user to speak and records speech
with sr.Microphone() as source:
print("Speak now")
audio= recognizer.listen(source)

#Converts speech to text using Google's Web Speech API
try:
text= recognizer.recognize_google(audio)
print(f"You said : {text}")

except sr.UnknownValueError:
print("Could not understand")

except sr.RequestError:
print("Network error")