0% found this document useful (0 votes)
52 views75 pages

Ashish Rokade

Uploaded by

sakshiss22hcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views75 pages

Ashish Rokade

Uploaded by

sakshiss22hcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 75

PROJECT REPORT

ON

“VOICE COMMANDER”
SUBMITTED IN PARTIAL FULLFILLMENT OF THE REQUIREMENTS OF
DEGREE OF
BACHELOR OF COMPUTER SCIENCE
BY
ASHISH SONYABAPU ROKADE
Seat No. CS102405078

Under the Guidence Of


Prof. Jyoti Bhorde shivade

PILLAI HOC COLLEGE OF ARTS, SCIENCE COMMERCE,


RASAYANI
NAAC Accredited ‘A+’ Grade in Cycle 2
(ISO 9001:2015 Certified)
(Affiliated to Mumbai University)
RASAYANI, 410207
MAHARASHTRA
AY 2024-25
PILLAI HOC COLLEGE OF ARTS, SCIENCE COMMERCE,
RASAYANI
NAAC Accredited ‘A+’ Grade in Cycle 2
(ISO 9001:2015 Certified)
(Affiliated to Mumbai University)
RASAYANI, 410207 MAHARASHTRA
DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to verify that the project entitled, “Voice Commander”, is bonafide work of
ASHISH SONYABAPU ROKADE of T.Y.B.Sc.(Sem V) bearing Seat
No.CS102405078 submitted in partial fulfillment of the requirements for the award
of degree of BACHELOR OF SCIENCE in COMPUTER SCI-
ENCEfrom University of Mumbai during the academic year 2024-2025.

Internal Guide Coordinator

External Examiner

Date: College Seal


DECLARATION

I Ashish Sonyabapu Rokade hereby declare that the project entitled “Voice
Commander” submitted in the partial fulfillment for the award of Bachelor of
Science in Computer Science during the academic year 2024- 2025 is my original
work and the project has not formed the basis for the award of any degree,
associateship, fellowship or any other similar titles

Signature of the Student:

Place: Rasayani

Date:
ACKNOWLEDGEMENT

It gives me great pleasure to present this project report on ”VOICE


COMMANDER”
After the completion of this work, words are not enough to express my
feelings about all those who helped me to reach my goal; feeling above this is
my indebtedness to the Almighty for providing me this moment in life.
It’s a great pleasure and moment of immense satisfaction for me to
express my profound gratitude to my Project Guide, Ms. Jyoti Bhorde
shivade whose constant encouragement enabled me to work enthusiastically.
His/Her perpetual motivation, patience and excellent expertise in discussion
During the progress of the project report work has benefited me to an extent,
which is beyond expression. I am highly indebted to his invaluable guidance
and ever-ready support in the successful completion of this project report in
time. Working under his guidance has been a fruitful and unforgettable
experience.
I would like to thank all the people who contributed to the successful
completion of the project. I Would like to thank our principal Dr.Lata
Menon Department Coordinator Ms. Priyanka Sorte for their support.

I would also like to thank the entire Computer Science department of


Pillai H.O.C College of Arts, Science Commerce and all Library staff for
their cooperation, which helped me to complete this project report.

Thanking you,
ASHISH.S.ROKADE

TABLE OF CONTENTS

Content Page No.

1. Introduction 1
1.1 General Theory 2
1.2 OBJECTIVES 3
1.3 Purpose 4
1.4 Implementation Overview 5

2. Literature Survey 8

2.1 Scope 9
2.2 Applicability 10
2.3 Survey of technology 11

3. Materials And Method 13

3.1 Requirements and Analysis 14

3.2 Requirements Specification 15

3.3 Feasibility Study 16

4. System Requirement and Design 17

4.1 Hardware and Software Requirements 18


4.2 System Design & Block Diagrams 19

5. Result Analysis 29
5.1 Results and discussion 30
5.2 Conclusion 51

6. Conclusion and Future Scope 64


References 65
APPROVED PROJECT PROPOSAL

PNR No: ............................................ Seat No: ..............................


1) Name of student:

.......................................................................................

2) Title of the Project:

.......................................................................................

3) Name of the Guide:

.......................................................................................

4) Teaching experience of the Guide:

5) Is this your first submission ?

□ Yes

□ No

Signature of the student Signature of the Guide

Date: Date:

Signature of the Co -ordinator


Date:
PLAGIARISM SCAN REPORT
Voice
Commander

1 INTRODUCTION

Pillai HOC College of Arts,Science & Commerce, Rasayani 1


Voice
Commander

1.1 General Theory

Voice Commander is an advanced voice-based AI assistant designed to enhance


desktop productivity and streamline user interactions with their devices. Utilizing
cutting-edge speech recognition and natural language processing technologies,
Voice Commander allows users to control their computers entirely through voice
commands, creating a more intuitive and efficient
user experience.
This innovative tool simplifies a range of tasks, from managing communications on
platforms like WhatsApp to scheduling appointments and setting reminders. Users
can execute commands hands-free, making it particularly useful for multitasking,
where managing various activities simultaneously is essential. The ability to
automate controls for applications, search the web, and retrieve information
through voice commands reduces the need for manual input, enhancing
accessibility for individuals with mobility challenges.
Moreover, Voice Commander adapts to user preferences, learning over time to
provide a personalized experience. As digital technology continues to evolve,
voice-based AI systems like Voice Commander are reshaping how individuals
interact with their devices, moving towards a more natural and human-like
approach to technology. By minimizing cognitive load and promoting efficiency,
Voice Commander not only empowers users to maximize their productivity but
also represents a significant advancement in the field of human-computer
interaction.

Pillai HOC College of Arts,Science & Commerce, Rasayani 2


Voice
Commander

