# Desktop ↔ Web Comparison: comm-in-thread-forum__34_kx5_escape_cover

- **Timestamp:** 2026-06-18T14:59:33.253Z
- **Capture window:** 30000 ms

## Code
```ruby
# Source: https://in-thread.sonic-pi.net/t/quick-cover-of-kx5-escape-feat-hayla-official-lyric-video/9861
# Author: Relaxnow
# Title: Quick cover of "Kx5 - Escape (feat. Hayla) [Official Lyric Video]"
# Captured: 2026-04-24

set_volume! 2
use_bpm 126-10
with_fx :reverb, room: 0.5 do

 live_loop :a1 do
 tick
 sample :bd_fat, amp: 1.5 if spread(1,4).look
 sample :perc_snap, finish: 0.09, amp: 0.5 if bools(0,0,0,0,1,0,0,0).look
 sample :hat_cab, rpitch: 12+12+12, amp: 0.75 if bools(0,0,1,0,0,0,1,0).look

 cho = 1
 a = 4
 cho = knit(1,5*a, 2,2*a, 3,4*a, 4,2*a, 5,2*a, 6,7*a).look
 case cho
 when 1
 c = [:f3,:a3,:c4]
 when 2
 c = [:d3,:g3,:b3]
 when 3
 c = [:e3,:a3,:c4]
 when 4
 c = [:d3,:f3,:a3]
 when 5
 c = [:e3,:g3,:b3]
 when 6
 c = [:f3,:a3,:c4]
 end

 mysynth = 2
 case mysynth
 when 1
 use_synth :piano
 use_synth_defaults release: 4, sustain: 2
 play c if spread(cho,32).look
 when 2
 use_synth :saw
 use_synth_defaults release: line(0.5,1.2, steps: 16+12).mirror.look, cutoff: line(40,120,steps: 64).mirror.look
 play c, pan: rdist(0.25) if spread(11,32).look

 use_synth :square
 use_synth_defaults release: line(0.5,0.7, steps: 16+12).mirror.look, cutoff: line(40,120,steps: 64+16).mirror.look
 k = 32
 play c.look+12, amp: 0.5, pan: rdist(0.5) if spread(22,32).look and one_in(knit(0,k, 4,k, 1,k*3).look)

 use_synth :square
 use_synth_defaults release: line(0.7,0.9,steps: 12).look, cutoff: line(60,90,steps: 128).look
 play c.take(1).look-12+0.01, pan: 0.25, amp: 0.7 if spread(11,32).look
 use_synth :saw
 play c.take(1).look-12-12-0.01, pan: -0.25 if spread(11,32).look
 end

 sleep 0.25
 end
end
```

## Stats (Level 3 — observation, not inference)

| Metric | Desktop SP | SonicPi.js (web) | Δ (desk − web) |
|---------------|------------------------|-------------------------|----------------|
| Duration (s) | 31.371 | 29.696 | 1.675 |
| Peak | 1.0000 | 0.8989 | 0.1011 |
| RMS | 0.2561 | 0.1738 | 0.0823 |
| Clipping (%) | 0.68 | 0.00 | 0.68 |
| Sample rate (Hz) | 48000 | 48000 | 0 |
| Channels | 2 | 2 | — |

## Verdict
### ❌ EVENT-DIVERGE — per-synthdef `/s_new` onset-sequence/notes diverge from desktop : square: onset #1 desktop 0.388s vs web 0s (Δ 388ms > 15ms ε) — mis-timed layer. Real engine divergence (the audio verdict stands; the cos heuristic does not apply).

### Tier 0 — Validity gates
- ✓ 0.1 Sample rate consistent (48000 Hz)
- ⚠ 0.2 Capture-window misaligned (Δ 1.67s > 0.5s) — note-count / level aggregates unreliable **(SOFT — Tier 3 + 1.3 unreliable; Tier 1 pitch still valid)**
- ◦ 0.3 equal preconditions / 0.4 lossless capture / 0.5 routing sanity — not auto-checked; ensure SP.app reset + raw-float32 + FX-bus wired 

