Inspiration

We were really interested in doing a data hack that could ultimately involve visualization of some really cool data. Having gushed over Spotify's API in the past, we thought this was the perfect time to try our hands at it!

What it does

Music trend analysis! We grabbed the top 100 hits from Billboard for a certain week in time, and we found the corresponding song on Spotify, containing unique track feature information. We analyzed each song on the top 100s of that week, using our own algorithm to classify the song to a predominant mood. We then further consolidated the information into statistics, such as breaking down the percentage composition of each mood within a specific week.

How we built it

We used BeautifulSoup4 to help us scrape the Top 100 tracks from Billboard. We then used Spotify's API to search for the corresponding song and obtain that information, storing it in a PostgreSQL database via Google Cloud's cloud SQL database. We also used Google Cloud's bucket hosting to successfully connect our Flask backend to the SQL database via the schema file. We designed the algorithm and logic behind mood classification in Flask/Python, and used endpoints to access it in our frontend and display the data.

Challenges we ran into

None of us had much experience with this kind of project before, so we had a lot to learn from scratch! We made a web scraper and used a PostgreSQL database for the first time, which was a particular challenge when we didn't realize our IP addresses had changed and we could no longer access the database.

Accomplishments that we're proud of

Being able to take on a whole lot of unknown and coming out with something to show for it! We also listened to over 200 music tracks this weekend to try and better understand the Spotify API for our classification algorithm.

What we learned

That just because a song sounds a certain way, doesn't necessarily mean it's a "sad song" or "happy song" when you look at the data. The vocal melody, backing accompaniment, song rhythms, and so much more truly play their parts in making each song unique. We also learned a ton with new tech like BS4 and GCP!

What's next for MoodCensus

Some next steps we'd like to take include:

  • Refining our somewhat hastily made algorithm to be more accurate and have more research-backed rationale
  • Using ML models to classify the mood for increased accuracy and efficiency
  • The use of sentient analysis on the lyrics of each song to further increase the accuracy of classification (which was done through audio qualities).
  • Improving the statistics and data visualization we can provide

Built With

Share this project:

Updates