1.2 OBJECTIVES
The primary objective of Voice Commander is to create a sophisticated voice-
activated assistant designed to significantly enhance desktop productivity and user
convenience. This innovative assistant aims to provide users with hands-free
interaction capabilities across various applications and functionalities, allowing
them to perform a wide range of tasks efficiently and intuitively using voice
commands.
Key goals include:
1. Streamlined Task Management: Empower users to manage their schedules,
send messages, and control media playback seamlessly, reducing the need
for manual input and allowing for multitasking.
2. Enhanced Communication: Facilitate effortless communication through
voice dictation for messaging apps, enabling users to connect with others
without the need for typing.
3. Accessibility and Usability: Create an inclusive tool that enhances usability
for individuals with disabilities or those who prefer voice interactions,
promoting a more accessible computing environment.
4. Integration with Existing Applications: Ensure smooth integration with
popular applications such as WhatsApp, YouTube, and web browsers,
allowing users to perform familiar tasks in a new, efficient manner.
5. Real-time Information Access: Provide users with quick access to essential
information, including weather updates, internet speed checks, and
translations, enhancing their ability to stay informed.
6. Data Privacy and Security: Prioritize user privacy by implementing robust
security measures to protect personal data and ensure safe interactions with
the assistant.

Pillai HOC College of Arts,Science & Commerce, Rasayani 3


Voice
Commander

1.3 Purpose

The purpose of Voice Commander is to empower users by integrating advanced


voice recognition technology into desktop environments, transforming how they
interact with their computers. This project aims to simplify and enhance daily tasks,
making technology more accessible and user-friendly through hands-free operation.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


4
Voice
Commander

1.4 Implementation Overview


We can use any IDE like Visual Studio etc. So the first step is to create a
function for a voice which has arguments. Also, we are using Speech API to take
voice as input. There are two default voices in our computer I.e. Male and Female.
So We can use either any from these. Also, check the voice function by giving
some text input and it will be converted into voice.

We can create a new function for wishing the user. Use if_else condition
statement for allocating the wished output. E.g. If its time between 12 to 18 then
the system will say “Good Evening”. Along with this, We can get a welcome voice
also. E.g. “Welcome, What can I do for us”.After that, we have to install the speech
recognition model and then import it
Define a new function for taking command from a user. Also mention class
for speech recognition and input type like microphone etc. Also mention
pause_threshold. Set a query for voice recognition language. We can use Google
engine to convert Wer voice input to the text.
We have to install and import some other packages like pyttsx3, Wikipedia
etc. Pyttsx3 helps We to convert text input to speech conversion. If We ask for any
information then it will display the result in textual format. We can convert it very
easily in the voice format as we have already defined a function in our code
previously.
,We have to install a web browser package and import it. In the same way,
We can add queries for many websites like Google, Instagram, Facebook etc. The
next task is to play the songs. It is same as We have done before. Add a query for
“play songs”. Also, add the location of songs folder so that assistant will play the
song from that only.
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
5
Voice
Commander

What can this Voice commander do for us?

1. WhatsApp Messages: It can send WhatsApp messages by using


voice commands to dictate messages, send them to contacts, or
manage conversations.
2. Schedule Your Day: The AI assistant can set schedules and send
notifications through voice commands.
3. Screenshot and Camera Function: Voice commands can trigger
screenshots or open the camera app, allowing you to capture
images or record videos hands-free.
4. Fully Automate YouTube Controls: The AI can control YouTube
through voice commands, allowing you to search for songs, play
videos, and manage playback (play and stop).
5. Open/Close Any App Using Voice: The AI listens for commands to
open or close specific applications, making it easier to switch
between tasks hands-free.
6. Searching from the Web: You can perform web searches using
voice commands, such as “search for the latest news” or “find
recipes for chocolate cake.”
7. Set Alarm: By saying commands like “set an alarm for 7 AM,” you
can configure alarms and reminders through your desktop’s clock
8. Conversations: The AI can engage in ongoing conversations,
understanding and responding to various questions or topics.
9. Automating Temperature, Date, and Time: The AI can provide
current information on temperature, date, and time, or automate
these details in tasks and reminders.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


6
Voice
Commander

10. Remember, News, and Playlist Function: The AI can


remember user preferences, provide news updates, and organize
playlists.
11. Gameplay: You can engage in simple games or interactive
activities with the AI, adding an element of entertainment.
12. Focus Mode: The AI can help manage focus by minimizing
distractions, , and organizing tasks to improve productivity.
13. Google Translator: By issuing voice commands, you can
translate text into different languages using Google Translate,
facilitating communication across language barriers.
14. QR Code Generation: You can generate QR codes through
voice commands, making it easier to share information.
15. Check Internet Speed: The AI can check your internet speed
through voice commands, providing you with real-time updates.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


7
Voice
Commander

2 LITERATURE SURVEY

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


8
Voice
Commander

2.1 Scope

The Voice Commander project aims to enhance user experience through advanced
voice recognition technologies that facilitate individualized interactions. As voice
assistants improve in their ability to differentiate between users’ voices, it becomes
essential for developers to navigate the complexities of voice interface design.
Brands must also understand the capabilities of various voice-enabled devices and
determine which integrations align best with their specific needs and objectives.

Maintaining a consistent and intuitive user experience will be crucial as the


functionality of voice assistants expands. The absence of a visual interface presents
unique challenges, as users cannot see or interact with a voice interface in the same
way they do with traditional graphical user interfaces. Therefore, brands need to
remain informed about the evolving capabilities of voice technologies to ensure
effective integration that enhances their service offerings.

As the project develops, it will focus on future-proofing the voice assistant to keep
pace with user expectations and technological advancements. This involves
exploring future trends in voice technology and preparing for potential shifts in
user interaction paradigms. Ultimately, the Voice Commander project seeks to
create an innovative voice assistant that not only enhances productivity but also
adapts to the changing landscape of voice technology.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


9
Voice
Commander

2.2 Applicability

The Voice Commander project is designed for diverse users, including


