Skip to content

Spotify song recommendation system developed during mentorship period of Microsoft Intern Engage 2022.

Notifications You must be signed in to change notification settings

appleswiggy/engage2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Musify - Spotify song recommendation system

The engine works by comparing the audio features of the songs.

The audio features of the songs include:

  • valence - Measures how positive a track sounds, from 1 (extremely positive) to 0 (extremely negative).
  • year - Year in which the song was released.
  • acousticness - Confidence measure of whether a track is acoustic.
  • danceability - How suitable a track is for dancing.
  • duration_ms - Duration of a track, in milliseconds (ms).
  • energy - How intense and active a track is.
  • explicit - Whether the song is explicit or not.
  • instrumentalness - Proportion of instrumental parts in a track.
  • key - Overall key of the track.
  • liveness - Detects live audience in a track. Represents the probability that a track was performed live.
  • loudness - Overall loudness of the track, in decibels (dB).
  • mode - Whether the track is in major mode (1) or minor (0).
  • popularity - Current popularity score of the song.
  • speechiness - Proportion of spoken words in the track.
  • tempo - Overall tempo of a track, in beats per minute (BPM).

Vectors of all the songs are created by using the numerical values of these audio features. Cosine distance is then calculated between the vectors, the less the distance between two vectors are, the similar they are based on their audio features.

Note: You need to set up some environment variables in the .env file in the root directory of the project and in the .env.local file in the web/ subdirectory of the project.

Installation

Note: Python 3.10 has an issue with project's dependencies, please use Python 3.9

  • Git clone the repository to your local system and open it in terminal/cmd.
  • Change the directory to engine: cd engine/.
  • Install Python dependencies: pip install -r requirements.txt or python -m pip install -r requirements.txt.
  • Start the Flask API server: python api.py.
  • Open the repository in another instance of terminal/cmd.
  • Change the directory to web: cd web/.
  • Install next: yarn add next or npm install next.
  • Create production build: yarn run build or npm run build.
  • Start the production server: yarn run start or npm run start.
  • Go to the URL shown to you in the output of above command.

Note: You need to run both flask server at engine/api.py and the next js server at web/

The engine exposes three API endpoints: /single, /multi and /playlist. /single is used to find songs similar to a given single song which is used in the web application to list You might also like ... column when the user play that song. /multi is used to find songs similar to user's last 15 recently played songs. They are shown in the explore tab of the sidebar in the web application. /playlist is used to find songs similar to the ones in the user given Spotify playlist link.

The web application built on the top of the engine also includes a search tab in the sidebar which uses MongoDB Atlas search to provide seamless search among all the songs in the dataset. The web application also supports Google login authentication linked to MongoDB.

The detailed explanation of the working of the project can be found at: https://docs.google.com/document/d/1Jj_l6_ycqQLvsVtgNls-UIUYU9ORDPDi96XEjz-lIk0/edit?usp=sharing

Screenshots

image image image image image image image image image

About

Spotify song recommendation system developed during mentorship period of Microsoft Intern Engage 2022.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published