# Desktop ↔ Web Comparison: comm-community__27_hydra_jam

- **Timestamp:** 2026-06-18T14:50:50.982Z
- **Capture window:** 30000 ms

## Code
```ruby
# Community example: sonic pi jam with density and spread
set_volume! 2
use_bpm 55

with_fx :reverb, room: 0.8 do

 live_loop :a1 do
 tick
 density [1,2,1,1,2,1].choose do
 p = 16
 use_synth :saw
 use_synth_defaults release: [0.1,0.2,0.3,0.4].choose, cutoff: [70,80,90,100,110].choose, pan: rdist(0.25)

 play :c3
 play :c4 + knit(0, p, -2, p, -4, p, -5, p).look

 sleep 0.25
 end
 end

 live_loop :a2 do
 tick

 use_synth :beep
 play :c2, amp: 3 if spread(1,11).look

 p = 16
 use_synth :prophet
 use_synth_defaults cutoff: line(70, 100, steps: 5).mirror.look
 play :c5 + knit(0, p, -2, p, -4, p, -5, p).look, amp: 2 if spread(1,11).rotate(5).look

 sleep 0.25
 end

 live_loop :a3 do
 tick
 density [2,2,2,1,2].look do
 sample :sn_generic, finish: rrand(0.01, 0.2), amp: 1, pan: rdist(0.5) if spread(3,5).look
 sleep 0.25
 end
 end

end

live_loop :kick do
 tick
 sample :bd_fat, amp: 4 if spread(1,2).look
 sleep 0.25
end
```

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

| Metric | Desktop SP | SonicPi.js (web) | Δ (desk − web) |
|---------------|------------------------|-------------------------|----------------|
| Duration (s) | 31.367 | 29.696 | 1.671 |
| Peak | 1.0000 | 1.0000 | 0.0000 |
| RMS | 0.4268 | 0.2575 | 0.1693 |
| Clipping (%) | 5.60 | 0.01 | 5.59 |
| 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-class histogram cos=0.938 (≥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)"_, 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-class histogram cos=0.938 (≥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: `55,84,48,60,58,48,48,48,48,48,68,56,40,55,48,55,67,60,55,48,60,48,82,48`
 - web&nbsp;&nbsp;&nbsp;: `60,84,58,58,48,56,56,68,48,55,48,48,55,67,60,60,84,60,48,82,58,70,48,56`
- **1.2 Tempo (inter-onset):** ✓ desktop 1.150s · web 1.155s/note
- **1.3 Onset count:** desktop 29 · web 25 (Δ 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 525 voice `/s_new`, web 514
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✓ MATCH
 - ✓ `saw` — 300 onsets within ε (max Δ 1ms), notes match
 - ✓ `stereo_player` — 136 onsets within ε (max Δ 1ms), notes match
 - ✓ `basic_mono_player` — 57 onsets within ε (max Δ 1ms), 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.60× (within 0.5–2× band)
- 3.2 Peak ratio web/desktop = 1.00×
- 3.3 Clipping: desktop 5.6% · web 0.01% ⚠

### 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-49-36-141Z_comm-community__27_hydra_jam.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T14-49-37-131Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T14-50-13-154Z_comm-community__27_hydra_jam_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 13.98 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 130.85 | < 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 | 65.7 Hz | dominant frequency |
| Peak freq web | 65.7 Hz | dominant frequency |
⚠ MFCC distance 130.85 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-community__27_hydra_jam
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T14-49-36-141Z_comm-community__27_hydra_jam.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T14-49-36-141Z_comm-community__27_hydra_jam.wav
 31.37s · peak 1 · RMS 0.4268 · clip 5.6%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

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