A smart voice assistant can perform tasks or services, or answer questions used to carry out tasks via voice recognition.
Voice control accesses us to interact with our smart assistant, without lifting our single finger. Whether controlling the high smart technology or looking for the cloud through the internet to find the information we are looking for, this handy feature makes our routine life simpler and much more efficient. One of the main use for a smart assistant is to get instant answers to the questions we may have, to find the required information, we need internet with the assistant searching. If we need to do a phone call but do not have free hands? Simply activate the assistant and, provided you have given it access to your contacts book, you can have placed a call for you.
pyttsx3
is a python library which uses to convert text-to-speech. Unlike the alternative libraries, this works offline as well and is very compatible with both the Python version 2 and 3
pip install pyttsx3
If you get the errors such as no module named win32 client, No module type win32, or No module named win32api, you will need to additionally install the library pypiwin32
.
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
With support for several engines and APIs, both online and offline 8 libraries will be used for performing speech recognition.
pip install SpeechRecognition
import speech_recognition as sr
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
Recognize speech as an input from the microphone
Submitted by VARUN SIMHA REDDY (VARUNREDDY099)
Download packets of source code on Coders Packet
Comments