Hi there !

The project

The concept

For the Designing with Web's class, I've chosen the Artificial Intelligence assignment. Here I'm gonna experiment a new application using AI and Machine Learning. I hope you'll have fun, so please grab your EarPods and make yourself at home !

If you saw my precedent very cool project you know that I'm a huge fan of music. As I am very predictable, my project will focus on music. More precisely, I want to create an application where you can upload music with an AI able to find its musical genre (i.e : soul, disco, classical, etc.).

The goal

My project, I think, could be useful in different fields :

  1. As a pedagogical platform, it can help people to satisfy their musical's personal curiosity and to extend their comprehension of music;
  2. As a business tool, it can help companies like Spotify or Deezer for example to classify songs automatically and to make more relevant personalized playlists for their users;
  3. As an open and friendly AI, it can help indexing numerous musics in a publical database for the common knowledge.

First things first

What is a musical genre ?

It's a classification that allows to put a music in a specific category. The musical's genre of a song depend, according to definiton.net, of "the musical techniques, the styles, the context, the content, the spirit " and the geograhical origin. The matter is that sometimes the classification of a song can be arbitrary and controversial. Moreover, the website Everynoise, which classified almost all genres and sub-genres of music, count exactly 2.203 different styles of music.

Classification

That being said, we have to focus on genres which are objectively defined, easily recognizable musicaly, without taking into account sub-genres. Following my researches, the list of the 16 main musical's genres the most relevant and complete for us could be :

  • Blues
  • Classical
  • Disco
  • Easy-listening
  • Electronic
  • Funk
  • Gospel
  • Hip-Hop
  • Jazz
  • Pop
  • R&B
  • Reggae
  • Reggaeton
  • Rock'n'Roll
  • Soul
  • Traditional World music

I know those genres are very generalistic but it's the price to cover the most part of the music field. Each one of those genres includes a lot of sub-genres and the AI will make some shortcuts, classifying for example "Country" as "Traditional world" or "Metal" as "Rock'n'Roll", at least at the beggining.

Sources : Vikidia; Bliss; Wikipédia.

How it works

Feed the AI

Considering the nature of our AI, our machine learning process will use supervised learning. We have to establish and give a large dataset with classifications to the machine. The dataset will contain many musics for each genres we defined and the AI will learn from that data. Here's an example for the Hip-Hop genre.

Genre Artist Song
Hip-Hop Eminem Not Afraid
Hip-Hop Dr. Dre Still Dre
Hip-Hop Drake God's Plan
Hip-Hop Nekfeu Plume





This example shows how it could work. We affect a lot of examples to each genre of music by uploading files and telling to the machine which genre it is for each one. Here we said to the AI : "Not Afraid by Eminem, it's hip-hop music".

Also, music is a particular data because it could be use in many ways. For our needs, I think the most relevant technology could be spectrograms. This technology allows a very precise sound's analysis : frequencies, power and time, it's like a "3D" vision of a sound. Try playing with this little app, you'll have an idea of how it works :

Learning process

The machine will "read" the file we uploaded and will identify objectical caracteristics like the speed, the sonorities, the tones, the beat, the basses, the trebles, etc. From the many examples and their carateristics, the machine will learn to determine a genre from a particular song.

There is already softwares which are able to read those carateristics, it's the case of DJ's softwares. Serato DJ for example, is able to show the whole structure and the BPM of a music.

Serato-Screenshot
Let's have a look to this Serato's screenshot. When we uploaded the song Lady by Modjo (which is a very good song by the way), it's able to read the musical's caracteristics of the music in a few seconds. Here we can see, from left to right :

This technology is very interesting for our project because we know that all genres have their typical musical's components. For example, house music is typically composed of a kick drum sound on each first beat of a bar, of a snare drum every second first beat of a bar, and of a charleston between those beats. Moreover, anyone hearing an electric guitar with a distortion and a drum knows that he is very probably listening to rock'n'roll music.


We can say music's genres are composed by defined patterns of musical's elements. We can conclude that it's possible to teach to an AI how she can link a music to its genre thanks to its proper caracteristics. It's an inductive reasoning. By analyzing a music's structure, the AI will target which genre it's corresponding.

Shade the results

However, let's see a limit of our thinking. Music is art, and a song can contain, thanks god, various inspirations. It is false to classify all songs in a single and only category. I explain myself, if you listen to those songs :


For the first one, you'll tell me "Yep it's soul music, so what's the point ?", but sometimes it's not as simple. For the second one, we can ask : is it hip-hop ? is it soul ? Well, it's both : soul for the chorus and hip-hop for the verse. Our AI have to take this into account, so it'll we be much more precise if it can detect two or three genres in a single song. For the second example it could say something like "This music is 70% hip-hop and 30% soul."

Let's summarize

Here's the summary of our AI's development :

  1. We give the AI a large dataset of songs telling for each one what genre it is;
  2. The AI analyzes the structure of each songs (speed, beat, tones, etc.);
  3. The AI learns and integrates the different musical's patterns of each genre thanks to the dataset;
  4. The AI knows what musical's caracteristics define a genre's belonging. It is now able to identify a song's genres;
  5. We can upload a song on the platform and it'll tell the different genres identified.

Project's model

Through this little dialog you'll discover the user experience of this AI's project :

  1. Garry, A Random User Which Has Very Good Tastes : *upload the song Like Sugar by Chaka Khan on the platform*
  2. The AI : *Analyze the music*
  3. The AI : "What a good choice of music ! This song is 50% electronic, 40% funk, 10% disco, and definitely 100% cool !"
  4. GARUWHVGT : "Wow, it's the best AI I've ever seen !"

Beyond the project

Opportunities

This AI could be publish on the web and trained by users. It could be open and every surfer could upload a song and precise its genre in order to extend the AI's dataset : the bigger its library gets, the more effective it is. Also, in a second time we could add a lot of other genres of music and the program will be able to define more and more precise shades of genres.

For music streaming platforms and other softwares which process musical's data, it can be a very powerful tool. In fact, for business as Spotify or Apple Music, playlists and suggestions' algorithms are determining factors to attract and retain customers. Such an AI, if it improves itself, could be a very competitive asset.

Limits

Taking into account that music is an artistic field, it's not always possible to put creations in boxes. A music can be totally creative and count many different styles, or even be out of every genres. Art as a lot of subjective aspects, it's not an exact science, and music is constantly evolving, which can lead to arbitrary or false results.

Thanks for your attention



Is it rock ? Is it soul ?

Musically yours,
Joseph Gignoux