Why Last.fm Play Duration Matters More Than Play Counts (And How I Fixed It)

Share this!

The image shows the logo of "last.fm," a music streaming and recommendation service. The text "last.fm" is written in lowercase white letters with a distinctive, smooth font on a solid red background.

I’ve been using Last.fm for 20 years. And as someone that listens to short songs and super longform pieces, I found an inequity that I felt needed addresses.

The way it presents your music listening data tells a very different story than what’s actually happening with your musical life, and once you see it, you can’t unsee it.

The issue? Last.fm’s play duration data tells a completely different story from play counts alone.

Picture this: you fire up your Last.fm profile (which, if you’ve been tracking your music since 2005 like me, represents nearly two decades of your musical DNA), and it tells you that according to your play counts, you listen to Devo more than Swans. Dead Kennedys more than Godspeed You!Black Emperor. Philip Glass more than Steve Roach.

This is precisely the opposite of reality.

The Last.fm Play Duration vs Play Count Problem

The problem is embarrassingly simple once you think about it: Last.fm counts plays, not listening time duration. A 2-minute hardcore punk song gets the same weight as a 20-minute post-rock epic. 

This Last.fm play duration issue has been recognized for years. Back in 2007, Last.fm’s own blog discussed this exact problem, noting how “a more representative ranking of musical tastes would be based on the actual time spent listening to an artist, rather than by number of tracks.” Yet nearly two decades later, Last.fm still defaults to play count rankings. 

Does that site even get any updates anymore? 

Let me give you some concrete examples from my listening data (because what’s a blog post without getting uncomfortably specific about my musical obsessions?). According to Last.fm’s raw play counts:

  • Max Richter: 1,438 plays
  • Swans: 1,164 plays
  • Philip Glass: 1,105 plays
  • Godspeed You! Black Emperor: 786 plays
  • Steve Roach: 110 plays

Based on these numbers, you’d think I’m way more into minimalist classical than epic drone metal or ambient soundscapes. But here’s what happens when you look at actual listening time:

  • Swans: 200.7 hours (average 10.3 minutes per track)
  • Godspeed You! Black Emperor: 186.8 hours (average 14.3 minutes per track)
  • Steve Roach: 104.4 hours (average 56.9 minutes per track!)
  • Max Richter: 81.6 hours (average 3.4 minutes per track)
  • Philip Glass: 53.7 hours (average 2.9 minutes per track)

See the problem? Steve Roach, with his 110 measly plays, actually represents more listening time than Philip Glass with his 1,105 plays. 

That’s not a rounding error. That’s simply not how I actually spend my time with music.

Why Last.fm Play Duration Analysis Matters (Beyond My Personal Neuroses)

This isn’t just about being pedantically correct about my listening habits. 

It’s about understanding what I connect with musically versus what appears to dominate my listening based on arbitrary metrics.

When I analyze Last.fm play duration versus play counts, I see a bunch of artists that write short, discrete pieces dominating the play count charts. 

But when I think about what music has actually shaped me, what I return to when I need to think or focus or just exist in a particular headspace, it’s those long-form artists who barely register in the play count rankings.

Imagine if Netflix recommended movies based solely on how many times you pressed play, regardless of whether you watched for 5 minutes or 3 hours. 

You’d get a very skewed picture of what actually matters to you.

The Anniversary Playlist Problem

This realization crystallized when I started wanting to create “anniversary playlists”.

Ya know, “what was I listening to this week 5 years ago?” or “what defined my listening 10 years ago today?” (Because apparently I’m the kind of person who gets nostalgic about data.)

Last.fm’s built-in tools give you charts based on play counts, which meant my anniversary nostalgia trips were dominated by whatever short songs I had on repeat rather than the albums that actually soundtracked those periods of my life. 

Without proper Last.fm play duration analysis, it’s like trying to remember your college years but only getting back a list of commercial jingles you heard frequently.

I wanted something that would show me what I was actually listening to. 

What was taking up the bulk of my musical attention based on Last.fm play duration data? 

It seemed like a solvable problem, and I was genuinely curious what the “real” picture would look like.

Enter: The Curiosity-Driven Development Project

So naturally, I did what any reasonable person would do when faced with an interesting data analysis problem: I spent several years teaching myself Python and built a system to solve it. (This is probably the most accurate summary of how most of my technical projects start: “I wonder if I could figure out how to…” followed by an unreasonable amount of code.)

The basic concept is simple: instead of ranking by play count, rank by total Last.fm play duration. But of course, nothing is ever actually simple when you start digging into music listening time analysis.

First, you need to pull your listening history from Last.fm’s API (shout out to their excellent API documentation, even if their default analytics are broken). 

Then you need to figure out how long each track actually is, which means hitting Spotify’s API to get duration data. Then you need to do fuzzy matching between Last.fm’s track listings and Spotify’s catalog, because of course the same song might be listed as “Track Title” on one service and “Track Title (Remastered 2019)” on another.

Then there’s the whole playlist generation aspect. 

Because what good is correct data if you can’t actually listen to the results? 

The system creates Spotify playlists that represent my top albums (by listening time) from any given time period. So I can get an actual, playable playlist of “what I was really listening to 5 years ago this week” rather than just a list of songs I skipped through frequently.

The Technical Rabbit Holes

The matching algorithm was probably the trickiest part. You’d think “find this song on Spotify” would be straightforward, but music metadata is a beautiful disaster. 

Songs get remastered, re-released, compiled onto different albums. 

Artists change their names. 

Sometimes the same album exists under slightly different titles on different platforms.

My solution involves increasingly desperate search strategies: first, try an exact artist and track match. If that fails, try a looser search without album filtering. If that fails, try to find any track from the album and use that as a representative. It’s not perfect, but it works pretty well for the majority of cases.

