0% found this document useful (0 votes)
49 views33 pages

Emotional Music Player Nikita

Uploaded by

Manjunath
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)
49 views33 pages

Emotional Music Player Nikita

Uploaded by

Manjunath
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/ 33

EMOTIONAL MUSIC PLAYER

Abstract
Music is a significant element of life. People take its help to evoke their emotions and prefer
listening to songs according to their mood. It takes a lot of efforts to find appropriate music
from the list for the particular emotional state. Music players in today’s world are not giving
priority to the emotional state of a person. The aim of this paper is to develop music system
which considers human emotions into account. The emotional state can be interpreted from
facial expressions through the webcam. We have utilized the CNN classifier to build a neural
network model. This model is trained and subjected to detect mood from facial expressions
using Open CV. Songs belonging to particular sentiments are classified on the basis of tempo
feature in beats per minute. A system generates music playlist based on that detected mood.
Our music player will play that generated music playlist to improves user’s mood.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 1
EMOTIONAL MUSIC PLAYER

CHAPTER 1

Introduction
Music is an essential component of our daily life. We listen to songs as per our mood. Music
is one of the media of entertainment and even imparts a therapeutic approach. It is important
to play an appropriate song on the particular emotional state. Existing music player satisfies
the user's basic requirements, yet the user has to face the task of manually browsing through
the playlist of songs and select songs based on his current mood and behaviour.

This project is based on the principle of detection of human emotions to play appropriate
songs for current emotional state. The current emotional state of human being can be easily
observed through their facial expressions. It can be achieved with help of image processing
and machine learning techniques. In music terms, tempo is speed of pace of given piece,
usually measured in BPM (Beats Per Minute). Songs with same sentiments can be detected
using tempo feature. By extracting those features songs can be categorized into different
mood based categories [1]. Our project aims to recommend and play the appropriate music,
based on user’s current emotional state with the help of image processing techniques through
user’s facial expressions.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 2
EMOTIONAL MUSIC PLAYER

CHAPTER 2

System Analysis

2.1 Existing System

The features available in the existing Music players present in computer systems are as
follows: i. Manual selection of Songs ii. Party Shuffle iii. Playlists iv. Music squares where
user has to classify the songs manually according to particular emotions for only four basic
emotions .Those are Passionate, Calm, Joyful and Excitement. Using traditional music
players, a user had to manually browse through his playlist and select songs that would
soothe his mood and emotional experience .In today‘s world, with ever increasing
advancements in the field of multimedia and technology, various music players have been
developed with features like fast forward, reverse, variable playback speed (seek & time
compression),local playback, streaming playback with multicast streams and including
volume modulation, genre classification etc. Although these features satisfy the user‘s basic
requirements, yet the user has to face the task of manually browsing through the playlist of
songs and select songs based on his current mood and behaviour. That is the requirements of
an individual, a user sporadically suffered through the need and desire of browsing through
his playlist, according to his mood and emotions.

Disadvantages

 It requires the user to manually select the songs.


 Randomly played songs may not match to the mood of the user.
 User has to classify the songs into various emotions and then for playing the songs
user has to manually select a particular emotion

2.2 Proposed System

Here we propose a Emotion based music player Emo Player). Emo player is an music
player which play songs according to the emotion of the user.. It aims to provide user
preferred music with emotion awareness. Emo player is based on the idea of automating
much of the interaction between the music player and its user. The emotions are

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 3
EMOTIONAL MUSIC PLAYER

recognized using a machine learning method Support Vector Machine (SVM )algorithm.
In machine learning, support vector machines are supervised learning models with
associated learning algorithms that analyse data used for classification and regression
analysis. It finds an optimal boundary between the possible outputs. The training dataset
which we used is Olivetti faces which contain 400 faces and its desired values or
parameters. The webcam captures the image of the user. It then extract the facial features
of the user from the captured image. The training process involves initializing some
random values for say smiling and not smiling of our model, predict the output with those
values, then compare it with the model's prediction and then adjust the values so that they
match the predictions that were made previously. Evaluation allows the testing of the
model against data that has never been seen and used for training and is meant to be
representative of how the model might perform when in the real world. According to the
emotion, the music will be played from the predefined directories.