individuals, businesses, and educational institutions. For individual users, it
streamlines daily tasks such as messaging, scheduling, and web searches, offering
hands-free convenience, especially for multitaskers and those with mobility
challenges.
In business environments, the voice assistant enhances communication and
workflow efficiency by managing tasks like scheduling meetings and sending
reminders. It can also support customer service operations, providing instant access
to information.
Educational institutions can leverage the Voice Commander to assist students
with research and language learning through its translation features.
Overall, the versatility of the Voice Commander allows it to be integrated
with various applications and platforms, making it adaptable to the specific needs of
different users and industries.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


10
Voice
Commander

2.3 SURVEY OF TECHNOLOGY

2.3.1 Python

Python is an OOPs (Object Oriented Programming) based, high level,


interpreted programming language. It is a robust, highly useful language focused on
rapid application development (RAD). Python helps in easy writing and execution
of codes. Python can implement the same logic with as much as 1/5th code as
compared to other OOPs languages. Python provides a huge list of benefits to all.
The usage of Python is such that it cannot be limited to only one activity. Its
growing popularity has allowed it to enter into some of the most popular and
complex processes like Artificial Intelligence (AI), Machine Learning (ML), natural
language processing, data science etc. Python has a lot of libraries for every need of
this project. For JIA, libraries used are speechrecognition to recognize voice, Pyttsx
for text to speech, selenium for web automation etc. Python is reasonably efficient.
Efficiency is usually not a problem for small examples. If Wer Python code is not
efficient enough, a general procedure to improve it is to find out what is taking most
the time, and implement just that part more efficiently in some lowerlevel language.
This will result in much less programming and more efficient code (because We will
have more time to optimize) than writing everything in a low-level language

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


11
Voice
Commander

2.3.2 Quepy
Quepy is a python framework to transform natural language questions to queries in a
database query language. It can be easily customized to different kinds of questions
in natural language and database queries. So, with little coding We can build Wer
own system for natural language access to Wer database.

2.3.4 Pyttsx
Pyttsx stands for Python Text to Speech. It is a cross-platform Python wrapper for
textto-speech synthesis. It is a Python package supporting common text-to-speech
engines on Mac OS X, Windows, and Linux. It works for both Python2.x and 3.x
versions. Its main advantage is that it works offline.

2.3.3 Speech Recognition


This is a library for performing speech recognition, with support for several engines
and APIs, online and offline. It supports APIs like Google Cloud Speech API, IBM
Speech to Text, Microsoft Bing Voice Recognition etc.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


12
Voice
Commander

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


13
Voice
Commander

3 MATERIALS AND METHODS

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI 14


Voice
Commander

3.1 REQUIREMENT AND ANALYSIS

System Analysis is about complete understanding of existing systems and finding


where the existing system fails. The solution is determined to resolve issues in the
proposed system. It defines the system. The system is divided into smaller parts.
Their functions and inter relation of these modules are studied in system analysis.
The complete analysis is followed below:-

Problem definition

Modern desktop interactions are often limited by manual input methods, which can
hinder productivity and multitasking. Users, especially those with physical
limitations or those needing to manage multiple tasks at once, lack an efficient,
hands-free solution. While mobile voice assistants are common, there is a gap in
similar desktop functionality.
Voice Commander solves this problem by offering a voice-activated assistant that
allows users to manage tasks, communicate, control applications, and retrieve
information through simple voice commands. This enhances productivity,
accessibility, and overall ease of use in desktop environments.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI 15


Voice Commander

3.2 REQUIREMENT SPECIFICATION

Personal assistant software is required to act as an interface into the digital world by
understanding user requests or commands and then translating into actions or
recommendations based on agent’s understanding of the world.

Voice commander focuses on relieving the user of entering text input and using voice
as primary means of user input. Agent then applies voice recognition algorithms to
this input and records the input. It then use this input to call one of the personal
information management applications such as task list or calendar to record a new
entry or to search about it on search engines like Google, Bing or Yahoo etc.

Focus is on capturing the user input through voice, recognizing the input and then
executing the tasks if the agent understands the task. Software takes this input in
natural language, and so makes it easier for the user to input what he or she desires to
be done.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


15
Voice Commander

3.3 Feasibility Study

The Voice Commander project has been assessed for feasibility across technical,
operational, and economic dimensions, ensuring that it can be successfully developed
and implemented.

Technical Flexibility
The project leverages widely available technologies such as Google Speech API for
voice recognition, pyttsx3 for text-to-speech conversion, and Python libraries for
natural language processing (NLP) and application control. The integration of these
tools with desktop systems like Windows, macOS, and Linux is achievable, and the
use of Python ensures compatibility and scalability across various platforms.

Operational Feasibility:
The Voice Commander is designed to improve workflow efficiency by automating
tasks through voice commands. Its intuitive interface makes it accessible to both tech-
savvy users and those less familiar with technology. Moreover, the assistant can easily
be integrated into daily routines without disrupting existing workflows, making it
highly feasible for both personal and business use.

Economic Feasibility:
The development of the Voice Commander utilizes open-source libraries and APIs,
reducing upfront costs. Additionally, the hardware requirements (standard microphone
and speakers) are minimal, which lowers the barrier to entry. The potential
productivity gains and time savings outweigh the initial development and deployment
costs, making the project economically viable.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


16
Voice Commander

4 SYSTEM REQUIREMENT AND DESIGN

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


17
Voice Commander

4.1 Hardware and Software Requirements

The software is designed to be light-weighted so that it doesn’t be a burden on the


machine running it. This system is being build keeping in mind the generally available
hardware and software compatibility. Here are the minimum hardware and software
requirement for virtual assistant.

Hardware :- • Pentium-pro processor or later.


• RAM 512MB or more.

Software :-
• Windows 7(32-bit) or above.
• Python 2.7 or later
• Chrome Driver

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


18
Voice Commander

4.2 System Design & Block Diagrams

UML DIAGRAMS:

UML stands for Unified Modelling Language. UML is a language for


specifying, visualizing, and documenting the system. This is the step while
developing any product after analysis. The representation of the entities that
are to be used in the product being developed needs to be designed.

There are various kinds of methods in software design.