### Tier 1 — Musical correctness (THE verdict — energy/MFCC may never override)
- **1.1 Note progression:** ≈ pitch-class histogram cos=0.970 (≥0.92), tempo match, density ratio 0.86 (≥0.5), PRNG token in source; same composition, different random walk (cross-engine seed parity is not a v1 goal — #358/#364/#367)
 - method: desktop `onset` (conf 1) · web `onset` (conf 1)
 - desktop: `41,41,41,41,59,40,57,40,41,41,41,62,40,41,41,41,41,41,40,57,40`
 - web&nbsp;&nbsp;&nbsp;: `41,41,41,41,40,62,40,41,41,41,67,40,69,41,41,41,40,40`
- **1.2 Tempo (inter-onset):** ✓ desktop 1.090s · web 1.150s/note
- **1.3 Onset count:** desktop 21 · web 18 (Δ explained by Tier-0 window misalignment)
- ◦ 1.4 note duration / 1.5 polyphony / 1.6 determinism — not auto-tracked here (unit tests cover determinism; see /)

### Tier 1.0 — Event parity (`/s_new` onset-sequence vs desktop — authoritative tiebreaker)
- **Structure (synthdef multiset):** STRUCTURE-MATCH — desktop 659 voice `/s_new`, web 675
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✗ DIVERGE
 - ✓ `saw` — 328 onsets within ε (max Δ 1ms), notes match
 - ✗ `square` — mis-timed @onset #1 (max Δ 5172ms)
 - ✓ `basic_mono_player` — 119 onsets within ε (max Δ 1ms), notes match
- ❌ **NOT event-match:** layers match but the onset sequence (timing or per-tick notes) diverges — a REAL engine bug (the audio DIVERGE stands).

### Tier 3 — Level / gain (reported; NOT a musical-correctness blocker — known ~0.5× web gain-staging)
> ⚠ Tier-0 SOFT failed — these ratios span misaligned windows; treat as indicative only.
- 3.1 RMS ratio web/desktop = 0.68× (within 0.5–2× band)
- 3.2 Peak ratio web/desktop = 0.90×
- 3.3 Clipping: desktop 0.68% · web 0% ✓ (< 1%)

### Tier 2 — Spectral / timbral (supporting only) · Tier 4 — FX/routing · Tier 5 — lifecycle
- Tier 2: see **Spectrogram comparison** section below (MFCC carries its mandatory caveat there).
- Tier 4 (FX accumulation/suppression 200ms scan, per-FX-scope energy): **not analysed** by this tool — use the FX-sweep / boundary-scan tools when FX is in scope.
- Tier 5 (Run/Stop/hot-swap, cold-start, long-run drift): **not analysed** — single capture; use `tools/test-run-stop-cycle.ts` for lifecycle.

## Source WAVs
- **Desktop:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T14-58-18-078Z_comm-in-thread-forum__34_kx5_escape_cover.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T14-58-19-371Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T14-58-55-464Z_comm-in-thread-forum__34_kx5_escape_cover_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 11.51 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 102.66 | < 30 = similar · 30–80 = noticeably different · > 80 = unrelated |
| ↳ MFCC caveat | — | **Tier-2 supporting only.** Confounded by the known ~0.5× web gain ratio + desktop reverb-tail length; **never overrides Tier 1** . A high MFCC with a Tier-1 PITCH-MATCH means timbre/gain, not wrong notes. |
| Frames compared | 2785 | overlapping window after length-aligning |
| Peak freq desktop | 87.7 Hz | dominant frequency |
| Peak freq web | 87.7 Hz | dominant frequency |
⚠ MFCC distance 102.66 is high — **check Tier 1 first**: if pitch-track matched, this is timbre/gain (the known 0.5× + reverb tail), NOT wrong notes. Only treat as "different synth/sample chain" when Tier 1 also diverges.

## Tool stdout (debug)
### Desktop
```
▶ Desktop capture (30000ms): comm-in-thread-forum__34_kx5_escape_cover
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T14-58-18-078Z_comm-in-thread-forum__34_kx5_escape_cover.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T14-58-18-078Z_comm-in-thread-forum__34_kx5_escape_cover.wav
 31.37s · peak 1 · RMS 0.2561 · clip 0.68%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

Capture saved: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/inline.md
No errors detected.
```