Test data and example comments named real artists, records and songs, and
carried real MusicBrainz ids. One mapping swaps them for invented ones
throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping
what each case tests: sort order, index letter, escaping, title keys,
artist-prefix stripping. A test username is no longer the operator's name.
The cover-art and Last.fm connection checks still query real releases;
they reach live services and need something that exists there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decides whether tracks are proposed as one recording. No database, no
files, so every rule is falsifiable in a unit test.
Two tiers:
- exact: equal audio_stream_sha256 (identical encoded audio bytes). No
threshold and no false positives.
- acoustic: chromaprint fingerprints that agree once aligned. Two
fingerprints can start at slightly different points in the audio
(padding trimmed differently), so offsets within ±120 items (~15s)
are voted on using items that share their high 14 bits. Bit-error
rate is then measured over the overlap at the winning offset. The
approach and both constants follow AcoustID's pg_acoustid; it was
reimplemented from that description and no code was copied.
No verdict below ~10s of overlap, or for low-information fingerprints
(silence, a sustained tone). Two such tracks agree without being one
recording.
Grouping uses complete linkage: a track joins a group only if it
matches every member. Otherwise A close to B and B close to C would
merge A and C, which are not close, and it means any member can be the
survivor. Other rules:
- durations must be within 3s
- acoustic groups are capped at 8, and larger clusters are reported
and discarded as a likely shared jingle
- an exact group absorbed into an acoustic one takes the acoustic tier
- output does not depend on input order
The acoustic threshold is 0.15 bit-error rate: deliberately
conservative, since the operator's concern is different recordings of
one song being merged, and an instrumental shares its vocal's harmony.
It is unmeasured, and needs calibrating against real pairs once the
backfill has populated fingerprints (#3913 exposes it).
Nothing calls this yet; the sweep (#3910) does.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQ31KQpYbStyK5y58UmPLH