They are as follows:

1. Use case Diagram

2. Class Diagram

3. Sequence Diagram

4. Activity Diagram

5. ER Diagram
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
19
Voice Commander

1. Use Case Diagram:

Use-case diagrams describe the high-level functions and scope of a


system. These diagrams also identify the interactions between the
system and its actors. Use-case diagrams illustrate and define the
context and requirements of either an entire system or the important
parts of the system.

Notation

Actors: Represented by stick figures.


Use Cases: Represented by ovals.
Include Relationship: Represents a relationship where one use case
includes the functionality of another.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


20
Voice Commander

Extend Relationship: Represents a relationship where one use case


may extend another use case under certain conditions.

In this project there is only one user. The user queries command to the system.
System then interprets it and fetches answer. The response is sent back to the user.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


21
Voice Commander

2.Class Diagram

A class diagram for an online voting system provides a visual representation


of the system's structure in terms of classes, their attributes, methods, and
relationships.

Notation

Classes: Represented by rectangles with three sections:The top section


contains the name of the class.The middle section contains the attributes of
the class.The bottom section contains the methods or operations of the class.

Associations: Represented by lines connecting two classes to indicate a


relationship. You can add multiplicity (such as 1, *, 0..1) near the ends of the
lines to denote how many instances of one class are related to instances of the
other class.

Aggregation and Composition: These are special types of associations.


Aggregation represents a "has-a" relationship where one class contains
another class (e.g., a Ballot contains many Votes). Composition is a stronger
form of aggregation, indicating that the contained class has no meaning or
purpose outside the container class.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


22
Voice Commander

The class user has 2 attributes command that it sends in audio and the response it

receives which is also audio. It performs function to listen the user command. Interpret it
and then reply or sends back response accordingly. Question class has the command in
string form as it is interpreted by interpret class. It sends it to general or about or search
function based on its identification. The task class also has interpreted command in string
format. It has various functions like reminder, note, mimic, research and reader.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


23
Voice Commander

3.Sequence diagram:
A sequence diagram shows object interactions arranged in time sequence. It depicts
the objects and classes involved in the scenario and the sequence of messages
exchanged between the objects needed to carry out the functionality of the scenario.
Sequence diagrams are typically associated with use case realizations in the Logical
View of the system under development. Sequence diagrams are sometimes called
event diagrams or event scenarios. A sequence diagram shows, as parallel vertical
lines (lifelines), different processes or objects that live simultaneously, and, as
horizontal arrows, the messages exchanged between them, in the order in which they
occur. This allows the specification of simple runtime scenarios in a graphical manner
and implementation of change requests (CRs) which is not possible in conventional
models like a waterfall.

Notation:

Lifeline: Represented by vertical dashed lines extending from participants, lifelines


depict the period during which a participant is actively engaged in processing or
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
24
Voice Commander

responding to messages.
Self-message: Represented by an arrow pointing back to the same participant, a self-
message indicates an action or interaction within the same participant, often used to
depict internal processing or decision-making.
Message: Represented by arrows between participants, messages depict interactions
or communications between different participants in the system, indicating the flow of
information or requests.
Reply Message: A reply message is a specific type of message indicating a response
to a previously received message. In the sequence diagram, it's represented by a
dashed arrow returning from the recipient back to the sender, indicating the response
to a preceding message.

The above sequence diagram shows how an answer asked by the user is being fetched
from internet. The audio query is interpreted and sent to Web scraper. The web scraper
searches and finds the answer. It is then sent back to speaker, where it speaks the answer
to user.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


25
Voice Commander

4. Activity diagram:

In UML, the activity diagram is used to demonstrate the flow of control within the
system rather than the implementation. It models the concurrent and sequential activities.
The activity diagram helps in envisioning the workflow from one activity to another. It
put emphasis on the condition of flow and the order in which it occurs. The flow can be
sequential, branched, or concurrent, and to deal with such kinds of flows, the activity
diagram has come up with a fork, join, etc. It is also termed as an object-oriented
flowchart. It encompasses activities composed of a set of actions or operations that are
applied to model the behavioural diagram.

Notation

Action state: Represented by rounded rectangles, activities depict actions or operations


within the system. Each activity represents a specific task or operation that occurs
during the voting process.

Initial Node: This is denoted by a solid circle and indicates the starting point of the
diagram. It represents the initial state of the system before any activity takes place.

Final Node: Represented by a circle with a solid circle inside, the final node signifies the
end of the activity diagram. It indicates the final state of the system after all activities
have been completed.

Decision Node: Shown as a diamond shape, decision nodes represent points in the
process where the system must make a decision based on certain conditions.
Depending on the condition evaluation, the process may follow different paths

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


26
Voice Commander

Initially, the system is in idle mode. As it receives any wake up cal it begins execution.
The received command is identified whether it is a questionnaire or a task to be
performed. Specific action is taken accordingly. After the Question is being answered or
the task is being performed, the system waits for another command. This loop continues
unless it receives quit command. At that moment, it goes back to sleep.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


27
Voice Commander

5. ER DIAGRAM

The above diagram shows entities and their relationship for a Voice commander
system. We have a user of a system who can have their keys and values. It can be
used to store any information about the user. Say, for key “name” value can be
“Jim”. For some keys user might like to keep secure. There he can enable lock
and set a password (voice clip). Single user can ask multiple questions. Each
question will be given ID to get recognized along with the query and its
corresponding answer. User can also be having n number of tasks. These should
have their own unique id and status i.e. their current state. A task should also

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


28
Voice Commander

have a priority value and its category whether it is a parent task or child task of
an older task.

5 Result Analysis

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


29
Voice Commander

5.1 RESULTS AND DISCUSSION

Explanation of Each function used in Code


Starting VS Code

We have used the VS Code IDE in this video. Feel free to use any other IDE We are
comfortable d with. I have started a new project and make a file called jarvis.py. Visual
Studio Code is a freeware source-code editor made by Microsoft for Windows, Linux
and macOS. Features include support for debugging, syntax highlighting, intelligent code
completion, snippets, code refactoring, and embedded Git.How to Install

