Creating an App that can Detect Your Emotions Based on Your Voice

Photo by Priscilla Du Preez on Unsplash

Imagine this: You are going to school and as you walk up to your group of friends you notice one of your friends seems quieter. They are quieter than usual, are wearing sweatpants, and have bags under their eyes. You ask them: What’s wrong? And they respond:

I’m fine

At that moment, you know that they are not fine.

There are ways to tell, such as their appearance, but one of the key giveaways was the way they said I’m fine (their tone). You were able to tell based on their tone. Being able to tell tone is usually the best way to tell a person how they feel. From talking passive-aggressively, sarcasm, etc…. These are usually ways to tell how people really feel. Now, wouldn’t it be cool if machines could also detect emotions in your voice? Well, I built an app that can do just that.

Photo by William Hook on Unsplash

What are classifiers?

I already wrote about classifiers before in this article and how they work. To summarize, A classifier is an algorithm that sorts data into labeled classes or categories of information. They usually work by using machine learning algorithms to learn and help classify data better (learn more about machine learning in this article). Machine Learning are computer algorithms that work to help computers learn without human intervention. They work to help the classify train to help become better at classifying data.

Jobs in AI

How did I make it?

The model

What did I use

To train the model, I used Create ML, which is Apple’s machine learning application. Create ML uses transfer learning, which is when it takes other algorithms to create their machine learning models. This application is great as you could create and make machine learning models easily. You could create image classifiers, recommenders, object classification, motion classifiers, etc. This application is very versatile and easy to put into application to use. For this model, I used a sound classifier.

How I trained the model

To create this, I had to create a machine learning model. Now for this model, I had to start by creating training data (in this article, I talk more about training data while creating a machine learning model). To summarize, training data is what allows the model to learn to classify data. For this training data, I got all the audio samples from this website. For this website, I downloaded over 1,000 files. I made five folders labeled happy, sad, neutral, angry, and fear. Each of these files has around 400 files each. Each class has files of men, women, different ages, and dialects expressing the emotion. This set had a lot of variation and it made a good set to train and make a good model.

I also created testing data from the same website. It also had variation and was a good way to test the model and make sure that it works well. Once I got the training data done, I was able to put it into Create ML to build the model.

How does the model work

Now, let’s talk about how the model trains the data. Although there are many ways to classify sound, most of them use something called deep neural networks. Deep Neural Networks use a series of input and output layers.

Top 4 Most Popular Ai Articles:

1. AI for CFD: Intro (part 1)

2. Using Artificial Intelligence to detect COVID-19

3. Real vs Fake Tweet Detection using a BERT Transformer Model in few lines of code

4. Machine Learning System Design

They have the input layer, output layer, and a bunch of hidden layers that help classify the data into the layers. They are loosely based on the human brain and how it works. Here’s another article I wrote that explains a little more on how classification works. Here’s an article I wrote that talks about the different types of classifiers (Click here).

The testing phase

Once the model finished testing, I had to put it into testing. To test it, I had to upload the testing file, have the model guess what it is, and decide if it was good and it needed more testing. If there was one class that the model had trouble guessing, I would go back to the training data and add more files or delete files that may have caused the model to get less accurate results. Then I would make a model and retrain. I repeated the process until the model was perfect.

The App

For this app, I wanted to create an app that easily displayed how my model works so that other people could see how it works as well. You can read the article here. I liked the design they created for the app as it was simple, colorful, and easy to display the goal of what my article created. I highly recommended reading this article to learn more about how the guy created the app.

I’m not going to explain the coding process that much since you could read more about it in the article I linked above. To summarize what I wrote, I built the app to listen to your tone, and based on what it hears, it will display the name of the emotion associated with a certain color. In the end, the app should look something like this:

After a few hours, I was able to come and finish the app. If you want to view the files. You can find them here: https://github.com/AssiHann21/AVoiceEmotionClassifier

I was able to create an app that uses supervised learning to classify people’s voices into different tones.

Don’t forget to give us your ? !


Creating an App that can Detect Your Emotions Based on Your Voice was originally published in Becoming Human: Artificial Intelligence Magazine on Medium, where people are continuing the conversation by highlighting and responding to this story.

Via https://becominghuman.ai/creating-an-app-that-can-detect-your-emotions-based-on-your-voice-fe1ccdd5177f?source=rss—-5e5bef33608a—4

source https://365datascience.weebly.com/the-best-data-science-blog-2020/creating-an-app-that-can-detect-your-emotions-based-on-your-voice

Published by 365Data Science

365 Data Science is an online educational career website that offers the incredible opportunity to find your way into the data science world no matter your previous knowledge and experience. We have prepared numerous courses that suit the needs of aspiring BI analysts, Data analysts and Data scientists. We at 365 Data Science are committed educators who believe that curiosity should not be hindered by inability to access good learning resources. This is why we focus all our efforts on creating high-quality educational content which anyone can access online.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started