CROSS_TRACK_DISTINCTNESS_VALIDATION.md

music/exemplars/instruments/CROSS_TRACK_DISTINCTNESS_VALIDATION.md

CROSS-TRACK DISTINCTNESS — every track its own tune

Tier: MEASURED INSTRUMENT. Produced by harness/music_gen/instr_cross_track_distinctness.py, which writes this file and its machine record together and writes nothing else.
The law it measures: No two tracks may share more melodic material than a declaration licenses: every track its own tune, and a reprise is design only where the plan names the partner and the node that earns it.
CANON SUBORDINATION: Josh's ruling of 2026-08-07 night — "please don't use the same exemplar melodies across all tracks, even if in the same region we still need novelty" — is the authority, at the tail of docs/spine/DECISIONS_PENDING_JOSH.md. This file is a measurement of that ruling and changes no canon.
Machine record: build/audio/exemplars/instruments/CROSS_TRACK_DISTINCTNESS_VALIDATION.json.
Legal posture: analysis for understanding only; audio is read from disk, measured, and never copied, redistributed, or used as model input.

1. The one-paragraph answer

IT FLAGS ROUND 2 — all 3 of 3 pairs, on the scores — AND IT SPARES BOTH REPRISE CATALOGUES, which is the pair of results the instrument had to produce to be worth anything. Round 2's three cues carry one identical six-note head cell, MIDI [62, 66, 69, 78, 71, 69], and the plans that declare it declare a FOUR-note quotation of a shared ancestor. Six shared notes against a four-note licence is two notes nobody wrote down, and that excess is what fires. Chrono Trigger's 21 intra-catalogue pairs flag 0 and FINAL FANTASY VI's 6 flag 0. The threshold is not a choice: it is the 99.9th percentile of 55,078 sibling pairs across 21 released albums — similarity 0.3132, excess over chance 2.353 notes.

THE SHARPEST RESULT IN THE FILE IS THE ONE THAT COMPLICATES THAT SENTENCE, so it is printed second rather than buried in section 6. The two catalogues are spared by the SYMBOLIC arm, which compares opening hook against opening hook. The AUDIO arm, which searches one track's motif across another's whole length, finds FINAL FANTASY VI's reprises exactly where they live: Terra's Theme inside the Ending Theme at 9.9 minutes, lift 0.8332, against a sibling p95 of 0.5817 — and 4 of the 6 FF VI pairs stand above that sibling bar. The similarity measurement, left to itself, WOULD flag the practice this program is trying to build. What spares a real leitmotif catalogue is not the measurement and never could be. It is that a reprise is DECLARED. That is the empirical proof that the declaration is doing the licensing work rather than the threshold, and it is why the rule in section 2 is built the way it is.

What it cannot do, stated before anything else is read. The instrument does not decide legitimacy and has no way to. It measures how much melodic material two tracks share; the DECLARATION in the plan decides whether that sharing was designed, and an undeclared recurrence is what fires. That makes the instrument only as good as the declarations, and it means a lane that writes a leitmotif_references block around a lazy copy will pass. The defence is that the declaration has to name the NODE THAT EARNS the return, which is a canon claim a critic can check, and a reference with no earned node licenses nothing (control K10).

2. The rule that separates design from defect

A named theme returning transformed at an earned moment is the point of the whole leitmotif architecture. An exploration cue borrowing another cue's tune because it was convenient is a defect. To a similarity detector these are the same event. The separation is made in three clauses.

The third clause is what makes the rule bite on round 2 instead of waving it through. All three round-2 plans DO declare a quotation — hook.parent_quotation, parent JOURNEY_WORLD, four notes. A naive declared-means-design rule spares them. But the declaration is VERTICAL, parent to child, and what the three cues actually share is HORIZONTAL, sibling to sibling, six notes long, and declared by nobody. Three licence classes exist and they are ordered by strength: a DIRECT reference naming the partner and the node that earns it licenses the full theme; a SHARED ANCESTOR licenses exactly the smaller of the two ancestral quotations and not one note beyond; everything else licenses nothing. A shared theme_family is deliberately in the last class, because Josh's sentence names that case — same region, still needs novelty. Family membership licenses mode, instrumentation and rhythmic dialect. It licenses no notes.

3. What is measured, and by which arm

armsourcewhat it compareserror it carries
S — score-symbolicour plans, hook.head_cellthe composer's own notesnone; it is arithmetic on the written theme
C — card-symbolicthe formula cards, the_hook.intervalshook against hookthe melodic extractor's, and it cannot see a mid-track reprise
A — audio chromathe files on diskone track's motif window across another's whole chromapolyphony; it is the only arm that sees mid-track reprises