Visual Studio Code on Windows?

We can download Visual Studio code from URL


“https://code.visualstudio.com/download” by selecting the right platform:Firstly,
download the Visual Studio Code installer for Windows. Once it is downloaded, run the
installer (VSCodeUserSetup-{version}.exe). It will only take a minute.

Secondly, accept the agreement and click on next.

Thirdly, click on “create a desktop icon” so that it can be accessed from desktop and
click on Next. Finally, after installation completes, click on the finish button, and the
visual studio code will get open.

By default, VS Code installs under C:\users\{username}\AppData\Local\Programs\


Microsoft VS Code.After the successful installation, let’s move to the next section to
understand the various components of the User Interface of Visual Studio Code Editor.

What are the essential components of the VS Code?


Visual Studio Code is a code editor at its core. Like many other code editors, VS Code
adopts a standard user interface and laWet of an explorer on the left, showing all of the
files and folders We have access to. Additionally, it has an editor on the right, showing
the content of the files We have opened. Below are a few of the most critical components
the VSCode editor:
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
30
Voice Commander

VS Code comes with a straight-forward and intuitive laWet that maximizes the space
provided for the editor while leaving ample room to browse. Additionally, it allows
access to the full context of Wer folder or project. The UI is divided into five areas, as
highlighted in the above image.

Editor – It is the main area to edit Wer files. We can open as many editors as possible
side by side vertically and horizontally.

SideBar – Contains different views like the Explorer to assist We while working on Wer
project.

Status Bar – It contains the information about the opened project and the files We edit.

Activity Bar – It is located on the far left-hand side. It lets We switch between views
and gives We additional context-specific indicators, like the number of outgoing changes
when Git is enabled.

Panels – It displays different panels below the editor region for output or debug
information, errors, and warnings, or an integrated terminal. Additionally, the panel can
also move to the right for more vertical space. VS Code opens up in the same state it was
last in, every time We start it. It also preserves folder, laWet, and opened files.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


31
Voice Commander

Here’s a breakdown of the Voice Assistant code, explaining its structure, key
functionalities, and how each part works:
1. Imports and Setup

import datetime
from email import message
import subprocess
import webbrowser
from numpy import tile
import pyttsx3
import qrcode
import speech_recognition
import requests
from bs4 import BeautifulSoup
import os
import pyautogui
import random
import geocoder
from plyer import notification
from pygame import mixer
import speedtest
import Translator

Libraries:
o datetime: To manage time-based functionalities (like getting the current
time).
o subprocess & webbrowser: For interacting with system apps and opening
web pages.
o pyttsx3: For text-to-speech functionality (voice output).
o qrcode: To generate QR codes.
o speech_recognition: For voice command input (speech-to-text).
o requests & BeautifulSoup: To scrape and fetch data from web pages (like
weather).
o pyautogui: For automating tasks like controlling apps or the mouse.
o random: For random selections, like choosing which song to play.
o geocoder: To get current location based on IP.
o plyer.notification: For sending desktop notifications.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


32
Voice Commander

o pygame.mixer: To play audio files (for sounds and notifications).


o speedtest: For checking internet speed.
o Translator: Custom module for translating text.

2. Password Protection

for i in range(3): # giving 3 chances to user to give correct pass


a = input("Enter Password to open Jarvis :- ")
pw_file = open("password.txt","r")
pw = pw_file.read()
pw_file.close()
if (a==pw):
print("WELCOME SIR ! PLZ SPEAK [WAKE UP] TO LOAD ME UP")
break
elif (i==2 and a!=pw):
exit()

elif (a!=pw):
print("Try Again")

elif "change password" in query:


speak("What's the new password")
new_pw = input("Enter the new password\n")
new_password = open("password.txt","w")
new_password.write(new_pw)
new_password.close()
speak("Done sir")
speak(f"Your new password is{new_pw}")

 Password Check: Before loading the assistant, the user must enter the correct
password. The password is stored in a file (password.txt). If the password is
incorrect after 3 attempts, the program exits
 . This section allows the user to change a password:
o input(): The new password is input via the keyboard.
o new_password.write(): The new password is saved to a file (password.txt).
o speak(): The assistant confirms the new password vocally.

3. Text-to-Speech Functionality
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
33
Voice Commander

python
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
rate = engine.setProperty("rate",170)

def speak(audio):
engine.say(audio)
engine.runAndWait()

 Voice Engine Initialization: Using pyttsx3 to initialize and configure the voice
(here, it's set to male with a speech rate of 170 words per minute).
 speak() Function: Converts text into speech and speaks it out.

4. Listening for Commands

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,0,4)

try:
print("Understanding..")
query = r.recognize_google(audio,language='en-in')
print(f"You Said: {query}\n")
except Exception as e:
print("Say that again")
return "None"
re
turn query

 takeCommand() Function: Listens to the user's voice using speech_recognition.


It uses Google’s speech API to convert speech to text.
o It listens for 4 seconds.
o If the command is unclear, it asks the user to repeat it.
o
5.Alarm Function

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


34
Voice Commander

def alarm(query):
timehere = open("Alarmtext.txt","a")
timehere.write(query)
timehere.close()
os.startfile("alarm.py")
import pyttsx3
import datetime
import os
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
engine.setProperty("rate",200)

def speak(audio):
engine.say(audio)
engine.runAndWait()
extractedtime = open("Alarmtext.txt","rt")
time = extractedtime.read()
Time = str(time)
extractedtime.close()
deletetime = open("Alarmtext.txt","r+")
deletetime.truncate(0)
deletetime.close()

