"Shot sounds sound like a toy" and "death sounds from ship are really
cheap", and there was no arguing with either. The shot was a bare
descending sine, which is the sound every toy ray gun has ever made. The
death was one band of filtered noise with a sine under it - thin, and over
before the eye had finished with the explosion.
The synthesis is rewritten rather than tuned, because the shape was the
problem:
LAYERS, not a waveform. A bang is a crack, then a body, then a tail, and
they have different lengths. One envelope over one source cannot be any
of those things, so the explosions now run three clocks - the crack is
done in a fifth of the length, the roar runs most of it, and sparse
debris keeps falling afterwards so there is an aftermath rather than a
stop.
A SUB. Below about 80Hz is where "big" lives; without it an explosion is
a hiss however loud you play it. Measured: 74% of a ship death's energy
and 86% of a structure's now sits under 200Hz, against almost none
before.
SATURATION. Soft-clipping folds in harmonics, so a sound reads as loud
rather than merely being loud - and stops peak normalisation flattening
everything into the same quiet mush.
DETUNED PARTIALS on the shot. Three of them at deliberately wrong ratios
beat against each other and read as a mechanism; the single sine was the
whole of the toy problem. A noise transient and a sub thump under it give
it something to hit with.
Lengths went up with the weight: the ship death from 0.85s to 1.45s and the
structure from 1.6s to 2.3s, both audible to the end rather than gone in the
first third.
Three events get a sound: a shot leaving a gun, a vessel dying, a structure
coming down.
The sounds are SYNTHESISED rather than downloaded - audio/make_sfx.py
generates all three from scratch, and is committed alongside them. The
ticket asked for free sources and the good ones are in its comments
(Kenney's CC0 packs, OpenGameArt's CC0 sets, Freesound filtered to CC0),
but a generated sound has no licence to track, no attribution to keep, and
no binary in the repository whose provenance nobody can check a year from
now. It also makes the sounds DATA: too sharp a shot is a number in that
file and a re-run, not a hunt through a library. Dropping in a pack file
later means replacing a .wav and nothing else.
A voice POOL, not a player, because these overlap constantly - a fleet
firing is several shots inside one shot's length. Twelve voices, and when
they are all busy the one furthest through its own sound is recycled, which
is the one with the least left to lose.
Parented to the tree root, for the reason that matters: every one of these
sounds is started by something that is being freed on the same frame. A
dying ship cannot own the sound of its own death.
Levels are per sound rather than shared - a shot fires constantly and a
death happens once, so equal volumes are not proportionate ones - and shots
get a little pitch spread so a stream of them does not flatten into one
machine-gun note. The deaths get none: a wobbling explosion sounds broken
rather than varied.
The test goes at the failures a play-through would hide for weeks: firing
three times the pool size must leave exactly the pool's worth sounding and
no leaked voices, and the ship-death case is checked from a node that really
has been freed on that frame.