Advantages

 Users don’t want to select song manually.


 No need of playlist.

 Users don’t want to classify the songs based on the emotions.


2.2.1 Scope of the Project:
Facial expressions are a great indicator of the state of a mind for a person. Indeed the most
natural way to express emotions is through facial expressions. Humans tend to link the music
they listen to, to the emotion they are feeling. The song playlists though are, at times too large
to sort out automatically. It would be helpful if the music player was “smart enough” to sort
out the music based on the current state of emotion the person is feeling. The project sets out
to use various techniques for an emotion recognition system, analyzing the impacts of
different techniques used.

2.2.2 Aim of the project


The aim of this paper is to develop music system that considers human emotions under
consideration. The spirit is taken from facial expressions through the digital web camera. We
've used the CNN classifier to create a neural network model. This model is trained and
DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 4
EMOTIONAL MUSIC PLAYER

subjected to observe mood from facial expressions exploitation Open CV. Songs happiness to
specific sentiments square measure classified on the premise of tempo feature in beats per
minute. A system generates music listing supported that detected mood.

2.2.3 Feasibility Study


Preliminary investigation examine project feasibility, the likelihood the system will be useful
to the organization. The main objective of the feasibility study is to test the Technical,
Operational and Economical feasibility for adding new modules and debugging old running
system. All system is feasible if they are unlimited resources and infinite time. There are
aspects in the feasibility study portion of the preliminary investigation:

 Technical Feasibility
 Economical Feasibility
 Operation Feasibility
Technical Feasibility:

In the feasibility study first step is that the organization or company has to decide that what
technologies are suitable to develop by considering existing system.

The technical issue usually raised during the feasibility stage of the investigation includes the
following:
 Does the necessary technology exist to do what is suggested?
 Do the proposed equipment have the technical capacity to hold the data required to use
the new system?
 Will the proposed system provide adequate response to inquiries, regardless of the
number or location of users?
 Can the system be upgraded if developed?
 Are there technical guarantees of accuracy, reliability, ease of access and data security?
Earlier no system existed to cater to the needs of ‘Secure Infrastructure Implementation
System’. The current system developed is technically feasible. It is a web based user interface
for audit workflow at NIC-CSD. Thus it provides an easy access to the users. The database’s

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 5
EMOTIONAL MUSIC PLAYER

purpose is to create, establish and maintain a workflow among various entities in order to
facilitate all concerned users in their various capacities or roles. Permission to the users
would be granted based on the roles specified. Therefore, it provides the technical guarantee
of accuracy, reliability and security. The software and hard requirements for the development
of this project are not many and are already available in-house at NIC or are available as free
as open source. The work for the project is done with the current equipment and existing
software technology. Necessary bandwidth exists for providing a fast feedback to the users
irrespective of the number of users using the system.
Here in this application used the technologies like Visual Studio 2012 and Sql Server 2014.
These are free software that would be downloaded from web.

Visual Studio 2013 –it is tool or technology.

Economical Feasibility:
A system can be developed technically and that will be used if installed must still be a good
investment for the organization. In the economical feasibility, the development cost in
creating the system is evaluated against the ultimate benefit derived from the new systems.
Financial benefits must equal or exceed the costs.
The system is economically feasible. It does not require any addition hardware or software.
Since the interface for this system is developed using the existing resources and technologies
available at NIC, There is nominal expenditure and economical feasibility for certain.

Determining Economic Feasibility:

Type Potential Costs Potential Benefits

Quantitative  Hardware/software upgrades  Reduced operating costs


 Fully-burdened cost of labour  Reduced personnel costs from a
(salary + benefits) reduction in staff
 Support costs for the  Increased revenue from
application additional sales of your
 Expected operational costs organizations products/services
 Training costs for users to