def ring(time):
timeset = str(time)
timenow = timeset.replace("jarvis","")
timenow = timenow.replace("set an alarm","")
timenow = timenow.replace(" and ",":")
Alarmtime = str(timenow)
print(Alarmtime)
while True:
currenttime = datetime.datetime.now().strftime("%H:%M:%S")
if currenttime == Alarmtime:
speak("Alarm ringing,sir")
os.startfile("music.mp3")
elif currenttime + "00:00:30" == Alarmtime:
exit()
ring(time)
elif "set an alarm" in query:
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
35
Voice Commander

print("input time example:- 10 and 10 and 10")


speak("Set the time")
a = input("Please tell the time :- ")
alarm(a)
speak("Done,sir")

 alarm(): Saves the alarm time in a text file (Alarmtext.txt) and starts an external
alarm script.

6.YouTube Search

ef search_on_youtube(song_name):
try:
# Construct the YouTube search URL
search_url = f"https://www.youtube.com/results?
search_query={song_name.replace(' ', '+')}"

 search_on_youtube(): Constructs a YouTube search URL based on the song


name provided by the user and opens it in a web browser.

7.Check Internet Speed

def check_internet_speed():
st = speedtest.Speedtest()
st.get_best_server()
download_speed = st.download() / (1024 * 1024) # Convert bytes to megabits
upload_speed = st.upload() / (1024 * 1024) # Convert bytes to megabits
ping = st.results.ping

print(f"Download Speed: {download_speed:.2f} Mbps")


print(f"Upload Speed: {upload_speed:.2f} Mbps")
print(f"Ping: {ping} ms")
elif "check internet speed" in query:
check_internet_speed()
speak("Here are the current internet speed metrics.")

check_internet_speed(): Uses the speedtest library to measure download, upload

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


36
Voice Commander

speeds, and ping, then displays the results.

8.QR Code Generation

def generate_qr_code(text_or_url, filename="qr_code.png"):


try:
# Create QR code instance
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
# Add data to the QR code
qr.add_data(text_or_url)
qr.make(fit=True)
# Create an image from the QR code instance
img = qr.make_image(fill_color="black", back_color="white")
# Save the image to a file
img.save(filename)
print(f"QR code generated successfully as {filename}")
except Exception as e:
print(f"Error occurred while generating QR code: {str(e)}")

 generate_qr_code(): Generates a QR code from the provided text or URL and


saves it as an image file.

9.Main Loop: Continuous Listening for Commands


if __name__ == "__main__":
while True:
query = takeCommand().lower()
if "wake up" in query:
from GreetMe import greetMe
greetMe()

while True:
query = takeCommand().lower()
if "go to sleep" in query:
speak("Ok SIR , You can call me anytime")
break

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


37
Voice Commander

 takeCommand(): A function that listens for voice input and converts it into text.
 query = takeCommand().lower(): Captures the user’s voice input, converts it to
lowercase to ensure uniformity in processing.
 if "wake up" in query: When the assistant hears "wake up," it starts a new while
loop to continue processing commands until the user says "go to sleep."

10.Professor Interaction Mode

lif "professor details" in query:


speak("Hello, Professor [Bhorde]. It's a pleasure to meet you.")
speak("How may I assist you today? You can ask me questions, get
information, or give me commands.")
while True:
teacher_query = takeCommand()
if teacher_query == "":
continue
if teacher_query.lower() == "exit":
speak("Goodbye, Professor. Have a great day!")
break

This section initiates a special interaction mode when a professor is mentioned:


 The assistant greets the professor and waits for specific commands like "exit,"
jokes, and inquiries about the weather.

11.Volume Control
elif "volume up" in query:
from keyboard import volumeup
speak("Turning volume up,sir")
volumeup()
elif "volume down" in query:
from keyboard import volumedown
speak("Turning volume down, sir")
volumedown()

 volume up/down: Uses the keyboard library to control system volume.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


38
Voice Commander

12.Schedule Management
elif "schedule my day" in query:
tasks = [] #Empty list
speak("Do you want to clear old tasks (Plz speak YES or NO)")
query = takeCommand().lower()
if "yes" in query:
file = open("tasks.txt","w")
file.write(f"")
file.close()
no_tasks = int(input("Enter the no. of tasks :- "))
i=0
for i in range(no_tasks):
tasks.append(input("Enter the task :- "))
file = open("tasks.txt","a")
file.write(f"{i}. {tasks[i]}\n")
file.close()
elif "no" in query:
i=0
no_tasks = int(input("Enter the no. of tasks :- "))
for i in range(no_tasks):
tasks.append(input("Enter the task :- "))
file = open("tasks.txt","a")
file.write(f"{i}. {tasks[i]}\n")
file.close()
elif "show my schedule" in query:
file = open("tasks.txt","r")
content = file.read()
file.close()
mixer.init()
mixer.music.load("notification.mp3")
mixer.music.play()
notification.notify(
title = "My schedule :-",
message = content,
timeout = 15
)

 schedule my day: The assistant helps the user manage tasks for the day:
o Clears old tasks if requested and appends new ones.
o Saves tasks in tasks.txt for later retrieval.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


39
Voice Commander

 show my schedule: Reads out the tasks from tasks.txt and displays them as a
system notification.

13.Translation

elif "translate" in query:


from Translator import translategl
query = query.replace("jarvis","")
query = query.replace("translate","")
translategl(query)

from fnmatch import translate


from time import sleep
from googletrans import Translator
import googletrans #pip install googletrans
from gtts import gTTS
import googletrans
import pyttsx3
import speech_recognition
import os
from playsound import playsound
import time

engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
rate = 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
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
40
Voice Commander

audio = r.listen(source,0,4)

try:
print("Understanding..")
query = r.recognize_google(audio,language='en-in')
print(f"You Said: {query}\n")
except Exception as e:
print("Say that again")
return "None"
return query

def translategl(query):
speak("SURE Sir")
print(googletrans.LANGUAGES)
translator = Translator()
speak("Choose the language in which you want to translate")
b = input("To_Lang :- ")
text_to_translate = translator.translate(query,src = "auto",dest= b,)
text = text_to_translate.text
try :
speakgl = gTTS(text=text, lang=b, slow= False)
speakgl.save("voice.mp3")
playsound("voice.mp3")

time.sleep(5)
os.remove("voice.mp3")
except:
print("Unable to translate")

#pip install --upgrade googletrans==4.0.0-rc1

 Translation Function: Calls a function from another module (Translator) to


translate the given text.

14.Open and Close Applications

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


41
Voice Commander

elif "open" in query: #EASY METHOD


query = query.replace("open","")
query = query.replace("jarvis","")
pyautogui.press("super")
pyautogui.typewrite(query)
pyautogui.press("enter")

import os
import pyautogui
import webbrowser
import pyttsx3
from time import sleep

engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
engine.setProperty("rate",200)

def speak(audio):
engine.say(audio)
engine.runAndWait()

dictapp =
{"commandprompt":"cmd","paint":"paint","word":"winword","excel":"excel","ch
rome":"chrome","vscode":"code","powerpoint":"powerpnt","explorer":"explorer
","edge": "msedge"}

def openappweb(query):
speak("Launching, sir")
if ".com" in query or ".co.in" in query or ".org" in query:
query = query.replace("open","")
query = query.replace("jarvis","")
query = query.replace("launch","")
query = query.replace(" ","")
webbrowser.open(f"https://www.{query}")
else:
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"start {dictapp[app]}")
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
42
Voice Commander

def closeappweb(query):
speak("Closing,sir")
if "one tab" in query or "1 tab" in query:
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "2 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "3 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")

elif "4 tab" in query:


pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "5 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


43
Voice Commander

else:
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"taskkill /f /im {dictapp[app]}.exe")

 open and close: The assistant can open and close applications by interacting with
