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

- **Timestamp:** 2026-06-18T15:00:51.286Z
- **Capture window:** 30000 ms

## Code
```ruby
# Source: https://in-thread.sonic-pi.net/t/250514-evolving-arp-sketch-yt/9690
# Author: Relaxnow
# Title: 250514 Evolving arp sketch YT
# Captured: 2026-04-24

set_volume! 2

with_fx :reverb, room: 0.9 do

 live_loop :a1 do
 tick

 # kick
 sample :bd_fat, amp: 2 if spread(1,4).look

 # bass
 use_synth :saw
 use_synth_defaults cutoff: 80+line(-10,50,steps: 64).mirror.look, release: 0.1+line(-0.05,0.1,steps: 32).mirror.look
 j = 32
 play :c3+knit(0,j*2, -2,j, -5,j, -4,j).look if spread(5,7).rotate(rrand_i(0,5)).look

 # arp
 use_synth knit(:saw, 128, :square, 128, :pluck, 128, :dtri,128).look

 i = 32
 r = 16
 play :c5+[0,knit(3,i,2,i,5,i,3,i).look,7].look, pan: rdist(knit(0,r, 0.25,r, 0.5,r,0.75,r, 1,r).mirror.look) if spread(3,5).rotate(rrand_i(0,0)).look

 sleep 0.125

 end

 live_loop :a2 do
 tick
 use_synth_defaults cutoff: 80+line(-10,50,steps: 64).mirror.look, release: 0.1+line(-0.05,0.1,steps: 32).mirror.look
 n = :c6

 s = 0.125
 q = s*4

 pat = 0
 p = 4
 pat = knit(1,p,2,p,3,p,4,p).look
 pat = knit(0,p*4, 1,p,2,p,3,p,4,p).look

 case pat
 when 0
 when 1
 notes = [n, n, n+2]
 play notes.look
 when 2
 notes = [n, n, n+3]
 play notes.look
 when 3
 notes = [n, n, n+7]
 play notes.look
 when 4
 notes = [n, n, n+5]
 play notes.look
 end
 sleep [q*4-s*2,s*4,q*8-s*2].look
 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.9475 | 0.0525 |
| RMS | 0.2000 | 0.1418 | 0.0582 |
| Clipping (%) | 0.04 | 0.00 | 0.04 |
| Sample rate (Hz) | 48000 | 48000 | 0 |
| Channels | 2 | 2 | — |

## Verdict
### ✅ EVENT-MATCH — per-synthdef `/s_new` onset-sequence + note parity STRUCTURE-MATCHES desktop : the engine emitted the right notes at the right times. The audio Tier-1 said _"PITCH DIVERGENCE at note 1 (desktop 47 vs web 79)"_, but that measures stage-7+ scsynth DSP (WASM-vs-native rendering / pitch-tracker noise), not the engine. Authoritative cross-engine check passes. · ⚠ Tier-0 SOFT: level/count aggregates unreliable (Tier 1 pitch unaffected)

### 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 DIVERGENCE at note 1 (desktop 47 vs web 79)
 - method: desktop `onset` (conf 1) · web `onset` (conf 1)
 - desktop: `41,47,47,48,75,48,75,48,72,79,72,48,48,75,75,72,72,79,48,79,48,74,72,74`
 - web&nbsp;&nbsp;&nbsp;: `41,79,48,75,75,48,75,48,72,79,72,48,48,75,75,72,72,72,79,48,79,48,74,72`
- **1.2 Tempo (inter-onset):** ✗ desktop 0.130s · web 0.180s/note
- **1.3 Onset count:** desktop 104 · web 104 (Δ 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 397 voice `/s_new`, web 390
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✓ MATCH
 - ✓ `saw` — 257 onsets within ε (max Δ 0ms), notes match
 - ✓ `square` — 71 onsets within ε (max Δ 0ms), notes match
 - ✓ `basic_mono_player` — 62 onsets within ε (max Δ 0ms), notes match
- ✅ **EVENT-MATCH:** structure + onset sequences both match — the engine's deterministic output (stages 1-6, terminating at the OSC emission) is correct. The audio Tier-1 divergence is stage-7+ scsynth rendering or tracker noise, not an engine bug (; #453/#379/#378 class).

### 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.71× (within 0.5–2× band)
- 3.2 Peak ratio web/desktop = 0.95×
- 3.3 Clipping: desktop 0.04% · 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-59-36-421Z_comm-in-thread-forum__35_evolving_arp.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T14-59-37-667Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T15-00-13-685Z_comm-in-thread-forum__35_evolving_arp_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 11.46 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 96.70 | < 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 | 62.0 Hz | dominant frequency |
| Peak freq web | 60.0 Hz | dominant frequency |
⚠ MFCC distance 96.70 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__35_evolving_arp
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T14-59-36-421Z_comm-in-thread-forum__35_evolving_arp.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T14-59-36-421Z_comm-in-thread-forum__35_evolving_arp.wav
 31.37s · peak 1 · RMS 0.2 · clip 0.04%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

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