learn the application

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 6
EMOTIONAL MUSIC PLAYER

 Training costs to train


developers in new/updated
technologies

 Improved decisions as the result


of access to accurate and timely
information
 Increased employee  Raising of existing, or
Qualitative dissatisfaction from fear of introduction of a new, barrier to
change entry within your industry to keep
competition out of your market
 Positive public perception that
your organization is an innovator

Assessing the economic feasibility of an implementation by performing a cost/benefit


analysis, which as its name suggests compares the full/real costs of the application to its
full/real financial benefits. The alternatives should be evaluated on the basis of their
contribution to net cash flow, the amount by which the benefits exceed the costs, because the
primary objective of all investments is to improve overall organizational performance. The
table includes both qualitative factors, costs or benefits that are subjective in nature, and
quantitative factors, costs or benefits for which monetary values can easily be identified. I
will discuss the need to take both kinds of factors into account when performing a
cost/benefit analysis.

Operation Feasibility:
Proposed projects are beneficial only if they can be turned out into information system. That
will meet the organization’s operating requirements. Operational feasibility aspects of the
project are to be taken as an important part of the project implementation. Some of the
important issues raised are to test the operational feasibility of a project includes the
following: -
 Is there sufficient support for the management from the users?
 Will the system be used and work properly if it is being developed and implemented?

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 7
EMOTIONAL MUSIC PLAYER

 Will there be any resistance from the user that will undermine the possible application
benefits?
This system is targeted to be in accordance with the above-mentioned issues. Beforehand, the
management issues and user requirements have been taken into consideration. So there is no
question of resistance from the users that can undermine the possible application benefits.
The well-planned design would ensure the optimal utilization of the computer resources and
would help in the improvement of performance status.

Not only must an application make economic and technical sense, it must also make
operational sense.

Operations Issues Support Issues

 What tools are needed to support operations?  What documentation will


 What skills will operators need to be trained users be given?
in?  What training will users be
 What processes need to be created and/or given?
updated?  How will change requests be
 What documentation does operations need? managed?

Very often you will need to improve the existing operations, maintenance, and support
infrastructure to support the operation of the new application that you intend to develop. To
determine what the impact will be you will need to understand both the current operations
and support infrastructure of your organization and the operations and support characteristics
of your new application. To operate this application END-TO-END VMS. The user no need
to require any technical knowledge that we are used to develop this project is Asp.net C#.net.
That the application providing rich user interface by user.

2.2.4 Project modules


DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 8
EMOTIONAL MUSIC PLAYER

1.Face Detection

System can take real time input from internet camera. We’ve used Open CV libraries to
implement face detection through Haar cascade classifier. Haar cascade classifier enforced
piecemeal by application of options sorted into criteria such it'll discard the unwanted half
from more analysis. Face detection algorithmic rule detects face and more it'll extract needed
options from it. It work on the concept of dimensionality reduction. Which reduce the
execution time among classification. Principal Component Analysis (PCA) is a one kind of
conversion from correlated variables to uncorrelated in the form of mathematical values. It is
mostly used for the observing data and from that by some probabilistic calculation generates
models. The flow of Fisher face is like it takes classified images then it will reduce the
dimension of the data and by calculating its statistical value according the given categories it
stores numeric values in .xml file. While prediction it also calculate the same for given image
and compare the value with the computed dataset values and give according result with
confidence value. Resizing image we have chosen for dataset it mostly related to the size
which can give an precise output. The size is chosen such like the model can able to easily
distinguish face from image by haar cascade model. And the size what we get from real time
scan is not always same as data (very less difference) so, We resize it to the exact model data
size. In our case we have chosen 350*350.

2.Mood Detect:

Facial expression detection in Fisher face works with the help of trained models. Reason
behind this is to allow user to take dataset according to their use. Suppose if we take a huge
amount of dataset of around 25-30k it will give nice accuracy no doubt but if the situation is
like that the user of the devices are a few people. Now in such condition if we take some
precise dataset with around 400-450 images as input related to the user then it will also give
good accuracy with the benefit of less amount of dataset and less storage on memory to
operate. As well as small memory of data give output fast which result in quick response
time. Here we first tried with Cohn-Kanade dataset then we made some classification in the
as our need make it to train our model. For training, we have used Fisher face method of cv2
library. For training data model we have make a python code which grab all the classified
images from folders and map it with it’s emotion. These data we at an instance stored in
dictionary and then use. train method to train model. In training module dataset is divided

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 9
EMOTIONAL MUSIC PLAYER

into 3 classes for 3 different mood which is define as +1,+2,+3 which assigned for happy,
neutral and sad which same label for this modal.

3.Song play:

We have implemented the linking of python with java script through eel library. Which
provide us the privilege to access python methods from java script as well as vice versa. Here
the striating flow will be in python code as the library is implemented in python then it
transfers the control to html, JS. And according to the result we show emotions. According to
which we can classify emotion directory for playing song we have chosen this 4 emotions.

4.Classification:

Classification may be a general method associated with categorization. It’s the action or
method of clump one thing. Mood Sound is design in that way to recognised the emotion of
user and recognize mood and generate song on that bases. For recognition of image, Mood
Sound is using CNN. There area unit 2 phases in getting ready AN economical classifier.

CHAPTER 3
DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 10
EMOTIONAL MUSIC PLAYER

Requirement Specification

3.1 Details of software

What Is A Script?

Up to this point, I have concentrated on the interactive programming capability of Python.


This is a very useful capability that allows you to type in a program and to have it executed
immediately in an interactive mode

Scripts are reusable:

Basically, a script is a text file containing the statements that comprise a Python program.
Once you have created the script, you can execute it over and over without having to retype it
each time.

Scripts are editable:

Perhaps, more importantly, you can make different versions of the script by modifying the
statements from one file to the next using a text editor. Then you can execute each of the
individual versions. In this way, it is easy to create different programs with a minimum
amount of typing.

You will need a text editor:

Just about any text editor will suffice for creating Python script files.

You can use Microsoft Notepad, Microsoft WordPad, Microsoft Word, or just about any
word processor if you want to.

Difference between a script and a program


DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 11
EMOTIONAL MUSIC PLAYER

Script:Scripts are distinct from the core code of the application, which is usually written in
a different language, and are often created or at least modified by the end-user. Scripts are
often interpreted from source code or byte code, where as the applications they control are
traditionally compiled to native machine code.

Program: The program has an executable form that the computer can use directly to
execute the instructions.

The same program in its human-readable source code form, from which executable programs
are derived(e.g., compiled)

Python

what is Python? Chances you are asking yourself this. You may have found this book because
you want to learn to program but don’t know anything about programming languages. Or you
may have heard of programming languages like C, C++, C#, or Java and want to know what
Python is and how it compares to “big name” languages. Hopefully I can explain it for you.

Python concepts

If you not interested in the how and whys of Python, feel free to skip to the next chapter. In
this chapter I will try to explain to the reader why I think Python is one of the best languages
available and why it’s a great one to start programming with.

• Open source general-purpose language.

• Object Oriented, Procedural, Functional

• Easy to interface with C/ObjC/Java/Fortran

• Easy-ish to interface with C++ (via SWIG)

• Great interactive environment

Python is a high-level, interpreted, interactive and object-oriented scripting language.


Python is designed to be highly readable. It uses English keywords frequently where as other
languages use punctuation, and it has fewer syntactical constructions than other languages.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 12
EMOTIONAL MUSIC PLAYER

 Python is Interpreted − Python is processed at runtime by the interpreter. You do


not need to compile your program before executing it. This is similar to PERL and
PHP.

 Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.

 Python is Object-Oriented − Python supports Object-Oriented style or technique of


programming that encapsulates code within objects.

 Python is a Beginner's Language − Python is a great language for the beginner-


level programmers and supports the development of a wide range of applications
from simple text processing to WWW browsers to games.