the Dictapp module.

15.YouTube Video Control

elif "pause" in query:


pyautogui.press("k")
speak("video paused")
elif "play" in query:
pyautogui.press("k")
speak("video played")
elif "mute" in query:
pyautogui.press("m")
speak("video muted")

 The assistant can control YouTube videos via keyboard shortcuts (e.g., k to
pause/play and m to mute).

17.Web Search (Google, YouTube, Wikipedia)


elif "google" in query:
from SearchNow import searchGoogle
searchGoogle(query)
elif "youtube" in query:
from SearchNow import searchYoutube
searchYoutube(query)
elif "wikipedia" in query:
from SearchNow import searchWikipedia
searchWikipedia(query)
 Google, YouTube, Wikipedia Searches: Initiates searches using the SearchNow
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
44
Voice Commander

module.

18.Temperature and Weather

elif "temperature" in query:


search = "temperature in Raigad"
url = f"https://www.google.com/search?q={search}"
r = requests.get(url)
data = BeautifulSoup(r.text,"html.parser")
temp = data.find("div", class_ = "BNeawe").text
speak(f"current{search} is {temp}")
elif "weather" in query:
search = "temperature in Raigad"
url = f"https://www.google.com/search?q={search}"
r = requests.get(url)
data = BeautifulSoup(r.text,"html.parser")
temp = data.find("div", class_ = "BNeawe").text
speak(f"current{search} is {temp}")

 The assistant retrieves temperature information for a specified location by web


scraping using requests and BeautifulSoup.

19.Reminders and Notes

elif "remember that" in query:


rememberMessage = query.replace("remember that","")
rememberMessage = query.replace("jarvis","")
speak("You told me to remember that"+rememberMessage)
remember = open("Remember.txt","a")
remember.write(rememberMessage)
remember.close()
elif "what do you remember" in query:
remember = open("Remember.txt","r")
speak("You told me to remember that" + remember.read())

 Reminders: Allows the user to store reminders in Remember.txt and recall them
later.
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
45
Voice Commander

20.Shutdown or Sleep Command


elif "the time" in query:
strTime = datetime.datetime.now().strftime("%H:%M")
speak(f"SIR, the time is {strTime}")
elif "finally sleep" in query:
speak("Going to sleep,sir")
exit()
elif "shutdown system" in query:
speak("Shutting down the system sir")
os.system("shutdown /s /t 1")
break

 Voice Trigger for Sleep:


o When the assistant hears the command "finally sleep," it prepares to shut
down or terminate. This could be a final command to end the session or
close the assistant's processes.
 Exiting the Program:
o The exit() function is called, which stops the execution of the program
entirely. Before that, the assistant uses speak() to notify the user that it's
shutting down by saying, "Going to sleep, sir."

21. Taking Screenshots:


elif "screenshot" in query:
import pyautogui #pip install pyautogui
im = pyautogui.screenshot()
im.save("ss.jpg")

Uses pyautogui.screenshot() to capture the screen and save it.

22.Photo Capture:

elif "click my photo" in query:


pyautogui.press("super")
pyautogui.typewrite("camera")
pyautogui.press("enter")
pyautogui.sleep(2)
speak("SMILE")
pyautogui.press("enter")
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
46
Voice Commander

Opens the camera app and takes a photo.

23.Playing a Game:

elif "play a game" in query:


from game import game_play
game_play()

import pyttsx3
import speech_recognition as sr
import random

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 = sr.Recognizer()
with sr.Microphone() as source:
print("Listening.....")
r.pause_threshold = 1
r.energy_threshold = 300
audio = r.listen(source,0,4)

try:
print("Recognizing..")
query = r.recognize_google(audio , language= 'en-in')
print(f"You Said : {query}\n")
except Exception as e:
print("Say that again")
return "None"
return query

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


47
Voice Commander

def game_play():
speak("Lets Play ROCK PAPER SCISSORS !!")
print("LETS PLAYYYYYYYYYYYYYY")
i=0
Me_score = 0
Com_score = 0
while(i<5):
choose = ("rock","paper","scissors") #Tuple
com_choose = random.choice(choose)
query = takeCommand().lower()
if (query == "rock"):
if (com_choose == "rock"):
speak("ROCK")
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
elif (com_choose == "paper"):
speak("paper")
Com_score += 1
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
else:
speak("Scissors")
Me_score += 1
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")

