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

- **Timestamp:** 2026-06-18T14:55:37.271Z
- **Capture window:** 30000 ms

## Code
```ruby
# Source: https://in-thread.sonic-pi.net/t/bass-and-noise-jam-in-sonic-pi/9878
# Author: Relaxnow
# Title: Bass and noise jam in Sonic Pi
# Captured: 2026-04-24

set_volume! 2

with_fx :distortion do |d|
 with_fx :krush do |kr|
 with_fx :reverb do |r|

 live_loop :a1 do
 tick
 kn = 32
 control kr, res: [0,0,0,0,0.2,0.4,0.8].choose, pre_mix: [0,0,0,0.2,0.4,0.8].choose, mix: knit(0.2,kn, 0.6,kn).look
 control d, distort: [0,0.2,0.4,0.8].choose, pre_mix: [0.2,0.4,0.8].choose
 control r, room: [0,0.2,0.4,0.8].choose, pre_mix: [0.2,0.4,0.8].choose

 ki = 16
 kick = knit(0,ki*3, 1,ki, 2,ki*4).look
 case kick
 when 0
 when 1
 sample :bd_fat, amp: 2 if (spread(1,12)*1+spread(3,4).rotate(1)).look
 when 2
 sample :bd_fat, amp: 2 if spread(11,32).look
 end

 k = 16
 n = :c2+knit(0,k*2,-2,k*2).look
 n1 = n+12

 hi = 16
 highnotes = 0
 highnotes = knit(0,hi*3, 1,hi*4,2, hi*4).look
 case highnotes
 when 0
 when 1
 n2 = :c5
 when 2
 nn = 4
 n2 = :c5+knit(0,nn*6, 7,nn*2, 5,nn, -2,nn).look
 end

 use_synth :sine
 use_synth_defaults release: [0.1,0.2,0.4].choose+0.4
 play n if spread(1,16).look

 use_synth_defaults release: [0.1,0.2,0.4].choose
 play n1+line(0,0.4,steps: 8).choose, pan: rdist(0.6) if spread(7,16).look

 use_synth_defaults release: [0.1,0.2,0.4].choose
 play n2+line(0,0.3,steps: 8).choose, pan: rdist(0.6), amp: 0.25 if spread(11,16).look

 use_synth :bnoise
 use_synth_defaults release: [0.1,0.2,0.4].choose, cutoff: rrand_i(50,90)
 play n+line(0,0.2,steps: 8).choose, pan: rdist(0.4), amp: 0.4 if spread(11,16).look

 sleep 0.25
 end

 end
 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 | 1.0000 | 0.0000 |
| RMS | 0.3150 | 0.2138 | 0.1012 |
| Clipping (%) | 1.68 | 0.01 | 1.67 |
| 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 3 (desktop 40 vs web 48)"_, 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 3 (desktop 40 vs web 48)
 - method: desktop `onset` (conf 1) · web `onset` (conf 1)
 - desktop: `55,48,48,40,48,48,48,40,48,41,48,43,48,44,43,48,43,48,48,48,46,47,47,55`
 - web&nbsp;&nbsp;&nbsp;: `55,48,48,48,43,48,48,48,47,49,46,48,43,49,40,50,48,44,48,48,46,46,46,41`
- **1.2 Tempo (inter-onset):** ✗ desktop 0.320s · web 0.415s/note
- **1.3 Onset count:** desktop 66 · web 65 (Δ 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 227 voice `/s_new`, web 221
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✓ MATCH
 - ✓ `beep` — 113 onsets within ε (max Δ 1ms), notes match
 - ✓ `bnoise` — 84 onsets within ε (max Δ 1ms), notes match
 - ✓ `basic_mono_player` — 24 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.68× (within 0.5–2× band)
- 3.2 Peak ratio web/desktop = 1.00×
- 3.3 Clipping: desktop 1.68% · 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-54-22-384Z_comm-in-thread-forum__31_bass_noise_jam.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T14-54-23-644Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T14-54-59-562Z_comm-in-thread-forum__31_bass_noise_jam_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 16.04 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 155.47 | < 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 | 132.0 Hz | dominant frequency |
| Peak freq web | 132.0 Hz | dominant frequency |
⚠ MFCC distance 155.47 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__31_bass_noise_jam
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T14-54-22-384Z_comm-in-thread-forum__31_bass_noise_jam.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T14-54-22-384Z_comm-in-thread-forum__31_bass_noise_jam.wav
 31.37s · peak 1 · RMS 0.315 · clip 1.68%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

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