import pyttsx3
import speech_recognition as sr
test = ""
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
print("Voice:")
print(" - ID: %s" %
voice.id)
print(" - Name: %s" %
voice.name)
print(" - Languages: %s" % voice.languages)
print(" - Gender: %s" % voice.gender)
print(" - Age: %s" % voice.age)
exit()
en_voice_id = "com.apple.speech.synthesis.voice.Victoria"
engine.setProperty('voice', en_voice_id)
r = sr.Recognizer()
print(sr.Microphone.list_microphone_names())
m = sr.Microphone(device_index=3)
with m as audio_file:
r.adjust_for_ambient_noise(audio_file)
while True:
engine.say("Say something please")
engine.runAndWait()
#audio_text = r.listen(audio_file,timeout=10)
try:
audio_text = r.listen(audio_file,timeout=10)
engine.say("You said")
engine.runAndWait()
test = r.recognize_google(audio_text)
#print(test)
engine.say(test)
engine.runAndWait()
except:
engine.say("Sorry, I did not get that")
engine.runAndWait()