Harmony Support

Computation Methods

How Harmony calculates rankings & statistics - formulas and practical examples.

Computation Methods Explained

Harmony offers three ways to rank your tracks, artists, and albums. Each method serves a different purpose depending on the insights you’re after. The table below gives a high-level comparison before we dive deeper.

MethodData SourceAccuracyTime Range SupportList Length
Machine-Learning (Spotify)Spotify Top API⭐️3 presets (4w, 6m, 1y)≤ 50
Play CountStreaming-history package⭐️⭐️Any (custom)Unlimited
Time PlayedStreaming-history package⭐️⭐️Any (custom)Unlimited
Custom (SOON)Streaming-history package⭐️⭐️⭐️Any (custom)Unlimited
Tip: Uploading your Extended streaming history unlocks the Play Count and Time Played methods.

1. Machine-Learning (Spotify API)

Spotify’s Web API returns a list it calls “Top Artists/Tracks” which is generated by proprietary models. The exact recipe is not public, but factors likely include:

  • Total play time per item
  • Skip rate
  • Recency (when you listened)
  • Historical presence in previous lists

Formula (conceptual)

score=w1play_time+w2(1skip_rate)+w3recency+w4streak\text{score} = w_1 \cdot \text{play\_time} + w_2 \cdot (1 - \text{skip\_rate}) + w_3 \cdot \text{recency} + w_4 \cdot \text{streak}

where the w coefficients are internal to Spotify.

Pros & Cons

✔ Advantages✖ Limitations
Works out-of-the-boxOnly 3 fixed ranges (4 weeks, 6 months, 1 year)
No data import requiredCapped at 50 items
-Inaccurate for niche content

2. Play Count

This method orders items purely by the number of times you played them.

Formula

score=total_plays\text{score} = \text{total\_plays}

If you filter by date range, we count only plays whose timestamp lies within the window.

Example

Imagine two tracks over the last year:

TrackPlays
Song A120
Song B95

Play-count ranking → Song A #1, Song B #2.

Pros & Cons

Extremely accurateRequires package import
Custom time ranges-
Faster than API (local DB query)-

3. Time Played

Here we rank by milliseconds listened rather than count. Longer tracks (podcasts, DJ mixes) get fair representation.

Formula

score=listen_duration_ms\text{score} = \sum \text{listen\_duration\_ms}

Example

TrackPlaysAvg. LengthTime Played
Symphony (10 min)20600 000 ms12 000 000 ms
Pop Hit (3 min)40180 000 ms7 200 000 ms

Despite fewer plays, Symphony outranks Pop Hit because total listening time is higher.

Pros & Cons

Accurate & bias-freeRequires package import
Rewards long-form content-
Custom time ranges-

Choosing a Method

  • Casual glance → Machine-Learning is fine.
  • Precise stats & deep dives → Play Count or Time Played.
  • Long DJ sets, podcasts → Time Played gives the fairest ranking.

You can switch methods from the Sort dropdown on the settings page (SOON).

Now you know exactly how those numbers are produced, happy analysing!