elif (query == "paper" ):


if (com_choose == "rock"):
speak("ROCK")
Me_score += 1
print(f"Score:- ME :- {Me_score+1} : COM :- {Com_score}")

elif (com_choose == "paper"):


speak("paper")
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
else:
speak("Scissors")
Com_score += 1
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")

elif (query == "scissors" or query == "scissor"):


if (com_choose == "rock"):
speak("ROCK")
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
48
Voice Commander

Com_score += 1
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
elif (com_choose == "paper"):
speak("paper")
Me_score += 1
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
else:
speak("Scissors")
print(f"Score:- ME :- {Me_score} : COM :- {Com_score}")
i += 1

print(f"FINAL SCORE :- ME :- {Me_score} : COM :- {Com_score}")

Initiates a game using an imported function (game_play).

24.Sending WhatsApp Message:

elif "whatsapp" in query:


from Whatsapp import sendMessage
sendMessage()
import pywhatkit
import pyttsx3
import datetime
import speech_recognition
import webbrowser
from bs4 import BeautifulSoup
from time import sleep
import os
from datetime import timedelta
from datetime import datetime

engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
rate = engine.setProperty("rate",170)

def speak(audio):
engine.say(audio)
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
49
Voice Commander

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,0,4)

try:
print("Understanding..")
query = r.recognize_google(audio,language='en-in')
print(f"You Said: {query}\n")
except Exception as e:
print("Say that again")
return "None"
return query

strTime = int(datetime.now().strftime("%H"))
update = int((datetime.now()+timedelta(minutes = 2)).strftime("%M"))

def sendMessage():
speak("Whom do you want to send a message")
a = int(input('''ashish -> 1
pratiksha -> 2 '''))
if a == 1:
speak("Whats the message")
message = str(input("Enter the message- "))
pywhatkit.sendwhatmsg("+91
86222249354",message,time_hour=strTime,time_min=update) #Enter The number
here instead of +91000
elif a==2:
speak("Whats the message")
message = str(input("Enter the message- "))
pywhatkit.sendwhatmsg("+91
8692022285",message,time_hour=strTime,time_min=update)

The sendMessage() function is called. This function (assumed to be defined in the


Whatsapp module) will handle sending a WhatsApp message based on the user's input,
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
50
Voice Commander

such as selecting a contact and sending the message.

CONCLUSION

Open/Close Any App Using Voice: The AI listens for commands to open or close
specific applications, making it easier to switch between tasks hands-free.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


51
Voice Commander

WhatsApp Messages: It can send WhatsApp messages by using voice


commands to dictate messages, send them to contacts, or manage
conversations.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


52
Voice Commander

Fully Automate YouTube Controls: The AI can control YouTube


through voice commands, allowing you to search for songs, play videos,
and manage playback (play and stop).
PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI
53
Voice Commander

Check Internet Speed: The AI can check your internet speed through voice
commands, providing you with real-time updates.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


54
Voice Commander

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


55
Voice Commander

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


56
Voice Commander

Schedule Your Day: The AI assistant can set schedules and send
notifications through voice commands.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


57
Voice Commander

Gameplay: You can engage in simple games or interactive activities with


the AI, adding an element of entertainment.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


58
Voice Commander

Screenshot and Camera Function: Voice commands can trigger


screenshots or open the camera app, allowing you to capture images or
record videos hands-free.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


59
Voice Commander

Set Alarm: By saying commands like “set an alarm for 7 AM,” you can configure
alarms and reminders through your desktop’s clock

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


60
Voice Commander

Remember, News, and Playlist Function: The AI can remember user preferences,
provide news updates, and organize playlists.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


61
Voice Commander

You can adjust the system's volume up or down through simple voice commands,
offering a hands-free audio control experience.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


62
Voice Commander

QR Code Generation: You can generate QR codes through voice commands,


making it easier to share information.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


63
Voice Commander

Searching from the Web: You can perform web searches using voice commands,
such as “search for the latest news”

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


64
Voice Commander

CONCLUSION

The voice assistant project is a comprehensive tool that integrates voice recognition and
command execution. It showcases various functionalities, including application
management, sending WhatsApp messages, checking the weather, and generating QR
codes. The use of text-to-speech enhances user interaction, and the modular structure
allows for easy updates and extensions. This project effectively demonstrates how
natural language processing can be applied to create a useful personal assistant for
everyday tasks.

Future Scope

The future of Voice Commander is promising, with potential to expand into controlling

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


65
Voice Commander

smart home devices like lights and thermostats through voice commands. It could
become more personalized, learning user preferences to offer better suggestions. As
voice recognition improves, it will handle more complex commands and conversations.
Multilingual support could make it accessible worldwide, and enhanced security features
like voice-based authentication will improve user privacy. Additionally, Voice
Commander may integrate with augmented reality, offering a more interactive
experience, making it a powerful tool for productivity and convenience.

REFERENCES

 Rabiner, Lawrence, and Juang, Bing-Hwang. Fundamentals of Speech Recognition. Prentice


Hall, New Jersey, 1993, ISBN 0-13-015157-2.

 Deller, John R., Jr., Hansen, John J.L., and Proakis, John G. Discrete-Time Processing of
Speech Signals. IEEE Press, ISBN 0-7803-5386-2.

 Hayes, H. Monson. Statistical Digital Signal Processing and Modeling. John Wiley & Sons
Inc., Toronto, 1996, ISBN 0-471-59431-8.

 Proakis, John G., and Manolakis, Dimitris G. Digital Signal Processing: Principles,
Algorithms, and Applications, 3rd Edition. Prentice Hall, New Jersey, 1996, ISBN 0-13-394338-

 Jain, Ashish, and Harris, Hohn. "Speaker Identification Using MFCC and HMM Based
Techniques." University of Florida, April 25, 2004.

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


66
Voice Commander

PILLAI HOC COLLEGE OF ARTS,SCIENCE & COMMERCE, RASAYANI


67

You might also like