History of Python
Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.

Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.

Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).

Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.

Python Features
Python's features include −

 Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.

 Easy-to-read − Python code is more clearly defined and visible to the eyes.

 Easy-to-maintain − Python's source code is fairly easy-to-maintain.

 A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 13
EMOTIONAL MUSIC PLAYER

 Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.

 Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.

 Extendable − You can add low-level modules to the Python interpreter. These
modules enable programmers to add to or customize their tools to be more efficient.

 Databases − Python provides interfaces to all major commercial databases.

 GUI Programming − Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems, such as Windows MFC,
Macintosh, and the X Window system of Unix.

 Scalable − Python provides a better structure and support for large programs than
shell scripting. from the above-mentioned features, Python has a big list of good
features, few are listed below −

 It supports functional and structured programming methods as well as OOP.

 It can be used as a scripting language or can be compiled to byte-code for building


large applications.

 It provides very high-level dynamic data types and supports dynamic type checking.

 IT supports automatic garbage collection.

 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Dynamic vs Static

Types Python is a dynamic-typed language. Many other languages are static typed, such as
C/C++ and Java. A static typed language requires the programmer to explicitly tell the
computer what type of “thing” each data value is.

For example, in C if you had a variable that was to contain the price of something, you
would have to declare the variable as a “float” type.

This tells the compiler that the only data that can be used for that variable must be a floating
point number, i.e. a number with a decimal point.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 14
EMOTIONAL MUSIC PLAYER

If any other data value was assigned to that variable, the compiler would give an error when
trying to compile the program.

Python, however, doesn’t require this. You simply give your variables names and assign
values to them. The interpreter takes care of keeping track of what kinds of objects your
program is using. This also means that you can change the size of the values as you develop
the program. Say you have another decimal number (a.k.a. a floating point number) you need
in your program.

With a static typed language, you have to decide the memory size the variable can take when
you first initialize that variable. A double is a floating point value that can handle a much
larger number than a normal float (the actual memory sizes depend on the operating
environment).

If you declare a variable to be a float but later on assign a value that is too big to it, your
program will fail; you will have to go back and change that variable to be a double.

With Python, it doesn’t matter. You simply give it whatever number you want and Python
will take care of manipulating it as needed. It even works for derived values.

For example, say you are dividing two numbers. One is a floating point number and one is an
integer. Python realizes that it’s more accurate to keep track of decimals so it automatically
calculates the result as a floating point number

Variables

Variables are nothing but reserved memory locations to store values. This means that when
you create a variable you reserve some space in memory.

Based on the data type of a variable, the interpreter allocates memory and decides what can
be stored in the reserved memory. Therefore, by assigning different data types to variables,
you can store integers, decimals or characters in these variables.

Standard Data Types


The data stored in memory can be of many types. For example, a person's age is stored as a
numeric value and his or her address is stored as alphanumeric characters. Python has

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 15
EMOTIONAL MUSIC PLAYER

various standard data types that are used to define the operations possible on them and the
storage method for each of them.

Python has five standard data types −

 Numbers

 String

 List

 Tuple

 Dictionary

 Python Numbers
Number data types store numeric values. Number objects are created when you assign a
value to them

Python Strings
Strings in Python are identified as a contiguous set of characters represented in the quotation
marks. Python allows for either pairs of single or double quotes. Subsets of strings can be
taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the
string and working their way from -1 at the end.

Python Lists
Lists are the most versatile of Python's compound data types. A list contains items separated
by commas and enclosed within square brackets ([]). To some extent, lists are similar to
arrays in C. One difference between them is that all the items belonging to a list can be of
different data type.

The values stored in a list can be accessed using the slice operator ([ ] and [:]) with indexes
starting at 0 in the beginning of the list and working their way to end -1. The plus (+) sign is
the list concatenation operator, and the asterisk (*) is the repetition operator.

Python Tuples

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 16
EMOTIONAL MUSIC PLAYER

