/Diversify

Spotify analytics and new music recommendations.

Primary LanguagePython

Diversify

Check it out here

Diversify (2)

Inspiration

Diversify is a Spotify analytics web app that allows one to view all their music data and get to know information about their top songs/artists, listening habits, how "basic" their music taste is and even generating new music based on personal interests.

Having Spotify as my favourite music streaming platform and loving the concept of the "year wrapped," I wanted to make something similar which allowed me to see my data whenever I pleased. I also wanted to compare my top music choices with that of the top songs in a particular year to see how diverse the type of music I listend to was.

This led me to creating Diversify. With this app, anyone can view their data and learn more about themselves and the music they listen too. They can also find new songs based on their own interests or go crazy and build random playlists for any mood!

Built With

  • Flask: Web framework used for setting up the app

  • Spotify Web API: Used to retrieve user data

  • Python (Requests): Used for sending requests to the Spotify Web API with Python

  • Pandas: Used for manipulating data

  • Azure: Cloud Service used for performing Sentiment Analysis on song lyrics

  • Lyrics OVH: API used to retrieve song lyrics

  • Chart.js: Used for visualing user data on various graphs including: bar, radar, doughnut etc.

  • Kaggle Datasets: Used to compare user data with the top Spotify songs in 2020

  • Heroku: Platform used to deploy the app

Getting Started

If you want to just use the finished web app, please skip to the "Usage" header. If you want to integrate my APIs into your own projects then follow these steps:

  1. Go to the directory you want in your command line and write:

     git clone https://github.com/parth-p29/Diversify.git
    
  2. Next write the following to install all dependencies:

     pip install -r requirements.txt
    
  3. Create a Spotify Dev account and make a project so you can get 3 credentials: Client ID, Client Secret and Redirect URI

  4. Traverse to "oauth.py" file and place in your values here:

     self.CLIENT_ID = "YOUR CLIENT ID"
     self.CLIENT_SECRET = "YOUR CLIENT SECRET"
     self.REDIRECT_URI = "YOUR REDIRECT URI"
    
  5. You can use my OauthClient class to authorize with the Spotify API and use my various tools as you need!

  6. [Optional] if you want to use the sentiment analysis feature, create an Azure account and make a "Text Analytics" resource group

  7. Find the "azureclient.py" file and place the Key and Endpoint provided in Azure here:

         self.client = TextAnalyticsClient(
         endpoint="YOUR AZURE ENDPOINT",
         credential=AzureKeyCredential("YOUR AZURE KEY CREDENTIALS"))
    

Usage

You can access the web app here

You will first be greeted to login with your Spotify account and authorize the app to have access to some of your data.

Once logged in, you can see your profile and the navigation bar with 3 other tabs you can access:

profile page

The other 3 tabs take you to the "My Music", "Analytics" and "Recommendations" pages. In the My Music page, you can see your top songs/artists in 3 different time frames (recent, 6 months and all time).

You can also click on the songs/artists and see more specific information about them. For the songs, you can see how popular they are, specific details about their audio, their lyrics and even a sentiment analysis describing how positive, negative or neutral the song is. For example:

infopage pt1

infopage audio analysis

infopage lyrical analysis

In the analytics page, you can see the analyzed history of your Spotify data such as: the audio features of the top songs you listen to, how popular your songs/artists are and also compare that with the most popular songs on Spotify. You can also get to know your most prominent genres and see an overall score depicting how your music taste compares with the public:

basic score

On the recommendations page, using all the data collected and analyzed, a list of a couple songs and artists is produced that you will potentially enjoy. To test them out, you can even click on them to hear the songs and see its features to better judge if you want to add it to your playlists.

If you want to just randomly make interesting playlists with differnt features such as: a party playlist or a chill playlist, there is also a tool that allows you to do that:

recommendation creator

You can adjust the various sliders to produce different songs. The songs produced will still be aligned to your interests but with your customized audio features!

Authors