Python Project Voice Converter To Text
Python Project Voice Converter To Text
Python Project Voice Converter To Text
Mini-Project Report On
BY
Ajay Shriram Pawara (2000610098)
Under Guidance Of
Mr M Y Varule
1
--------------------------------------------------------------------------------------------------------------------------------------
-
CERTIFICATE
Certified that this is a Bonafide record of the project work titled
2
--------------------------------------------------------------------------------------------------------------------------------------
-
Place-Chopda.
Date: / /2021
3
--------------------------------------------------------------------------------------------------------------------------------------
-
CONTENT
1.) ACKNOWLEDGEMENT
2.) ABSTRACT
3.) INTRODUCTION
8.) APPLICATION
9.) RESULT
10.) CONCLUSION
11.) REFERENCES
ACKNOWLEDGEMENT
4
--------------------------------------------------------------------------------------------------------------------------------------
-
------------------------------------------------------------------------------------------------
Acknowledgement
ABSTRACT
----------------------------------------------------------------------------------------------------------------
5
--------------------------------------------------------------------------------------------------------------------------------------
-
In today’s develop generation, How cool is it to build your own
personal assistants like Alexa or Siri ? It’s not very complex and may be
effortlessly performed in Python. Personal virtual assistants are capturing
numerous attentions lately. Chat bots are not unusual in maximum business web
sites. The predominant agenda of our voice help makes human beings clever
and supply immediate and computed effects. The fundamental mission of a
voice assistant is to reduce using enter gadgets like keyboard, mouse, touch
pens, and so forth. This will lessen both the hardware fee and space taken by it.
Keywords: Voice Assistant, Python, Machine Learning, Text-Speech-Text,
Voice Detection and Artificial Intelligence
INTRODUCTION
--------------------------------------------------------------------------------------------------------------------------
6
--------------------------------------------------------------------------------------------------------------------------------------
-
The developments of artificial intelligence (AI) systems which can make virtual
human are gaining popularity. Human does not learns to talk with a device, but
it’s the machine that learns to speak with a humans.
Virtual assistants are software program that help you to easily do your
day to day works like displaying climate reviews, on off devices and so on.
They take input as command through text or through voice. Voice based
assistants need a wake phrase to start, followed by the command. There are
many voice assistance like Apple’s Siri, Amazon’s Alexa and Microsoft’s
Cortana. Such as stream movie on YouTube, Search on Wikipedia and
Google, Open websites on web browser, Open applications, Perform windows
OS task like Sending and checking mails the voice assistant we've got advanced
is a computer-primarily based built using python modules and libraries.
This assistant is just a simple model that might carry out all the simple
responsibilities which have been mentioned above however cutting-edge
generation is even though right in its miles nevertheless to be merged with
Machine Learning and Internet Of Things (IoT) for better improvements. And
we also upload GUI to this mission for makes it extra exciting and additionally
for person friendly.
LITERATURE SURVEY
--------------------------------------------------------------------------------------------------------------------------
7
--------------------------------------------------------------------------------------------------------------------------------------
-
This area of digital assistants having speech reputation has visible some primary
advancements or inventions. This is especially due to its call for in gadgets like
smart watches or health bands, speakers, Bluetooth earphones, cellular
telephones, computer or desktop, TV, and so forth. Almost all the digital
gadgets which are coming nowadays with voice assistants, which assist to
control the device with speech recognition. A new set of strategies is being
evolved constantly to improve the performance of voice computerized seek.
API
Voice input Speech Recognition Call
Module
Content
Extraction
8
--------------------------------------------------------------------------------------------------------------------------------------
-
import speech_recognition as sr
import os
import sys
import re
import webbrowser
import smtplib
import request
fig.Module imported…..
9
--------------------------------------------------------------------------------------------------------------------------------------
-
The voice module used this system is Google’s API i.e. “import
speech_recognition as sr”. This module is used to recognize the sound waves
given by the user as input. This is a loose API this is supplied and supported by
Google. This is a totally mild API that facilitates in decreasing the scale of our
application.
The input voice is first converted to text by using speech recognition module.
The text is then processed to result of the voice by the user. The most time
ingesting a number of the STT because the gadget first has to concentrate to the
user and unique users have distinctive, a few are smooth to apprehend whilst a
few are not without difficulty audible. Once the speech is converted to text
executing commands and giving the consequences lower back to the user isn't
always a time-eating.
PYTTSX3:
10
--------------------------------------------------------------------------------------------------------------------------------------
-
To convert text into speech in python the pyttsx3 module is used. This is an
offline module. The module provides run and wait functionality. It is used to
allow how much time the system will wait for another input of user. This is a
module available in the python community for free that can be installed using
the pip command.
DATETIME:
The Date-Time module is imported to support the date and time. For example,
the consumer wants to recognize the modern- day date and time or the person
desires to time table a venture at a sure time. In brief this module helps
instructions to manipulate date and time and carry out operations according to it
handiest. This is a critical module, mainly in tasks in which we need to keep a
track of time. This module could be very small in length and allows controlling
the dimensions of our program. If the modules are too large or heavy then the
system will lag and provide gradual responses.
WEBBROWSER:
WIKIPEDIA:
11
--------------------------------------------------------------------------------------------------------------------------------------
-
OS MODULE:
SMTPLIB:
SMTPLIB is python’s standard library which deals with emails. The SMTPLIB
library sends mail using “SMTP”. This is done using steps that are - initialize,
sendmail(), quit. When the optional parameters host and port are provided then
connect method is called with these arguments during initialization.
DESIGN:
The design consists of the following: Taking voice as a input from user.
Conversion of the speech into text by the system The converted text is then
processed to get the desired output.
12
--------------------------------------------------------------------------------------------------------------------------------------
-
PROPOSED SYSTEM
--------------------------------------------------------------------------------------------------------------------------
This may be whatever like getting movies, opening internal files, and so
on. Tests are made via code with the help of books and on line sources, with the
aim to find best results and a more expertise of Voice Assistant. The system has
the functionality like:- The device will hold listening for commands and the
time for listening is variable which may be modified consistent with consumer
necessities. If the system isn't capable of gather facts from the consumer input it
will keep asking again to copy until the desired no. of times. Features supported
in the current version include playing song, emails, texts, Wikipedia, OS tasks,
or establishing system mounted packages, starting something on the net
browser, etc.
The machine will hold listening for commands and the time for listening
is variable which can be modified in step with person necessities.
EXPERIMENT ANALYSIS
13
--------------------------------------------------------------------------------------------------------------------------------------
-
--------------------------------------------------------------------------------------------------------------------------
System configuration
This project can run on commodity hardware. We ran the entire project
on an Intel 8th generation I5 processor with 8 GB Ram, 2GB Graphics Card.
First part is the training phase which takes 20-25 mins of time and the second
part is the testing part which only takes a few seconds to make predictions
Hardware Requirements
• RAM: 4 GB
• Storage: 500 GB
• CPU: 2 GHz or faster
• Architecture: 32-bit or 64-bit
Software requirements
• Python 3.5 in Google Colab is used for data pre-processing, model training
and prediction.
• Operating System: Windows 7 and above or Linux based OS or MAC OS.
FUTURE SCOPE
14
--------------------------------------------------------------------------------------------------------------------------------------
-
--------------------------------------------------------------------------------------------------------------------------
The virtual assistants who might be presently available are speedy and
responsive however we nevertheless must go an extended manner. The
assistants available these days are still no longer reliable in critical eventualities.
The destiny of these assistants may have the virtual assistants integrated with
Artificial Intelligence which incorporates Machine Learning, Neural
Networks and IoT. With this technology, we are able to gain new heights.
What the digital assistants can attain is lots past what we have done till now.
Most of us have seen Jarvis, that is a digital assistant evolved through iron guy
which is even though fictional but this has set new requirements of what we will
achieve using voice-activated digital assistants.
Application
15
--------------------------------------------------------------------------------------------------------------------------------------
-
--------------------------------------------------------------------------------------------------------------------------
Program:-
import pyttsx3
import speech_recognition as sr
import datetime
import wikipedia
import webbrowser
import os
import smtplib
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def wishMe():
hour = int(datetime.datetime.now().hour)
if hour>=0 and hour<12:
speak("Good Morning!")
16
--------------------------------------------------------------------------------------------------------------------------------------
-
speak("I am Jarvis Sir. Please tell me how may I help you")
def takeCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio, language='en-in')
print(f"User said: {query}\n")
except Exception as e:
# print(e)
print("Say that again please...")
return "None"
return query
def sendEmail(to, content):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('[email protected]', 'your-password')
server.sendmail('[email protected]', to, content)
server.close()
if __name__ == "__main__":
17
--------------------------------------------------------------------------------------------------------------------------------------
-
wishMe()
while True:
query = takeCommand().lower()
if 'wikipedia' in query:
speak('Searching Wikipedia...')
query = query.replace("wikipedia", "")
results = wikipedia.summary(query, sentences=2)
speak("According to Wikipedia")
print(results)
speak(results)
18
--------------------------------------------------------------------------------------------------------------------------------------
-
strTime = datetime.datetime.now().strftime("%H:%M:%S")
speak(f"Sir, the time is {strTime}")
elif 'open code' in query:
codePath = "C:\\Users\\Haris\\AppData\\Local\\Programs\\
Microsoft VS Code\\Code.exe"
os.startfile(codePath)
elif 'email to harry' in query:
try:
speak("What should I say?")
content = takeCommand()
to = "[email protected]"
sendEmail(to, content)
speak("Email has been sent!")
except Exception as e:
print(e)
speak("Sorry my friend harry bhai. I am not able to send this email")
RESULT
Output:-
19
--------------------------------------------------------------------------------------------------------------------------------------
-
20
--------------------------------------------------------------------------------------------------------------------------------------
-
21
--------------------------------------------------------------------------------------------------------------------------------------
-
CONCLUSION
--------------------------------------------------------------------------------------------------------------------------
22
--------------------------------------------------------------------------------------------------------------------------------------
-
REFERENCES
--------------------------------------------------------------------------------------------------------------------------
[4]. Open Domain Speech Recognition & Translation: Lectures and Speeches,”
in Proceedings of ICASSP, 2006.
[6]. Crevier, D. (1993). AI: The Tumultuous Search for Artificial Intelligence.
New York, NY: Basic Books, ISBN 0- 465-02997-3.
[7]. Sadun, E., &Sande, S. (2014). Talking to Siri: Mastering the Language of
Apple’s Intelligent Assistant.
23
--------------------------------------------------------------------------------------------------------------------------------------
-
[10]. Smart sheet web page[Online]. https://www.smartsheet.com/voice-
assistants-artificial-intelligence
[13]. http://en.wikipedia.org/wiki/WebServiceDescriptionLanguage.
24