A tuple is another sequence data type that is similar to the list. A tuple consists of a number
of values separated by commas. Unlike lists, however, tuples are enclosed within
parentheses.

The main differences between lists and tuples are: Lists are enclosed in brackets ( [ ] ) and
their elements and size can be changed, while tuples are enclosed in parentheses ( ( ) ) and
cannot be updated. Tuples can be thought of as read-only lists.

Python Dictionary
Python's dictionaries are kind of hash table type. They work like associative arrays or hashes
found in Perl and consist of key-value pairs. A dictionary key can be almost any Python
type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary
Python object.

Dictionaries are enclosed by curly braces ({ }) and values can be assigned and accessed
using square braces ([]).

Different modes in python

Python has two basic modes: normal and interactive.

The normal mode is the mode where the scripted and finished .py files are run in the Python
interpreter.

Interactive mode is a command line shell which gives immediate feedback for each
statement, while running previously fed statements in active memory. As new lines are fed
into the interpreter, the fed program is evaluated both in part and in whole

Python libraries
1. Requests. The most famous http library written by kennethreitz. It’s a must have for every
python developer.
2. Scrapy. If you are involved in webscraping then this is a must have library for you. After
using this library you won’t use any other.
3. wxPython. A gui toolkit for python. I have primarily used it in place of tkinter. You will
really love it.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 17
EMOTIONAL MUSIC PLAYER

4. Pillow. A friendly fork of PIL (Python Imaging Library). It is more user friendly than PIL
and is a must have for anyone who works with images.
5. SQLAlchemy. A database library. Many love it and many hate it. The choice is yours.
6. BeautifulSoup. I know it’s slow but this xml and html parsing library is very useful for
beginners.
7. Twisted. The most important tool for any network application developer. It has a very
beautiful api and is used by a lot of famous python developers.
8. NumPy. How can we leave this very important library ? It provides some advance math
functionalities to python.
9. SciPy. When we talk about NumPy then we have to talk about scipy. It is a library of
algorithms and mathematical tools for python and has caused many scientists to switch from
ruby to python.
10. matplotlib. A numerical plotting library. It is very useful for any data scientist or any data
analyzer.
11. Pygame. Which developer does not like to play games and develop them ? This library
will help you achieve your goal of 2d game development.
12. Pyglet. A 3d animation and game creation engine. This is the engine in which the
famous python port of minecraft was made
13. pyQT. A GUI toolkit for python. It is my second choice after wxpython for developing
GUI’s for my python scripts.
14. pyGtk. Another python GUI library. It is the same library in which the famous Bittorrent
client is created.
15. Scapy. A packet sniffer and analyzer for python made in python.
16. pywin32. A python library which provides some useful methods and classes for
interacting with windows.
17. nltk. Natural Language Toolkit – I realize most people won’t be using this one, but it’s
generic enough. It is a very useful library if you want to manipulate strings. But it’s capacity
is beyond that. Do check it out.
18. nose. A testing framework for python. It is used by millions of python developers. It is a
must have if you do test driven development.
19. SymPy. SymPy can do algebraic evaluation, differentiation, expansion, complex
numbers, etc. It is contained in a pure Python distribution.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 18
EMOTIONAL MUSIC PLAYER

20. IPython. I just can’t stress enough how useful this tool is. It is a python prompt on
steroids. It has completion, history, shell capabilities, and a lot more. Make sure that you take
a look at it.

3.2 System requirements


3.2.1 Hardware configuration:
 System : i3 and above
 Hard Disk : 100 GB.
 Monitor : 15 VGA Color.
 Mouse : Logitech.
 RAM : 4 GB.

3.2.2 Software configuration:

 Operating system : Windows 7/10

 Backend Coding Language : Python


 Frontend :html,css,js

 IDE :Anaconda prompt/Visual Studio code

 Library used : Tensorflow,opencv

CHAPTER 4

System Design:

4.1 Dataflow:

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 19
EMOTIONAL MUSIC PLAYER

