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

- **Timestamp:** 2026-06-18T15:08:54.035Z
- **Capture window:** 30000 ms

## Code
```ruby
# Source: https://in-thread.sonic-pi.net/t/ocean-ambience-danks-first-submission/9580
# Author: dank
# Title: Ocean Ambience - Dank's First Submission
# Captured: 2026-04-24

use_debug false
use_bpm 70

# Ambient background
live_loop :ocean_ambience do
 sample :ambi_lunar_land, rate: 0.5, amp: 0.4
 sleep 16
end

# Bubbling sounds
live_loop :bubbles, delay: 4 do
 use_synth :beep
 use_synth_defaults attack: 0.01, release: 0.2, amp: 0.2

 with_fx :reverb, room: 0.8, mix: 0.6 do
 with_fx :echo, mix: 0.3, phase: 0.5 do
 note = scale(:e3, :minor_pentatonic).choose
 pan_value = rrand(-0.8, 0.8)
 sleep_time = [0.25, 0.5, 0.75].choose

 play note, pan: pan_value
 sleep sleep_time
 end
 end
end

# Pulsating rhythm
live_loop :jellyfish_pulse do
 use_synth :dtri

 with_fx :slicer, phase: 0.5, wave: 1, mix: 0.3 do
 with_fx :reverb, room: 0.9, mix: 0.5 do
 chords = [
 chord(:e3, :m9),
 chord(:c3, :maj9),
 chord(:a2, :m9),
 chord(:d3, :maj9)
 ]
 play_chord chords.tick, attack: 0.1, release: 4, amp: 0.5
 sleep 4
 end
 end
end

# Flowing tendrils
live_loop :tendrils, delay: 8 do
 use_synth :blade
 use_synth_defaults attack: 2, release: 6, amp: 0.3

 notes = (scale :e4, :minor_pentatonic, num_octaves: 2)
 current_note = notes.choose
 pan_value = rrand(-0.5, 0.5)
 sleep_duration = [4, 6, 8].choose

 with_fx :hpf, cutoff: 60 do
 with_fx :reverb, room: 0.9, mix: 0.7 do
 play current_note, pan: pan_value
 sleep sleep_duration
 end
 end
end

# Gentle bass current
live_loop :deep_current, delay: 16 do
 use_synth :fm
 use_synth_defaults attack: 0.5, release: 7, amp: 0.6

 bass_notes = [:e2, :c2, :a1, :d2]

 with_fx :lpf, cutoff: 80 do
 play bass_notes.tick, release: 7
 sleep 8
 end
end

# Occasional shimmer
live_loop :shimmer, delay: 24 do
 use_synth :pretty_bell

 with_fx :reverb, room: 0.9, mix: 0.8 do
 with_fx :gverb, mix: 0.6 do
 sleep 16
 play_pattern_timed scale(:e5, :minor_pentatonic, num_octaves: 1),
 [0.25, 0.5, 0.25], amp: 0.2, pan: rrand(-0.7, 0.7)
 sleep 16
 end
 end
end

# Water droplets
live_loop :droplets, delay: 32 do
 sample :drum_cymbal_soft, rate: 1.5, amp: 0.1 if one_in(4)
 sample :elec_blip, rate: 1.2, amp: 0.1 if one_in(3)
 sample :elec_blip2, rate: 1.5, amp: 0.1 if one_in(5)
 sleep 0.5
end
```

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

| Metric | Desktop SP | SonicPi.js (web) | Δ (desk − web) |
|---------------|------------------------|-------------------------|----------------|
| Duration (s) | 31.371 | 29.696 | 1.675 |
| Peak | 0.2610 | 0.1580 | 0.1030 |
| RMS | 0.0428 | 0.0258 | 0.0170 |
| Clipping (%) | 0.00 | 0.00 | 0.00 |
| 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 52 vs web 59)"_, 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 52 vs web 59)
 - method: desktop `onset` (conf 1) · web `onset` (conf 1)
 - desktop: `59,62,62,52,52,59,45,57,54,55,59,55,55,57,55,64,52,62`
 - web&nbsp;&nbsp;&nbsp;: `59,62,62,59,62,55,59,57,57,55,59,57,55,52,52`
- **1.2 Tempo (inter-onset):** ✗ desktop 0.710s · web 0.920s/note
- **1.3 Onset count:** desktop 18 · web 15 (Δ 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 136 voice `/s_new`, web 127
- **Onset sequence (ε=15ms, prefix-compared, + per-tick NOTE multiset):** ✓ MATCH
 - ✓ `beep` — 65 onsets within ε (max Δ 1ms), notes match
 - ✓ `dtri` — 45 onsets within ε (max Δ 1ms), notes match
 - ✓ `basic_mono_player` — 6 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.60× (within 0.5–2× band)
- 3.2 Peak ratio web/desktop = 0.61×
- 3.3 Clipping: desktop 0% · 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-07-38-932Z_comm-in-thread-forum__41_ocean_ambience.wav
- **Web:** /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/2026-06-18T15-07-40-242Z_inline_audio.wav

## Spectrogram comparison
![spectrogram comparison](/Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/compare_2026-06-18T15-08-16-171Z_comm-in-thread-forum__41_ocean_ambience_spectrogram.png)

| Metric | Value | Reading |
|---|---|---|
| L2 distance (mel-dB) | 12.49 | < 10 = very close · 10–25 = similar shape · > 25 = divergent |
| MFCC distance (timbre) | 115.11 | < 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 | 82.4 Hz | dominant frequency |
| Peak freq web | 82.5 Hz | dominant frequency |
⚠ MFCC distance 115.11 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__41_ocean_ambience
✓ Report: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop_2026-06-18T15-07-38-932Z_comm-in-thread-forum__41_ocean_ambience.md
✓ WAV: /Users/mrityunjaybhardwaj/Documents/projects/sonicPiWeb/.captures/desktop-recordings/desktop_2026-06-18T15-07-38-932Z_comm-in-thread-forum__41_ocean_ambience.wav
 31.37s · peak 0.261 · RMS 0.0428 · clip 0%
```
### Web
```
Launching Chromium (headed, audio capture)...
 Running: inline (30000ms)...

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