I also added Bandcamp integration (because I like supporting artists directly when possible), which involved yet another API and another layer of matching complexity. But there’s something satisfying about a system that can say “here’s your top album from 2019, and here’s where you can buy it directly from the artist.”

I’ll outline what I have with the Bandcamp functionality in a future post. A preview:

Support The Artists On Bandcamp

The whole thing runs daily, updating playlists automatically as new listening data comes in. It’s probably overkill, but there’s something weirdly comforting about knowing that my musical nostalgia is being carefully maintained by a cron job.

What I’ve Learned From Accurate Last.fm Play Duration Data

Having access to time-based listening duration data has been genuinely enlightening. 

For instance, I recently noticed that I was playing a lot of Einstürzende Neubauten’s “Perpetuum Mobile” lately, and the system showed me that I was also heavily into that album almost exactly 20 years ago. 

Makes sense. 

It came out in 2004, so I was probably discovering it for the first time back then, and my brain decided 2024 was time for a nostalgic revisit.

The anniversary playlists based on Last.fm play duration have become this weird archaeological tool for my own musical development. 

I can see clear patterns: periods where I was deep into specific subgenres, times when I was seeking out shorter, more energetic music versus times when I wanted longer, more contemplative pieces.

The Social Experiment Aspect

I’ve set up the system to generate Last.fm play duration-based playlists for a few close friends who are also longtime Last.fm users, and their reactions have been consistently interesting. There’s usually an “oh wow, I forgot I was so into that album” moment, followed by a “wait, I listened to that more than I thought I did?” realization.

It’s made me curious about rolling this out more broadly. Last.fm has this amazing community of people who’ve been meticulously tracking their listening habits for decades, and I suspect many of them would find their actual Last.fm play duration patterns as surprising as I did.

So if this is of interest to you, let me know!

The Bigger Picture (Or: Why I Care About This More Than Is Probably Healthy)

Look, I realize this is an extremely niche problem to solve with an extremely over-engineered solution. Most people probably don’t need to know precisely how many hours they’ve spent listening to doom metal versus ambient techno over the past two decades.

But there’s something meaningful here about the difference between what gets measured and what we’re actually trying to understand. 

In an age where everything is being tracked and optimized and turned into engagement metrics, it felt worth exploring: “what are we measuring, and does that represent the thing we care about?”

My Last.fm play counts made it look like I was obsessed with short, punchy songs when the reality is that I spend most of my musical time in longer, more immersive pieces. 

The data wasn’t technically wrong, but it was telling a story that didn’t match my actual relationship with music. Getting to the more accurate story through Last.fm play duration analysis felt like a puzzle worth solving.

Maybe this is just my personal version of the classic “lies, damned lies, and statistics” problem. But having access to more meaningful data has definitely changed how I think about my own listening habits and musical development over time.

How It Works

For anyone curious about the technical implementation, here’s the step-by-step process my Python script follows:

  1. Connect to MySQL database – Store all the enriched music data for fast querying and analysis
  2. Fetch Last.fm listening history – Pull recent tracks from Last.fm’s API for each user, respecting rate limits and handling pagination across potentially thousands of tracks
  3. Create missing database entries – Generate album and track metadata records for any new music that doesn’t exist in the system yet
  4. Search Spotify for track IDs – Use fuzzy string matching to find each track on Spotify, trying increasingly desperate search strategies (exact match → relaxed search → album fallback)
  5. Enrich with Spotify metadata – Pull audio features like danceability, energy, tempo, and most importantly, track duration in milliseconds
  6. Find Bandcamp links – Use the Odesli API to locate Bandcamp URLs for direct artist support (because supporting artists matters!)
  7. Calculate listening time rankings – Query the database to rank albums by total listening duration rather than play count for each time period
  8. Select representative tracks – For each top album, find the most-listened track from that album to represent it in the playlist
  9. Generate Spotify playlists – Clear existing playlists and populate them with the new duration-based rankings
  10. Update and maintain – Handle edge cases like missing durations, remastered albums, and artist name variations

The trickiest part is definitely the fuzzy matching between Last.fm and Spotify catalogs. Songs get remastered, re-released, and retitled constantly. But once it finds a match, the system can accurately calculate that Steve Roach’s 110 plays represent way more listening time than Philip Glass’s 1,105 plays!

What’s Next

I’m thinking about adding mood analysis based on Spotify’s audio features, maybe some visualization of how listening patterns change over time, possibly integration with more music platforms. Dunno yet.

I’m also genuinely curious about whether other music obsessives would find this useful.

If you’re a longtime Last.fm user who’s ever looked at your top artists list and thought “this doesn’t feel quite right,” you might be experiencing the same Last.fm play duration bias I was.

The code is admittedly pretty specific to my particular setup and requirements right now, but the core concept, measuring Last.fm play duration instead of play counts, is simple enough that it could probably be adapted for broader use.

In any event, I put it all on a public repo if anyone is interested.

In the meantime, I’ll keep enjoying my actually-accurate anniversary playlists and the weird satisfaction of knowing that my musical nostalgia is backed by mathematically sound Last.fm play duration data. 

Because apparently this is who I am: the person who builds complex systems to optimize their relationship with their own past listening habits.

And, I’m okay with that.

Leave me a tip 🙏🙏

The image shows a digital Venmo QR code with the name "Daniel Tuttle" and the handle "@DanielTuttle" above it. The Venmo logo is displayed at the bottom of the QR code.

Share this!
No Thoughts on Why Last.fm Play Duration Matters More Than Play Counts (And How I Fixed It)

Leave A Comment

0:00
0:00