Decoding Your Music Taste: Spotify’s Mathematical Model
At the time of writing this article, there are 6021 unique genres of music on Spotify. In fact, you’re probably a fan of a genre you’ve never heard of, such as skwee, aussietronica, or deep psychobilly. Spotify has already figured out your music preferences, so there’s no need for you to know exactly what kind of music you like. Every week, Spotify is able to curate a 30-song playlist tailored to your exact music taste. But, have you ever wondered how Spotify does it?
Spotify’s recommendation system consists of three distinct algorithms, collaborative filtering, natural language processing, and sonic profiles.
Collaborative Filtering
This first algorithm actually has nothing to do with the music itself, it’s the same way TikTok recommends you videos, by writing a 6,300-word end-user license agreement that gives them permission to record everything you do until you die or lose [and never retrieve] your phone. Stored on a computer somewhere in this world, is a giant matrix that’s about 433 million x 80 million, which houses every single song on the app and records how often people listen to each song. This allows Spotify to determine which users are most similar. If one row is hitting all the same columns as another row, that means those two people are listening to the same songs. And if one of the two has a row that the other doesn’t, then the algorithm would recommend the song. Essentially, if you want to ruin somebody’s Spotify playlist, simply create a new account, listen to all their favourite songs, and then play CoComelon — The Complete Collection for 7,000 hours. However, collaborative filtering alone is not dependable for Spotify as it’s not very accurate and only recommends popular songs while ignoring ones that don’t have a ton of listening data. The solution to this lies in the next algorithm, Spotify’s natural language processing system.
Natural Language Processing System
As it turns out, the best way to categorize songs is with words, and surprisingly the internet has a lot of them. In the background, Spotify is constantly gathering text associated with songs, not just from song titles, playlist descriptions, and lyrics, but also from data on the internet such as comments, song reviews, and articles. All this is compiled into a word bank for every song and artist. Using this data, the algorithm can intuit other songs that are frequently described with the same words. Now you may have realized, that so far, none of this data is gathered from the music itself. This is when the third algorithm steps in, sonic profiles.
Sonic Profiles
For each song on the app, the algorithm generates something called a time-frequency representation, resembling something like this:
This is then represented in a neural network that I still don’t understand… so I’ll pretend I don’t have time to talk about it.
The neural network isolates a song's major features, including the key, tempo, time signature, timbre, and loudness. The algorithm will take these qualities and compare them individually with other songs you like and songs you haven’t heard. By incorporating collaborative filtering and the natural language processing system, these sonic profiles will identify songs that share similar acoustic features to the music you already enjoy, while also introducing new variables to avoid presenting anything too repetitive. And there you go, by investing $11 billion dollars annually, Spotify successfully convinces people to switch playlists and stop listening to Harry Styles for the rest of their lives.
This article was written for QMIND — Canada’s largest undergraduate community for leaders in disruptive technology.