-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Normal
-
Affects Version/s: 3.0.2
-
Component/s: Lookup & Match
-
None
When using "Lookup" on a single file, Picard can match a recording that shares only a couple of title words, even when the track length differs by more than an hour and the artist is completely different.
Reported on the community forum: https://community.metabrainz.org/t/why-does-this-match/815815
Example from the reporter's debug log:
- File: Mood Music (For Mood Swings) - artist Radiolab, length 1,072,013 ms (17:52)
- Wrongly matched recording: Mood swings (MBID 8d92f7f-9b11-43a6-89d8-623f7f8edd0b) - artist Gert Blokzijl, length 80:26 (4,826,000 ms), i.e. ~62 minutes longer
- Reported similarity ≈ 0.42, well above the 0.25 default floor. Changing the artist from Radiolab to a real-but-unrelated Radiohead raised the score slightly.
Root cause
length_score() in picard/matching.py clamps the length difference to LENGTH_SCORE_THRESHOLD_MS (30 s):
return 1.0 - min(abs(a - b), LENGTH_SCORE_THRESHOLD_MS) / float(LENGTH_SCORE_THRESHOLD_MS)
So a recording that is an hour too long scores exactly 0.0, identical to one that is 31 s off. A gross length mismatch therefore stops penalizing and can no longer counteract a partial title match. In this case the title similarity similarity2("Mood Music (For Mood Swings)", "Mood swings") = 0.625 on the heaviest weight (13) carries the match; artist similarity is ~0 either way and only dilutes rather than penalizes.
Steps to reproduce
1. Set a file's tags to title Mood Music (For Mood Swings), artist Radiolab, length ~17:52.
2. Hit "Lookup" (default settings: minimum similarity 25%).
3. Observe it matches Mood swings by Gert Blokzijl (80:26).
A reproduction is available in the matching eval harness (scripts/eval_matching/).