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

- **Timestamp:** 2026-06-18T15:12:49.563Z
- **Capture window:** 30000 ms

## Code
```ruby
# Source: https://in-thread.sonic-pi.net/t/blues-band-with-swinging-drums-bass-and-piano-my-first-creation/9441
# Author: adrianco
# Title: Blues band with swinging drums, bass and piano - my first creation
# Captured: 2026-04-24

use_bpm 140
swing = 0.15 # set to 0 for straight beats, 0.15 for a shuffle
key = :Eb3 # E flat is a common blues key

with_fx :reverb do

 live_loop :drums do
 sample :hat_tap, amp: 0.9
 sample :drum_bass_hard, amp: 0.9
 sleep 0.5+swing
 sample :hat_tap, amp: 0.7
 sample :drum_bass_hard, amp: 0.8
 sleep 0.5-swing
 sample :drum_snare_hard, amp: 0.8
 sample :hat_tap, amp: 0.8
 sleep 0.5+swing
 sample :hat_tap, amp: 0.7
 sleep 0.5-swing
 end

 blues_scale = (ring key, key, key+12, key+12, key+10, key+10, key+5, key+3)
 durs = (ring 0.5,0.5, 0.5,0.5, 0.5,0.5, 0.5,0.5)
 twelvebar = (ring 0, 0, 0, 0, 5, 5, 0, 0, 7, 5, 0, 7)

 live_loop :bass do
 use_synth :fm
 use_transpose twelvebar.tick(:bar)
 4.times do
 use_synth_defaults release: 0.5+swing, amp: 1.0, pan: 0.3
 play blues_scale.tick(:note)
 sleep durs.look(:note)+swing
 use_synth_defaults release: 0.5-swing, amp: 0.8, pan: 0.3
 play blues_scale.tick(:note)
 sleep durs.look(:note)-swing
 end
 end

 live_loop :chords do
 use_synth :piano
 use_synth_defaults pan: -0.30, amp: 1.0, stereo_width: 0.3
 play_chord chord(key+24+twelvebar.tick(:chords), :minor), decay: 2, release: 2
 sleep 4
 end

 live_loop :solo do
 use_synth :piano
 use_synth_defaults pan: -0.30, amp: 1.0, stereo_width: 0.3
 sleep 2
 pattern1 = shuffle(scale(key+12*dice(2)+twelvebar.look(:chords), :minor_pentatonic))
 pattern2 = shuffle(scale(key+24+twelvebar.look(:chords), :minor_pentatonic))
 play_pattern_timed pattern1, 0.25
 play_pattern_timed pattern2, 0.5
 play_pattern_timed pattern2, 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.3791 | 0.6209 |
| RMS | 0.2733 | 0.0578 | 0.2155 |
| Clipping (%) | 0.36 | 0.00 | 0.36 |
| 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 0 (desktop 51 vs web 75)"_, 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 0 (desktop 51 vs web 75)
 - method: desktop `onset` (conf 1) · web `onset` (conf 1)
 - desktop: `51,66,75,61,61,75,78,66,75,61,51,78,70,68,78,73,78,61,75,70,66,75,73`
 - web&nbsp;&nbsp;&nbsp;: `75,75,75,87,75,75,80,56,78,85,82,78,75,56,80,87,73,75,82,78,85,68,87,56`
- **1.2 Tempo (inter-onset):** ✗ desktop 1.355s · web 1.195s/note
- **1.3 Onset count:** desktop 23 · 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 624 voice `/s_new`, web 611
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✓ MATCH
 - ✓ `basic_mono_player` — 252 onsets within ε (max Δ 1ms), notes match
 - ✓ `piano` — 215 onsets within ε (max Δ 1ms), notes match
 - ✓ `fm` — 144 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.21× (outside band — tracked separately, not a Tier-1 fail)
- 3.2 Peak ratio web/desktop = 0.38×
- 3.3 Clipping: desktop 0.36% · 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-18T15-11-33-909Z_comm-in-thread-forum__44_blues_band.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T15-11-35-108Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T15-12-11-315Z_comm-in-thread-forum__44_blues_band_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 16.31 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 206.94 | < 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 | 43.2 Hz | dominant frequency |
| Peak freq web | 43.2 Hz | dominant frequency |
⚠ MFCC distance 206.94 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__44_blues_band
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T15-11-33-909Z_comm-in-thread-forum__44_blues_band.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T15-11-33-909Z_comm-in-thread-forum__44_blues_band.wav
 31.37s · peak 1 · RMS 0.2733 · clip 0.36%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

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