Summer Training Report
Summer Training Report
Summer Training Report
On
Voice-Command Calculator
Session 2019-20
I hereby declare that this Summer Training Report titled Voice command calculator_
submitted by me to JEMTEC, Greater Noida is a bonafide work undertaken during the period
from _15th july_to_1st September__by me and has not been submitted to any other University or
Institution for the award of any degree diploma / certificate or published any time before.
This is to certify that as per best of my belief the project entitled “(Voice command calculator)”
is the bonafide research work carried out by FARAZ KHAN Student of BCA, JEMTEC, Greater
Noida, in partial fulfillment of the requirements for the Summer Training Report for the Degree
of Bachelor of Business Administration.
Faculty Guide
Name: Ms.Apoorva Jain
Designation: Assistant Professor ___________________
Faculty Guide
Name: Dr.Ruchi Agarwal
Designation: HOD BCA Department ___________________
ACKNOWLEDGEMENT
I offer my sincere thanks and humble regards to JEMTEC, Greater Noida for imparting us very
valuable professional training in BCA.
I pay my gratitude and sincere regards to Dr.Ruchi agarwal my project Guide for giving me the
cream of her knowledge. I am thankful to him/her as he/she has been a constant source of advice,
motivation and inspiration. I am also thankful to him/her for giving his suggestions and
encouragement throughout the project work.
I take the opportunity to express my gratitude and thanks to our computer Lab staff and library
staff for providing me opportunity to utilize their resources for the completion of the project.
I am also thankful to my family and friends for constantly motivating me to complete the project
and providing me an environment, which enhanced my knowledge.
.Abstract 1
Company Profile 2
Project description 3
Objective 4
Source code 8
Output snapshot 9
Conclusion 10
References 11
Abstract
This report reviews the use of graphical user interface via tkinter and speech recognition
application via pyaudio and pygame in python. As we know that in today’s technology , keeping
up with basic knowledge is necessary and most students don’t know about the GUI(Graphical
User Interface) and the applications of speech recognition in python and its usages in
implementing many softwares such as games ,browsers , mobile apps and many visually
appealing applications with a visual interface. A graphical user interface is an application that
has buttons, windows, and lots of other widgets that the user can use to interact with your
application.
A programmer can easily take in hand his operation by the help of speech recognition application
of pyaudio and pygame in which he will control the any other application by just giving orders
via speaking; all the operations will be carried out by itself
Python offers multiple options for developing GUI (Graphical User Interface). Out of all the
GUI methods, tkinter is the most commonly used method. It is a standard Python interface to
the Tk GUI toolkit shipped with Python. Python with tkinter is the fastest and easiest way to
create the GUI applications. Creating a GUI using tkinter is an easy task.
Having a good GUI and speech recognition applied to the software increases your reputation
and makes software more visually appealing and user friendly.
The project involves the use of Tkinter which is a graphical user interface of python by
implementing it in the form of a GUI calculator. As you will see later that there is a huge
difference between a simple calculator program and the calculator implemented by using
graphical user interface.
PyAudio helps in applying the speech recognition in the program by providing certain inbuilt
keywords and functions. PyAudio provides Python bindings for PortAudio, the cross-platform
audio I/O library. With PyAudio, you can easily use Python to play and record audio
Play MP3 and WAV files, as well as a range of other audio formats
Play NumPy and Python arrays containing sound
Record sound using Python
Save your recordings or audio files in a range of different file formats
Company profile
Udemy.inc is an American massive open online course (MOOC) provider aimed at professional
adults and students who want to learn something while sitting at their home by online method.
Udemy was founded in May 2010 by eren Ball, Gagan biyani and oktay caglar. As of June of
2021, the platform has more than 44 million students 83000 courses and 65000 instructors
teaching courses in 75 languages. Udemy is a platform that allows instructors to build online
courses on their preferred topics. Using Udemy's course development tools, they can upload
videos, PowerPoint presentations, PDFs, audio, ZIP files and live classes to create courses.
Instructors can also engage and interact with users via online discussion boards.Courses are
offered across a breadth of categories, including business and entrepreneurship academics, the
arts, health and fitness, language, music, and technology.
Most classes are in practical subjects such as Excel software or using an iPhone camera. Udemy
also offers Udemy for Business, enabling businesses access to a targeted suite of over 7,000
training courses on topics from digital marketing tactics to office
productivity, design, management, programming, and more. With Udemy for Business,
organizations can also create custom learning portals for corporate training. Courses on Udemy
can be paid or free, depending on the instructor.
Project description
This project is about Tkinter’s and PyAudio implementation as a GUI (Graphical User Interface)
and speech recognition application which can easily record your audio and use google to
translate your audio into string.In this smart calculator you can either type your desired numbers
via the buttons provided by GUI or just provide the command to the calculator by clicking on the
microphone button which we have implemented via pygame in which a sound is played of the
clicking of microphone just like it plays in google after we click the microphone icon and the
operation will be carried out by itself.
Process
Step-1- First of all you have to click on the microphone button , a sound will be played ,then you
have to speak your desired numbers which you want to calculate with the specific operation
which you want to be carried by the calculator
Step-2- For e.g. – if you say “perform addition of 3 and 4” then that audio will be recorded by
the help of some functions and keywords provided by PyAudio and will be translated by google
into string
Step-3- String will be then filtered out as per the condition provided in the program in which we
have provided a list which will filter out the words such as addition or multiplication and the
numbers such as 3 and 4 will be filtered out and fed to the calculator,
Step-4-When the words and numbers are being filtered out, then they are in string at that time so
for operation to be carried out by the calculator they must be converted to integer, that’s why a
separate keyword is provided to convert that string into integer
Step-5-After being converted into integer the operation is ready to perform and just like that the
operation is carried out and result is displayed on the screen by a sound which tells us that the
operation is carried out successfully.
NOTE: Beware to speak carefully or the audio will not be recorded clearly which will result in
an error or a wrong output.
This whole project is made using the applications of speech recognition and graphical user
interface via PyAudio and Tkinter .
PyAudio helps in applying the speech recognition in the program by providing certain inbuilt
keywords and functions. PyAudio provides Python bindings for PortAudio, the cross-platform
audio I/O library. With PyAudio, you can easily use Python to play and record audio
Play MP3 and WAV files, as well as a range of other audio formats
Play NumPy and Python arrays containing sound
Record sound using Python
Save your recordings or audio files in a range of different file formats
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a
fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented
interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the
following steps −
Import the Tkinter module.
Create the GUI application main window.
Add one or more of the above-mentioned widgets to the GUI application.
Enter the main event loop to take action against each event triggered by the user.
Objective
The objective of this project is to provide the implementation of speech recognition and
Graphical user interface. By this project you will get to know how easy it is control your
application by just sitting on your chair and providing your desired commands and the result will
be displayed automatically by itself. And using GUI will make your software look even more
attractive and there are buttons provided by the GUI which make your work easy.
The software design specification can produce at the culmination of the analysis task. The
function and performance allocated to software as part of system engineering are refined by
established complete information description , a detailed functional description, a representation
of system behavior and indication of performance and design constrain, appropriate validate
criteria and other information pertinent to requirements.
Python
(Any version, although python3+ versions would be better)
RAM
2 GB (4 GB preferable)
This software is made by the help of Tkinter which is a library of python with graphical
properties. For implementation of this project you have to import tkinter library of python first
after installing tkinter through pip command “pip install tk” , then write the code as per needed
by providing different buttons for your input and colors of your choice.
There are certain processes which are carried out by the software before printing the result :
process-1) Audio will be recorded by the help of inbuilt functions and keywords provided by
PyAudio and will be translated by google into string
process-2) String will be then filtered out as per the condition provided in the program in which
we have provided a list which will filter out the words such as addition or multiplication and the
numbers such as 3 and 4 will be filtered out and fed to the calculator,
process-3) When the words and numbers are being filtered out, then they are in string at that time
so for operation to be carried out by the calculator they must be converted to integer, that’s why
a separate keyword is provided to convert that string into integer
process-4) After being converted into integer the operation is ready to perform and just like that
the operation is carried out and result is displayed on the screen by a sound which tells us that the
operation is carried out successfully.
Source Code
from tkinter import *
import math
from pygame import mixer
import speech_recognition
mixer.init()
def click(value):
ex = entryField.get()
answer = ''
try:
if value == 'C':
ex = ex[0:len(ex) - 1] # 78
entryField.delete(0, END)
entryField.insert(0, ex)
return
else:
entryField.insert(END, value)
return
entryField.delete(0, END)
entryField.insert(0, answer)
except SyntaxError:
pass
def findNumbers(t):
l = []
for num in t:
try:
l.append(int(num))
except ValueError:
pass
return l
def audio():
mixer.music.load('music1.mp3')
mixer.music.play()
sr = speech_recognition.Recognizer()
with speech_recognition.Microphone() as m:
try:
sr.adjust_for_ambient_noise(m, duration=0.2)
voice = sr.listen(m)
text = sr.recognize_google(voice)
mixer.music.load('music2.mp3')
mixer.music.play()
text_list = text.split(' ')
for word in text_list:
if word.upper() in operations.keys():
l = findNumbers(text_list)
print(l)
result = operations[word.upper()](l[0], l[1]) #
mul(5.0,6.0)
entryField.delete(0, END)
entryField.insert(END, result)
else:
pass
except:
pass
root = Tk()
root.title('Smart Calculator')
root.config(bg='dodgerblue3')
root.geometry('680x486+100+100')
logoImage = PhotoImage(file='logo.png')
logoLabel = Label(root, image=logoImage, bg='dodgerblue3')
logoLabel.grid(row=0, column=0)
micImage = PhotoImage(file='microphone.png')
micButton = Button(root, image=micImage, bd=0, bg='dodgerblue3',
activebackground='dodgerblue3'
, command=audio)
micButton.grid(row=0, column=7)
root.mainloop()
Output Snapshots
As you can see this calculator is obviously a better alternative compared to the calculator without
GUI based on the looks and voice command based on the simplicity alone.
At the end this project is showing how a GUI and voice command being is implemented and why
these are a better approach in the field of development. GUI doesn’t only improve the looks and
charm of your code but also makes your code more user friendly by providing user interfaces for
them; users can easily press this virtual button via mouse instead of typing the numbers again via
keyboard .A programmer can easily take in hand his operations by giving out commands and
doing everything without touching the keyboard in this calculator.
References
GUI calculator(2021),https://www.geeksforgeeks.org/python-simple-gui-calculator-
using-tkinter/ (accessed on 20th October 2021)
GUI programming,https://www.tutorialspoint.com/python/python_gui_programming.htm
(accessed on 24th October 2021)