Arms S and C need no transposition search and no time-scale grid, and that is a property of the representation rather than a shortcut. An interval sequence IS the twelve-transposition search collapsed, and augmenting a theme changes its durations and none of its pitches. So a transposed augmentation is found without being searched for, and the interval is then recovered from absolute pitch and the ratio from the durations — both of which arm S has and arm C does not. worst_transposition reads None on arm C because the card carries no absolute pitch, not because nothing was found. Arm A does need the grid and inherits instr_hook_presence's twelve rotations by seven ratios unchanged.

Two guards decide what counts as a shared TUNE rather than a shared coincidence, and a real corpus forced both. A matching run must carry at least two DISTINCT interval values — melodic-line extraction over a real recording returns long runs of zeros wherever a note repeats or a pitch sustains, and two tracks that both open on a repeated note share four notes of nothing. And a run must clear BOTH the four-note absolute floor and the chance-corrected excess threshold of section 4, which is the guard that makes a six-note run between two six-note cells a different event from a six-note run between two sixteen-note hooks. The raw run is reported beside the informative one always, because a guard that silently deletes its own evidence cannot be audited.

4. The derivation: distinct tracks on one album read distinct

The negative control is every pair of distinct tracks on the same album — 55,078 pairs over 21 albums, 1118 tracks. 62 cards carry no usable hook and are excluded rather than scored. Sibling tracks on a released soundtrack are supposed to read distinct; whatever the top of this population looks like IS the threshold.

percentilesimilarityshared run (notes)excess over chance (notes)
p500.00000.00-1.683
p750.00003.00-0.732
p900.00003.000.000
p950.02824.000.317
p990.09985.001.000
p99.90.31328.002.353
max1.00001612.446

DERIVED, not chosen: similarity 0.3132 and an excess over chance of 2.353 notes — the 99.9th percentile of that distribution, the level a pair of album siblings reaches once in a thousand pairs. The target band is the 99th, similarity 0.0998.

Why the raw run length could not be the threshold, which is the correction this file would have been wrong without. A shared run of six notes is not one event. Between two sixteen-note extracted hooks there are 225 places a run can start, so six shared notes turn up by coincidence in 0.60% of sibling pairs. Between two SIX-note written cells there are 25 places and six notes is the whole tune. Calibrating a run length on the first population and applying it to the second compares two different things. So every run is priced against its own null — log(m·n)/log(1/p), the standard local-alignment expectation, with p estimated from the two motifs' own interval distributions — and the threshold is set on the EXCESS. A pair built from three intervals is held to a higher bar than a pair built from ten, automatically.

The four-note run floor is the one stated number in the file. 26.2% of sibling pairs share a three-note run and 6.3% share four. Three notes — two intervals — is a GESTURE: a rising fourth answered by a step belongs to half the tunes ever written in one mode, and a rule that called it reuse would call a quarter of the corpus reuse. Four notes is the shortest span this file will name as a tune. That is a craft judgement rather than a measurement, it is the answer to how short a shared run stops being reuse, and the sibling rates above are printed beside it so the judgement can be argued with.

The complication this pool carries, printed rather than buried. The negative control CONTAINS the positive control: Chrono Trigger's and FINAL FANTASY VI's tracks are album siblings too — 132 of the 1118 rows in this pool — and those catalogues really do reprise their themes. So the extreme tail of the sibling distribution is partly REAL deliberate recurrence rather than coincidence, and a threshold read at the very top of it sits ABOVE known reprise. That makes the instrument conservative by construction — it will miss reuse before it invents it — and it is the reason the round-2 result matters: round 2 clears a bar that was set high by real music.

The longest sibling collisions in the pool, which is where anyone auditing this should look first:

