Inspiration

We’re all moody teens looking for ways to channel our emotions. This app gives us a way to easily find (out of music we know) the songs that match those emotions.

What it does

Musaic crawls your Spotify library and queries IBM Watson with the full lyrics of each song in order to determine the 'emotion' of each song. You can then specify the emotion you're currently feeling, either one of (joy, sadness, or anger) or write about it in a text box, then we'll return songs in your library that match that feeling!

How we built it

The app is written primarily in Python. We used Flask to host the backend, with Bootstrap/Jinja2 to develop the frontend in HTML/CSS. The app uses the Spotify API to log into the user's Spotify account then pulls the entirety of the user's Spotify Library of saved songs. It then uses the musiXmatch API to crawl the full lyrics for each of the songs, then selects a random subset of 100 songs to query IBM Watson for the emotion (a distribution over the five emotions joy, sadness, anger, disgust and fear).

The songs are then sorted by their emotional 'distance' (measured by L2 norm) from a user-specified emotion (either one emotion or via text submission that is also assessed by Watson). The obtained songs are then displayed via a Spotify embedding within the site, and an option to add these songs to a new user playlist is given.

Challenges we ran into

Integrating 3 APIs (especially with sequential calls) into one program made our app pretty slow, especially for a decent number of songs. We parallelized the API calls, allowing many to be called at the same time. We also investigated what metric was best as a measure of 'distance' from one distribution to another. In the end, the L2 norm gave us the most robust results with a minimum of additional computational baggage.

Accomplishments

We're happy about how much progress we made for a team of 3. But most importantly, we're proud of all the knowledge we've accumulated over the course of these 36 hours. In particular, it gives us the confidence that we can build pretty much anything, given sufficient amounts of time/motivation/caffeine.

What we learned

Even with all-out moody teen angst, your music has more in common than you really think :)

Share this project:
×

Updates