Inspiration

Music was a shared interest among all of us. We noticed that most music recommendation software was based around what other people listened to, not the content of the song itself. Due to this, we decided to create an app that uses machine learning to compare key features of songs to find more that sound similar.

What it does

On the front page, there is a text box in which a YouTube URL can be pasted and submitted. This URL is then used to acquire metadata and an mp3 version of the song. The metadata is used to find 100 similar songs from Spotify. The mp3 is used to narrow these songs down to 10 based on similarity of key features (acousticness, danceability, duration, energy, instrumentalness, key, liveness, loudness, speechiness, tempo, valence, and lyrics). The information about these 10 songs is then sent back to the front end for the user to see.

How we built it

We first use the YouTube API to scrape a song name and artist from the YouTube link. We then use the Spotify API to to get the spotify track id for the song that was uploaded. We then use the track id with the API again to get a baseline 100 reccomended songs by Spotify for that track. We ran tests using Google Cloud Compute to test the optimal size of how many songs should be chosen from Spotify as a baseline to optimize how long the process took to run while still keeping a large pool of songs to narrow down from. We then get feature data for all those 100 songs such as 'acousticness', 'danceability', 'duration_ms', 'energy', 'instrumentalness', 'key', 'liveness', 'loudness', speechiness', 'tempo', and 'valence' and normalize all these features to a scale between 0 and 1 based on the min and max values of those features derived from a very large song Kaggle Dataset. We then run a cosine similarity metric between the chosen song and the 100 songs using scikit-learn's metrics to compute a similarity score between 0 and 1 for the chosen song and pick the top 10 songs by similarity score to recommend.

The app itself was built using a Django back-end and a React front-end. A Rest API was created in Django that, when called by the front end, called a function that searched for recommended songs and returned them.

Challenges we ran into

No one on the team had much experience with front-end development, so team members had to step up and learn how to make a simple interface for the app. Django was chosen because the machine learning aspect of the app was done in python, and it was easiest to interface with a python-based platform. However, no one on the team had much experience with Django, so we had to research how to set up a Rest API and how to connect it to a React front-end. Due to all of the learning and research needed due to the first two challenges, we ran out of time too fast. Due to this, we did not accomplish everything we wanted to, including deployment of the app and implementation of accounts.

Accomplishments that we're proud of

The first batch of recommendations we generated was not very reflective of the input song. However, as we refined the machine learning algorithm and used additional APIs, the app started to give good recommendations for the given song. Since this was our purpose for starting this project, this gave us a great sense of accomplishment. Some members on the group had never used APIs before, so being able to string many of them together to accomplish a goal was a huge accomplishment.

What we learned

Each team member learned both from each other and through independent study. Every team member is now much more familiar with machine learning, front-end design, python, Django, and the use of APIs.

What's next for Song Explore

Due to time restrictions, we were not able to implement all of the features we spent time developing. This includes an account feature, where users can create an account to save songs and recommendations they like. The Django back-end was interfaced with CockroachDB to store user data. One of the next big steps for Song Explore is implementing this feature, and using saved songs to further refine users' searches by updating the machine learning algorithm. Also, due to lack of experience, the front-end of the app is very simple. A big upgrade to the app would be a more interactive interface that includes more information about the songs, loading animations, logos, and more. Another step that needs to be taken is testing. More rigorous testing would ensure that the app works exactly as intended for all test cases. Last, we did not have time to learn how to deploy the website, so this would be a crucial next step for the app.

Team Leader's Slack

Aditya Kompella swamphacks-vii.slack.com/team/U01LD6237A7

Share this project:

Updates