A8: Synthesized sound effects and an adaptive score

Every sound is made by scripts in tools/audio/ and committed as a WAV in
assets/audio/ with a manifest of hashes and levels:

- dsp.gd: seeded noise, wavetable oscillators, filters, envelopes and
  struck modes. recipes.gd: 50 effects (footsteps on five surfaces,
  a report per weapon, impacts, carpentry building and breaking, the
  tide's bell, foghorn, surge and lighthouse, player, ambience, menus).
- score.gd: an original eight-bar tune and chords in D Dorian, 6/8,
  rendered as four looping layers (drone, frame drum, concertina,
  fiddle).
- loudness.gd and check.gd: per-category loudness targets, a -1 dBFS
  peak ceiling and the mix order (the tide loudest). make audio and
  make audio-check.

In the client, SoundDirector turns FX records, footsteps, building,
the tide and the player's own hurts into sounds, placed on 3D voices
at the event so gunfire and footsteps come from their direction.
MusicDirector fades the score's layers with the tide on an
AudioStreamSynchronized, full in menus. MenuSounds knocks for buttons.

Closes #48

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 14:28:34 -05:00
co-authored by Claude Opus 5.5
parent b3c59d66ac
commit 2545337204
149 changed files with 4143 additions and 8 deletions
+30 -1
View File
@@ -410,7 +410,7 @@ the hand, which needs a real playtest.
| `src/server/` | Headless and listening servers, joining the network to the match | `src/sim/`, `src/bots/`, `src/net/` |
| `src/client/` | World rendering, camera, input, effects | `src/sim/`, `src/net/` |
| `src/ui/` | HUD, menus, map | `src/sim/` (read only), `src/client/` |
| `src/audio/` | Sound playback, music | `src/sim/` (read only) |
| `src/audio/` | Sound playback, music (A8) | `src/sim/` and `src/net/` (read only) |
| `src/app/` | Startup and mode selection | Everything |
## Bots
@@ -541,3 +541,32 @@ client played every match, the p99 tick, and memory from one match to the next.
A client process holds back a new match's notice until it has made that client's
island, at most one a frame: a dozen clients making islands in one frame starved
their connections of service for long enough that ENet dropped them.
## Audio (A8)
Every sound is synthesized offline by `tools/audio/` and committed as a WAV in
`assets/audio/`, with `manifest.json` recording each file's hash and levels and
`assets/PROVENANCE.md` naming the generators. `make audio` regenerates them; the same
engine build gives the same bytes, and `test_audio_assets` regenerates every file and
compares hashes. `make audio-check` (and that test) holds each sound to its category's
loudness (`tools/audio/loudness.gd`) and the mix order: the tide loudest, ambience,
music and menus under the effects.
In the client:
- `SoundDirector` (a child of `ClientSession`) reads the client's world each frame and
turns what changed into sounds: FX records (shots, impacts, harvesting), footsteps by
surface for every walking player near the camera, landings and splashes, pieces built
and broken, the tide's bell, foghorn, surge and lighthouse, the own player's hurts and
the feed. Placed sounds play on `AudioStreamPlayer3D` voices at the event's position,
so the camera's listener pans and attenuates them. It never changes the world, and the
server plays no sound.
- `MusicDirector` (a child of `AppShell`) plays the score's four layers in step on an
`AudioStreamSynchronized` and fades them by intensity: full in menus and results,
the drone alone while the first tide holds, building to the whole tune for the last
land.
- `MenuSounds` hooks every menu button for a hover tick and a press knock.
Effects play on the `Effects` bus and music on `Music`; the settings' volume sliders
set those buses.
+4
View File
@@ -151,6 +151,10 @@ All synthesized by scripts in the repository.
fuller in menus and results.
- Mix: the sea is always present underneath. Loudness is calm; the tide is the
loudest thing when it rises.
- Levels (loudest 400 ms window, dBFS, `tools/audio/recipes.gd`): tide -12, weapons
-15, water -18, impacts and building -19, player -22, footsteps -24, menus -26,
ambience -27 (whole loop). The score's layers sit at -26 to -29 and play 6 dB lower
again under a match. Peaks never pass -1 dBFS. `make audio-check` enforces all of it.
## Never