Created
September 27, 2017 09:45
-
-
Save Sharon-f/cf59edf3a27616db5a91bc27b2237e81 to your computer and use it in GitHub Desktop.
Python program to convert speech to text
This file contains 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 | |
# obtain path to "Daily_English_Conversation_02_Do_you_speak_English.wav" in the same folder as this script | |
from os import path | |
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "Daily_English_Conversation_02_Do_you_speak_English.wav") | |
# use the audio file as the audio source | |
r = sr.Recognizer() | |
with sr.AudioFile(AUDIO_FILE) as source:namelist2.wav | |
print("Say something!") | |
audio = r.record(source) # read the entire audio file | |
try: | |
# for testing purposes, we're just using the default API key | |
# to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")` | |
# instead of `r.recognize_google(audio)` | |
print("Google Speech Recognition thinks you said : " + r.recognize_google(audio)) | |
except sr.UnknownValueError: | |
print("Google Speech Recognition could not understand audio") | |
except sr.RequestError as e: | |
print("Could not request results from Google Speech Recognition service; {0}".format(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
malayalam speech to malayalam text convertion is posible or not?