Voice Assistant
This is the code of a Voice Assistant.
When you run the code given below it will speak to to and wish you according to the time.
It will not take your words as I have not made it fully. When it will be completed i will post it here and you can enjoy talking to your Assistant.
I have named it Jarvis. You can also give it any another . Comment me if you have any another cool name for the assistant.
So Enjoy till then with the your Voice Assistant.
Bye!!
import pyttsx3
import speech_recognition as sr
import datetime
import time
import shutil
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
print(voices[0].id)
engine.setProperty('voices', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
engine.getProperty('rate')
engine.setProperty('rate', 100)
def wishMe():
hour = int(datetime.datetime.now().hour)
if hour>=0 and hour<12:
speak("Good Morning Sir!")
elif hour> 12 and hour<18:
speak("Good Afternoon Sir!")
else:
speak("Good Evening Sir!")
assname = ("Jarivs 1 point o")
speak("I am your assistant!")
speak(assname)
def usrname():
speak("How can I help you, sir?")
columns = shutil.get_terminal_size().columns
print("#####################".center(columns))
print("Welcome Mr.", uname.center(columns))
print("#####################".center(columns))
if __name__ == '__main__':
wishMe()
usrname()
Comments
Post a Comment