How Spotify Chooses What to Play Next ⏭️

Between the Algorithm and Your Speakers

Arnold Wafula
4 min readJul 4, 2023
Image courtesy: Thibault Penin on Unsplash

Introduction

Founded in 2006 by Daniel Ek and Martin Lorentzon, Spotify is the most popular digital music streaming platform. As of Q2 2023, it has a 31% market share, translating to 517 million active users.

Image: Midia Research

So you are in your feels and need some music to match your mood. What’s the first song that comes to mind? “Marvin’s Room” by Drake?, “Pink + White” by Frank Ocean?, “Bed Peace” by Jhene Aiko?, or perhaps “Charge It” by ENNY? Whichever song you play, right after, another song with a similar tempo or mood plays and on and on.

So, how did the Spotify algorithm so accurately select the next songs? 🤔

Spotify tops in terms of playlisting and recommendations compared to other music streaming platforms. It has leveraged the power of data to improve its recommendation algorithm drastically. How did this come to be?

Spotify Acquires Echo Nest

In March 2014, Spotify acquired the music data company Echo Nest. Over time, this acquisition has proven genius, putting the streaming giant in the driving seat. As per foundbyspotify, over a third of all new artist discoveries happen through “Made for You” recommendation sessions.

Behind the recommendation system is a machine learning model trained to learn listener tastes. With this information, it can accurately recommend content based on that. The algorithm works courtesy of two things;

  1. Collaborative Filtering
  2. Content-Based Filtering

Collaborative Filtering

Collaborative Filtering uses data to create a map of songs and artists. Mapping works based on the probability of tracks being playlisted together. Like a map, every song is assigned a location. The location of each song on the map is based on how listeners have added them to playlists and listened to them.

Songs that meet the above criteria are closer to each other on the map and vice versa. Let us see two examples based on Billboard Hot 100 chart songs.

“Calm Down” and “Bandana” on a Spotify Playlist

Rema & Selena Gomez’ “Calm Down” and “Bandana” by FireBoy DML are likely to be playlisted together, therefore, closer to each other on the map.

“Calm Down” and “Bandana” on the map.

On the other hand, tracks like “Anti-Hero” by Taylor Swift and “Rich Flex” by Drake & 21 Savage are not likely to be playlisted together and hence far apart on the map.

“Anti-Hero” and “Rich Flex” on the map

Despite working well, mapping is far from perfect. For instance, during the holiday season, songs like “All I Want For Christmas” by Mariah Carey and “Silent Night” by Bing Crosby & Frank Sinatra are often found in the same playlists despite some key differences.

  • “Silent Night” is a Christmas carol
  • “All I Want for Christmas” sounds like a pop song

Due to these inaccuracies, content-based Filtering comes in.

Content-Based Filtering

Content-based Filtering (CBF) uses song and artist metadata (release date, record label, etc.) to determine certain metrics like;

  • Danceability
  • Liveness
  • Loudness
  • Energy
  • Valence, etc.

Danceability is measured through tempo, rhythm stability, beat strength, and overall regularity. CBF also considers a track’s cultural context by studying the lyrics and adjectives used to describe the song in blogs, news articles, and reviews.

CBF provides better insight; hence, songs filtered based on their content are more accurately placed and recommended.

NB: Spotify has more data than its DSP counterparts (Apple Music, Tidal, Deezer, etc.), which it uses to create customized playlists, radio, etc.

Drawback

However decent the Spotify algorithm is, it is not optimized for new artists since insufficient data exists. Humans are involved in handpicking music and recommendations, hence eliminating algorithmic bias.

Conclusion

The article was inspired by the Wall Street Journal’s Tech Behind series.

As we have seen, Spotify has a lot of data to train its algorithm, making accurate recommendations. The curation of songs also considers what other listeners of similar music like and uses mapping to compare and contrast music listenership. Data is king.

Thank you for reading 🥳. Follow, share, and tap the “Give a tip” button below the article to support. For business, reach me through my email here 📧.

See you at the next one

Peace ☮️✌️

--

--

Arnold Wafula

NATIVE ANDROID DEVELOPER & TECHNICAL WRITER. OPEN TO GIGS. CONTACT ME AT arnold.wafula0@gmail.com