← Portfolio

Analysis · Machine learning

Decoding Spotify Track Popularity

What makes a hit? Analyzing more than 28,000 unique tracks to uncover the audio features, genres, and patterns that drive streaming success.

The Big Picture

Spotify's algorithm and listener behavior have created a fascinating ecosystem where certain audio characteristics consistently correlate with track popularity. By analyzing more than 28,000 unique tracks across 6 major genres, we uncovered surprising patterns about what makes music resonate with listeners.

32,833
Track entries (28,356 unique tracks)
10,692
Unique Artists
6
Genres Covered
42.5
Average Popularity Score
About the Data: This dataset comes from Spotify's API and includes tracks from curated playlists across Pop, Rock, R&B, Latin, Rap, and EDM genres. Each track includes 12 audio features computed by Spotify's algorithms. A song that sits on several playlists appears once per playlist, so the 32,833 entries cover 28,356 unique tracks; the charts below count entries.

Popularity Distribution Across All Entries

2,703 entries (8%) sit at a popularity of 0, which gives the distribution its spike on the left.

Track Entries by Genre

Average Popularity by Genre

Key Finding

Pop and Latin dominate popularity. While EDM has the most entries in our dataset, Pop and Latin genres consistently achieve higher average popularity scores (47-48 vs 35 for EDM). This suggests that mainstream appeal and cultural factors play a larger role than sheer volume.

Audio Features Decoded

Spotify computes 12 audio features for every track using machine learning. These features capture everything from how "danceable" a song is to its acoustic properties. But which features actually matter for popularity?

Feature Correlation with Popularity

Interpreting Correlations: Positive values mean higher feature values associate with higher popularity. Negative values mean the opposite. Note that correlations are modest — music is complex and popularity depends on many factors beyond audio features.

What Boosts Popularity

Acousticness (+0.085) — Tracks with more acoustic elements tend to perform slightly better. Think unplugged sessions and intimate recordings.

Danceability (+0.065) — Songs you can move to have an edge. This aligns with streaming behavior where upbeat tracks get more plays.

What Hurts Popularity

Instrumentalness (-0.150) — Tracks without vocals struggle. Listeners prefer songs with lyrics they can sing along to.

Duration (-0.144) — Shorter is better. In the streaming era, long tracks get skipped before they finish.

Feature Distributions by Popularity Tier

Tiers by popularity score: low 0–33 (11,059 entries), medium 34–66 (15,604), high 67–100 (6,170). Whiskers reach 1.5× the interquartile range.

The Streaming Era Formula

Keep it short, keep it danceable, and don't forget the vocals. The data confirms what the industry has observed: streaming platforms reward songs that hook listeners quickly and encourage repeat plays.

Genre Deep Dive

Each genre has a distinct audio fingerprint. Understanding these patterns reveals why certain songs succeed within their genre and what makes crossover hits possible. Hover over any genre below to explore.

Pop
Balanced, polished, medium energy
Rap
High speechiness, rhythmic focus
Rock
Longest tracks, lowest danceability
Latin
Highest danceability and valence
R&B
Lowest energy, smooth and soulful
EDM
Highest energy and tempo

Genres are shaded by average popularity, from Pop (the strongest green) to EDM (the faintest).

Genre Audio Fingerprints

Speechiness is scaled ×3 so it reads next to the other features.

Energy vs Danceability

Tempo Distribution

Each violin is drawn from that genre's 1st–99th tempo percentiles.

Key Insights & Takeaways

After building 8 predictive models and analyzing thousands of tracks, here are the most actionable insights for understanding what drives track popularity on Spotify.

Top Artists by Track Entries

Insight #1: Duration Matters More Than You Think

Our regression models consistently showed duration as one of the strongest predictors of popularity — but in the negative direction. In the streaming era where artists are paid per stream, shorter songs with high replay value outperform epic 6-minute tracks. The sweet spot appears to be 2.5-3.5 minutes.

Insight #2: Genre-Specific Rules Apply

Pop tracks are penalized for longer durations more than any other genre. Rock listeners, however, are more tolerant of longer songs. When our model included genre interactions, prediction accuracy improved significantly — suggesting that "what works" varies dramatically by genre.

Insight #3: Energy Is a Double-Edged Sword

Surprisingly, energy has a slight negative correlation with popularity (-0.109). While high-energy tracks dominate EDM playlists, the most popular songs across all genres tend to have moderate energy levels. Think "Blinding Lights" rather than "Sandstorm."

Insight #4: Vocals Trump Instrumentals

Instrumentalness has the strongest negative correlation with popularity (-0.150). In an era of social media where lyrics get quoted, shared, and turned into TikTok sounds, purely instrumental tracks struggle to break through.

The Formula for a Hit (Sort Of)

If we had to distill the data into a formula: Keep it under 3.5 minutes, make it danceable, include memorable vocals, and aim for moderate energy. But remember — the best songs break the rules. Data can inform, but creativity still leads.

Explore the code and data

This analysis was built using Python, pandas, scikit-learn, and statsmodels. View the full Jupyter notebook with all models and visualizations on GitHub.

View full notebook →