import pyttsx3
import distutils
import speech_recognition
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
engine.setProperty("rate",170)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def takeCommand():
r = speech_recognition.Recognizer()
with speech_recognition.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
r.energy_threshold = 300
audio = r.listen(source, phrase_time_limit= 5)
try:
print("Understanding...")
query = r.recognize_goo(audio,language='en-in')
print(f"you said : {query}n")
except Exception as e:
print("Say that again")
return "None"
return query
I was trying to access recognize_google but in suggetions it won’t showing and also i was trying with other module recognize_bing but in the output it won’t recognizing my voice but the other lines of code working except that line please help me out thanks.
it was giving output like
Say that again
Listening…
Understanding…
Say that again
Listening…
Understanding…
Say that again
Listening…
New contributor
Gouse SK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.