Skip to content

[3/3] feat: synthesize the effects and loops with Web Audio - #121

Merged
arudaev merged 2 commits into
mainfrom
feature/71-sound
Oct 23, 2026
Merged

arudaev merged 2 commits into
mainfrom
feature/71-sound

Conversation

@arudaev

@arudaev arudaev commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What and why

Every sound in the slice, synthesized at runtime with Web Audio – no audio files, so decision 14 (no audio in Git) holds and nothing needs a licence. Alexander's call on #71.

  • Effects (fx/sound/recipes.ts): footsteps (girder, grass), chair whoosh + hit, rover motor, crab servos, drone hum, Jenny engine + crash, fluid absorb, the crash-dialog ding, player hurt, enemy defeated. Each is a few voices – oscillator or filtered noise, pitch glide, envelope – as plain data.
  • Loops (fx/sound/loops.ts): Hidden Garden (wind, pad, birds), Rusty Creek (water, steel hum, girder ticks), Jenny (140 bpm kick, hats, saw bass). Bars are scheduled 0.5 s ahead of the audio clock, so a slow frame never gaps them. The anomaly state plays the region loop 6 % flat.
  • Audio scene (fx/sound/Audio.ts, registered first in LANE_A_SCENES): listens to player-hit, enemy-defeated, boss-defeated and region-turned. Everything else is called from game code: sound.play('chair-whoosh'), sound.loop('boss-jenny') (lane B: footsteps, swings, motors; [M4-S1] Jenny rams you on the bridge and the creek turns #54: the boss loop). M mutes. In dev builds F7 steps through the effects and F6 through the loops (name in the console).
  • Wired now: Start on the title begins the garden loop; the THD.exe dialog plays the ding.
  • docs/07 and [M5-S3] Sound: effects and one loop per region #71's criteria now say "synthesized" instead of "CC0, in NOTICE.md".

Verification

  • npm run typecheck, npm test (28 passing, 6 new: every docs/07 effect has a recipe, nothing over 0.9 peak gain, loops stay inside their bars, anomaly detune), npm run build, check_docs.py.
  • Rendered every recipe and loop bar offline in the browser: all audible, loudest peak 0.33 after the master gain – no clipping.
  • Dev server: after Start the context is running and the garden loop schedules bars; region-turned switches it to the creek; no console errors.
  • Not done: listening with headphones (the issue's check) – I can't hear it. Please give it a minute on the preview.

Issue

Closes #71 (stacked PR – linked by hand under Development).

Stack

Merge bottom up.

Decision 14 keeps audio out of Git, so every sound is a recipe of oscillators and filtered noise played at runtime: the docs/07 effects, one ambient loop per slice region and Jenny's loop. Hits, defeats, the boss and region turns are wired to the game events; game code calls sound.play() for the rest.
@arudaev arudaev self-assigned this Oct 23, 2026
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wincs Ready Ready Preview Oct 23, 2026 9:43pm UTC

Request Review

@github-actions github-actions Bot added area:story Prologue, Dexter, crossings, ending area:ui HUD, crash window, title, menus area:docs Design docs, README, contributor guides labels Oct 23, 2026
@arudaev arudaev linked an issue Oct 23, 2026 that may be closed by this pull request
3 tasks
@arudaev
arudaev marked this pull request as ready for review October 23, 2026 21:38
F7 plays the effects one by one and F6 cycles the loops in dev builds, so the sound can be checked with headphones before merging.
@arudaev
arudaev changed the base branch from feature/36-atmosphere to main October 23, 2026 21:45
@arudaev
arudaev merged commit 28ba3b6 into main Oct 23, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Design docs, README, contributor guides area:story Prologue, Dexter, crossings, ending area:ui HUD, crash window, title, menus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M5-S3] Sound: effects and one loop per region

1 participant