Fig:Data flow diagram

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 20
EMOTIONAL MUSIC PLAYER

4.2 Use case

Fig :Use-Case diagram

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 21
EMOTIONAL MUSIC PLAYER

CHAPTER 5

System Implementation

5.1 Modular Description:

fig: System diagram

From the above diagram the spirit is taken from facial expressions through the digital
web camera using opencv library. we've used the CNN classifier to create a neural
network model. This model is trained and subjected to observe mood from facial
expressionsexploitation such as fear ,happy, neutral, sad, etcand display the song on the
output screen.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 22
EMOTIONAL MUSIC PLAYER

CHAPTER 6

Sample code
from flask import Flask, render_template, request
import numpy as np
import cv2
from keras.models import load_model
import webbrowser

app = Flask(__name__)

app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 1

info = {}

haarcascade = "haarcascade_frontalface_default.xml"
label_map = ['Anger', 'Neutral', 'Fear', 'Happy', 'Sad', 'Surprise']
print("+"*50, "loadin gmmodel")
model = load_model('model.h5')
cascade = cv2.CascadeClassifier(haarcascade)

@app.route('/')
def index():
return render_template('index.html')

@app.route('/choose_singer', methods = ["POST"])


def choose_singer():
info['language'] = request.form['language']
print(info)

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 23
EMOTIONAL MUSIC PLAYER

return render_template('choose_singer.html', data = info['language'])

@app.route('/emotion_detect', methods=["POST"])
def emotion_detect():
info['singer'] = request.form['singer']

found = False

cap = cv2.VideoCapture(0)
while not(found):
_, frm = cap.read()
gray = cv2.cvtColor(frm,cv2.COLOR_BGR2GRAY)

faces = cascade.detectMultiScale(gray, 1.4, 1)

for x,y,w,h in faces:


found = True
roi = gray[y:y+h, x:x+w]
cv2.imwrite("static/face.jpg", roi)

roi = cv2.resize(roi, (48,48))

roi = roi/255.0

roi = np.reshape(roi, (1,48,48,1))

prediction = model.predict(roi)

print(prediction)

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 24
EMOTIONAL MUSIC PLAYER

prediction = np.argmax(prediction)
prediction = label_map[prediction]

cap.release()

link = f"https://www.youtube.com/results?search_query={info['singer']}+{prediction}+
{info['language']}+song"
webbrowser.open(link)

return render_template("emotion_detect.html", data=prediction, link=link)

if __name__ == "__main__":
app.run(debug=True)

CHAPTER 7
DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 25
EMOTIONAL MUSIC PLAYER

Result

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 26
EMOTIONAL MUSIC PLAYER

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 27
EMOTIONAL MUSIC PLAYER

CHAPTER 8
System testing
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality
of components, sub assemblies, assemblies and/or a finished product It is the process of
exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific
testing requirement.

TYPES OF TESTS

Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches
and internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests
perform basic tests at component level and test a specific business process, application,
and/or system configuration. Unit tests ensure that each unique path of a business process
performs accurately to the documentedspecifications and contains clearly defined inputs and
expected results.

Integration test:

Integration tests are designed to test integrated software components to determine if they
actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration tests demonstrate that although the components were
individually satisfaction, as shown by successfully unit testing, the combination of
components is correct and consistent. Integration testing is specifically aimed at exposing
the problems that arise from the combination of components.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 28
EMOTIONAL MUSIC PLAYER

Functional test
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, systemdocumentation, and user
manuals.
Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Inp : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

Systems/Procedures: interfacing systems or procedures must be invoked.

Organization and preparation of functional tests is focused on requirements, key functions, or


special test cases. In addition, systematic coverage pertaining to identify Business process
flows; data fields, predefined processes, and successive processes must be considered for
testing. Before functional testing is complete, additional tests are identified and the effective
value of current tests is determined.

System Test

System testing ensures that the entire integrated software system meets requirements. It tests
a configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.

White Box Testing


