[bug/xs] BGM inaudible on live — music-bus gain ~18× too low #33

Closed
opened 2026-06-21 14:06:22 +02:00 by shipwright · 0 comments
Owner

Operator reported no background music on the live solo playtest (post-deploy @2170e10, hard-refresh confirmed not-cache) after #15 (PR #30) landed.

Investigation (empirical, against live)

  • Autoplay ruled out: ran the BGM under strict autoplay (--autoplay-policy=document-user-activation-required) → AudioContext is running, 46 voices created, 0 resume() needed, no console warnings. The music engine is generating voices into a live context.
  • Root cause = output level: spliced an AnalyserNode before ctx.destination and measured peak amplitude:
    • music peak: 0.0098 (~-40 dB — effectively inaudible)
    • SFX peak: 0.081 (~-22 dB — audible)
    • ratio: 0.12

The music bus gain MUSIC_GAIN = 0.035 (in client/src/audio.ts, pre-existing — unchanged by #30) puts the BGM ~18× below the SFX. The old single-loop engine had the same level and was likely never validated audibly; #15's explicit playtest surfaced it.

Fix

Raise MUSIC_GAIN so BGM sits audibly under the SFX — target music peak ~0.03–0.04 (≈0.4× SFX) → MUSIC_GAIN ≈ 0.12 (data-only, one constant). Verify with the amplitude probe; operator playtest to taste (knob is trivially tunable).

Size: XS. Lane: Shipwright. Follow-up to #15 / PR #30.

Operator reported no background music on the live solo playtest (post-deploy @2170e10, hard-refresh confirmed not-cache) after #15 (PR #30) landed. ## Investigation (empirical, against live) - **Autoplay ruled out**: ran the BGM under strict autoplay (`--autoplay-policy=document-user-activation-required`) → AudioContext is `running`, 46 voices created, 0 `resume()` needed, no console warnings. The music engine *is* generating voices into a live context. - **Root cause = output level**: spliced an AnalyserNode before `ctx.destination` and measured peak amplitude: - music peak: **0.0098** (~-40 dB — effectively inaudible) - SFX peak: **0.081** (~-22 dB — audible) - ratio: **0.12** The music bus gain `MUSIC_GAIN = 0.035` (in `client/src/audio.ts`, **pre-existing** — unchanged by #30) puts the BGM ~18× below the SFX. The old single-loop engine had the same level and was likely never validated audibly; #15's explicit playtest surfaced it. ## Fix Raise `MUSIC_GAIN` so BGM sits audibly *under* the SFX — target music peak ~0.03–0.04 (≈0.4× SFX) → `MUSIC_GAIN ≈ 0.12` (data-only, one constant). Verify with the amplitude probe; operator playtest to taste (knob is trivially tunable). Size: XS. Lane: Shipwright. Follow-up to #15 / PR #30.
bosun closed this issue 2026-06-21 14:11:15 +02:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frankenbit/cellblock#33
No description provided.