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.
Method | Data Source | Accuracy | Time Range Support | List Length |
---|---|---|---|---|
Machine-Learning (Spotify) | Spotify Top API | ⭐️ | 3 presets (4w, 6m, 1y) | ≤ 50 |
Play Count | Streaming-history package | ⭐️⭐️ | Any (custom) | Unlimited |
Time Played | Streaming-history package | ⭐️⭐️ | Any (custom) | Unlimited |
Custom (SOON) | Streaming-history package | ⭐️⭐️⭐️ | Any (custom) | Unlimited |
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)
where the w coefficients are internal to Spotify.
Pros & Cons
✔ Advantages | ✖ Limitations |
---|---|
Works out-of-the-box | Only 3 fixed ranges (4 weeks, 6 months, 1 year) |
No data import required | Capped at 50 items |
- | Inaccurate for niche content |
2. Play Count
This method orders items purely by the number of times you played them.
Formula
If you filter by date range, we count only plays whose timestamp lies within the window.
Example
Imagine two tracks over the last year:
Track | Plays |
---|---|
Song A | 120 |
Song B | 95 |
Play-count ranking → Song A #1, Song B #2.
Pros & Cons
✔ | ✖ |
---|---|
Extremely accurate | Requires 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
Example
Track | Plays | Avg. Length | Time Played |
---|---|---|---|
Symphony (10 min) | 20 | 600 000 ms | 12 000 000 ms |
Pop Hit (3 min) | 40 | 180 000 ms | 7 200 000 ms |
Despite fewer plays, Symphony outranks Pop Hit because total listening time is higher.
Pros & Cons
✔ | ✖ |
---|---|
Accurate & bias-free | Requires 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).