albumabsimilarityrun (notes)excess
Tales of Phantasia (Original SoundUNMATCHED__75_Recovery_Sfc_Version_UNMATCHED__77_Recovery_full_Sfc_Ver._1.00001612.45
Pokémon X & Pokémon Y_ Super MusicUNMATCHED__131_Battle_MaisonUNMATCHED__18_Level_Up_1.000051.32
Pokémon X & Pokémon Y_ Super MusicUNMATCHED__18_Level_Up_UNMATCHED__36_Gate1.000051.32
Pokémon Black & Pokémon White_ SupUNMATCHED__137_Pok_Transfer_LabUNMATCHED__21_Pok_dex_Evaluation..._You_ve1.000051.05
Okami Original Soundtrack Vol. 1 [UNMATCHED__27_-_Oddly_Shaped_TurnipUNMATCHED__30_-_Eat_This1.000040.95
Pokémon X & Pokémon Y_ Super MusicUNMATCHED__159_PR_Video_BGM__Classical_4_UNMATCHED__18_Level_Up_1.000050.76
Pokémon X & Pokémon Y_ Super MusicUNMATCHED__18_Level_Up_UNMATCHED__203_Title_Screen_Pok_mon_Red_Po1.000050.75
Pokémon X & Pokémon Y_ Super MusicUNMATCHED__162_PR_Video_BGM__Lively_3_UNMATCHED__176_Another_Chapter_in_Looker_s1.000040.75
Okami Original Soundtrack Vol. 1 [UNMATCHED__27_-_Oddly_Shaped_TurnipUNMATCHED__28_-_Susano_Skips_Training1.000040.64
Pokémon Black & Pokémon White_ SupUNMATCHED__117_Received_BP_UNMATCHED__51_Castelia_City1.000040.64

The strongest collision in all 55,078 pairs is a Tales of Phantasia cue against its own full-length version — the same piece, twice, on one disc. That the instrument's top hit over the whole corpus is a genuine duplicate is the best available evidence that it is reading melodic identity rather than noise, and it is also why the threshold read off this tail is conservative.

5. The known answer: round 2

cuepurpose classhead cell (MIDI)declared parentnotes quoted
PASS2_FLORES_CACIBATTLE[62, 66, 69, 78, 71, 69]JOURNEY_WORLD4
PASS2_FLORES_RESTEXPLORATION[62, 66, 69, 78, 71, 69]JOURNEY_WORLD4
PASS2_FLORES_WATERFALLSANCTUARY[62, 66, 69, 78, 71, 69]JOURNEY_WORLD4

Arm S, on the scores: 3 of 3 pairs flagged, maximum similarity 1.0000. Every pair shares the entire six-note cell against a four-note ancestral licence. This is a known-answer fixture and the instrument had to fail it; an instrument that passed round 2 would not be a detector.

Arm C, on the same three RENDERS: 0 of 3 pairs flagged, maximum similarity 0.2079. This is the most useful comparison in the file. The scores are provably identical; the renders are dense multi-layer mixes, and after melodic extraction the identity has been degraded to whatever this number says. Where arm C reads lower than arm S, the difference is the extractor losing a defect that is certainly present — which is the empirical case for the score-first ruling, made on a real dense render rather than argued.

Arm A agrees with arm C and not with the truth. Searching each round-2 render for the others' motif returns lifts of 0.5716, 0.4314, 0.2899 against a sibling p95 of 0.5817 — under the bar. So BOTH audio-side arms miss a defect that is provably present in the scores, on our own dense renders, where the answer is known. This is the empirical case for the score-first ruling, made on a real forty-layer render rather than argued: where a plan exists, comparing plans is not merely cheaper than comparing audio, it is the only arm that gets the answer right. Cross-track distinctness must be checked BEFORE the render, not after it.

Round 1, the opposite fixture: 1 of 496 pairs flagged, maximum similarity 0.3932, median 0.0000. Those 32 candidates were generated independently from text and nothing shared a tune by construction, so a detector that flagged them would be reading its own noise.

6. The positive control: catalogues that reprise on purpose

cataloguerowspairsmax similarityflagged
Chrono Trigger7/7210.04520
FINAL FANTASY VI4/460.14390

These catalogues are spared by arm C, and the honest reason is only partly the threshold. Arm C compares each track's HOOK to every other track's HOOK. A reprise that arrives ten minutes into a cue — which is what the FINAL FANTASY VI ending theme does with Terra's Theme — is invisible to an arm that only ever looks at openings. So the card arm's clean result is a weaker piece of evidence than it looks, and arm A exists because of it.

ARM A ANSWERS THE QUESTION ARM C COULD NOT, AND ITS ANSWER IS THE UNCOMFORTABLE ONE. Against a sibling p95 of 0.5817, 4 of the 6 FINAL FANTASY VI pairs and 0 of the 21 Chrono Trigger pairs stand above the bar. The FF VI matches land at 3.6, 9.9 and 13.5 minutes into their searched tracks — mid-cue, transposed, which is precisely the signature of a composed reprise and not of a coincidence. A pure similarity instrument would flag the leitmotif practice this program exists to build. It is the declaration, and only the declaration, that distinguishes them: FF VI's ending theme quotes Terra's Theme because a composer put it there at an earned moment, and our equivalent has to say so in the plan. Chrono Trigger sitting below the bar is the weaker half of the result and is reported as such — its cross-cue relationships are more harmonic and rhythmic than literal, and this instrument reads melody.

Arm A, Chrono Trigger, strongest cross-track matches (lift against the searched track's own harmonic background):

querysearchedliftfound attranspositionratio
EX_007 Frog's ThemeEX_162 Schala's Theme0.555681.18 s-30.5
EX_006 Chrono Trigger Main ThemeEX_162 Schala's Theme0.5396137.28 s-40.5
EX_022 Wind SceneEX_102 Magus Castle0.488724.71 s+20.6667
EX_006 Chrono Trigger Main ThemeEX_007 Frog's Theme0.46169.1 s-10.5
EX_102 Magus CastleEX_113 To Good Friends0.458673.56 s-20.75

Arm A, FINAL FANTASY VI, strongest cross-track matches (lift against the searched track's own harmonic background):

querysearchedliftfound attranspositionratio
EX_032 Terra's ThemeEX_179 Ending Theme (Balance is Rest0.8332594.99 s+20.75
EX_032 Terra's ThemeEX_161 Aria di Mezzo Carattere0.8017214.18 s+30.6667
EX_032 Terra's ThemeEX_075 Dancing Mad0.6427807.87 s+50.5
EX_075 Dancing MadEX_179 Ending Theme (Balance is Rest0.6145138.95 s+00.5
EX_161 Aria di Mezzo CarattereEX_179 Ending Theme (Balance is Rest0.5044426.88 s+30.5

Arm A sibling negative control, 30 pairs sampled inside albums outside both reprise catalogues: median lift 0.3446, p95 0.5817, p99 0.6662. The audio arm's derived threshold is its p95, 0.5817.

Arm A on round 2's own renders:

querysearchedliftfound attranspositionratio
PASS2_FLORES_CACIPASS2_FLORES_REST0.4314165.88 s+00.5
PASS2_FLORES_CACIPASS2_FLORES_WATERFALL0.289916.72 s+00.6667
PASS2_FLORES_RESTPASS2_FLORES_WATERFALL0.5716104.95 s+00.5

7. Controls

17 of 17 controls pass. Every one carries a planted answer; the three mutation arms break the instrument on purpose and each is caught by a named control, because a suite with no mutation proof has never been armed.

controlplantrequired
K1two tracks sharing a theme verbatimflagged, similarity 1.0, run 8 notes
K2the same theme transposed by +5flagged AND the interval recovered as +5
K3the same theme augmented by 2.0flagged AND the ratio recovered as 2.0
K4two different tunes, same mode, register and instrumentationmust NOT fire
K5a theme and a 4-note fragment of itreported with its run length, below the floor
K6a DECLARED reprise, partner and earned node nameddesign, not defect
K7an undeclared identical recurrence, shared theme_familyfires; family licenses nothing
K8the round-2 shape: a 4-note ancestral licence4 shared notes pass, 8 fire
K9two repeated-note openingsmust NOT fire; the raw run still reports 8
K10a reference naming a partner with no earned nodelicenses nothing; fires
K11a degenerate card and a non-dict cardavailable=False, no raise
K12an empty set and a one-track setavailable=False, no raise
K13measure() with no cohortrefuses and says distinctness is a set property
K14the real round-2 plans on diskevery pair must fire
M1force the transposition search to zeromust break K2
M2disable the declaration checkmust break K6
M3drop the run floor and the degeneracy guardmust break K4 or K9

K5, and the rule for how short a shared run stops being reuse. A fragment is fully contained in its parent, so similarity normalised on the shorter motif reads 1.0 no matter how short the fragment is. That is why a bare similarity is not actionable and why matching_run_len is returned beside it always. The run floor answers the question in notes: below 4 shared notes a run is inside the band that 55,078 pairs of released album siblings occupy, and calling it reuse would call most of the corpus reuse. Above it, an album sibling lands there once in a thousand pairs.

8. How a lane declares a reprise

One block in the plan, beside the head cell. Both fields are required — a partner with no earned node licenses nothing, because the moment that earns the return is the entire difference between a reprise and a copy.

9. What this instrument does not say

It does not score music, and no listening test stands behind any number here. It reads MELODY and nothing else: two cues could share a bassline, a chord loop, an ostinato, a drum pattern or an entire orchestration and read perfectly distinct on every arm below. Josh's sentence is about melodies and this instrument answers that sentence; the wider sameness question belongs to sameness_baseline.py and the anti-tiling work. Arm C's hook-against-hook comparison cannot see a mid-track reprise, which is a real blind spot and the reason arm A exists. And the whole design rests on lanes declaring their references honestly — the instrument catches the UNDECLARED case, which is the case that actually happened.

Generated by harness/site/structure_site.py — the URL path is the repo path. review root