White Box Testing is a testing in which in which the software tester has knowledge of the
inner workings, structure and language of the software, or at least its purpose. It is purpose. It
is used to test areas that cannot be reached from a black box level.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 29
EMOTIONAL MUSIC PLAYER

Black Box Testing


Black Box Testing is testing the software without any knowledge of the inner workings,
structure or language of the module being tested. Black box tests, as most other kinds of tests,
must be written from a definitive source document, such as specification or requirements
document, such as specification or requirements document. It is a testing in which the
software under test is treated, as a black box .you cannot “see” into it. The test provides
inputs and responds to outputs without considering how the software works.

Unit Testing:

Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as
two distinct phases.

Test strategy and approach


Field testing will be performed manually and functional tests will be written in detail.

Test objectives
 All field entries must work properly.
 Pages must be activated from the identified link.
 The entry screen, messages and responses must not be delayed.

Features to be tested
 Verify that the entries are of the correct format
 No duplicate entries should be allowed
 All links should take the user to the correct page.

Integration Testing
Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 30
EMOTIONAL MUSIC PLAYER

The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company
level – interact without error.

Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

Acceptance Testing:User Acceptance Testing is a critical phase of any project and requires
significant participation by the end user. It also ensures that the system meets the functional
requirements.

Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

CHAPTER 9
DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 31
EMOTIONAL MUSIC PLAYER

Conclusion
In this mood-based music system, we have implemented real-time facial emotion recognition
using CNN algorithm in OpenCV. Recognized emotion is passed to music player which has
sorted music list according to mood. This music list is sorted by using the tempo of songs. By
passing this mood, the system plays appropriate songs in that list to improve user’s mood.
This system minimizes the efforts of user to select music according to user’s current
emotional state. It may reduce physical stress and also act as a boon for the music therapy
system. We believe this sentiment-based music system will help user in enjoying their music
much more. In future, this system can be enhanced with capability of detecting mood using
voice, facial expressions and body postures to get more accuracy. Also, we can be improved
analysis and sorting of user’s playlist by mood at run time. At this stage, support of Pygame
to .mp3 files is lagging in Linux based operating system. We can be provided more accurate
API or Python module which supports all .mp3 files.

References
DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY
(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 32
EMOTIONAL MUSIC PLAYER

[1] V. Patchava, P. Jain,R.Lomte, P. Shakthi, H. B. Kandala, “Sentiment Based Music Play


System ”

[2] P. Pathak, Prof. S. Aranjo, “Mood based Music Player Karan Mistry”.

[3] Viola, P., & Jones, M. J., “Robust Real-Time Face Detection”, International Journal of
Computer Vision, 57(2), 137-154 (2004).

[4] O. Arriaga, G. Paul, M. Valdenegro, “Real-time Convolutional Neural Networks for


Emotion and Gender Classification”

[5] The Echo Nest Developer Center.

[6] Kaggle FER2013 open source dataset for face [8] A. R. Patel, A. Vollal, P. B. Kadam, S.
Yadav, R. M. Samant,“MoodyPlayer: A Mood based Music Player”. [9] C. Jenefer, S. Leena,
M. Nirmala, Dr. J. SelvaKumar, “A Survey: Expression Based Music Player”.

[7] Emotinal recognition - affectiva, 2017. [Online; accessed 11-July-2017].


[8] Firebase- real time database, 2017. [Online; accessed 11-July-2017].
[9] Java script, 2017. [Online; accessed 11-July-2017].
[10] Mean- software bundle, 2017. [Online; accessed 11-July-2017].
[11] Mongodb, 2017. [Online; accessed 11-July-2017].
[12] Moodfuse, 2017. [Online; accessed 11-July-2017].
[13] Mvc - architecture, 2017. [Online; accessed 11-July-2017].

DEPARTMENT OF CSE FACULTY OF ENGINEERING AND TECHNOLOGY


(EXCLUSIVELY FOR WOMEN),SHARNBASVA UNIVERSITY KALABURAGI Page 33

You might also like