the more there's basic ship, the more each shot sound produced is louder, fix this #229

Closed
opened 2026-09-12 11:59:24 +00:00 by metaheavens · 1 comment
Owner
No description provided.
Author
Owner

Done in 885f977.

Every hull owns its gun and asks for its own shot sound, so eight ships firing on the same cooldown started eight voices playing the same sample in the same frame. Those amplitudes add, which is exactly the "louder the more ships there are" in the title — a full fleet was the loudest thing in the game by a wide margin.

Sfx.play() now takes a per-sound coalescing window. A volley is one event to the ear, so it gets one voice. 70ms, which the test checks is inside the fastest gun's 500ms cooldown — it collapses "six guns at once", never "six shots in a row".

PICKUP and ASTEROID_BREAK got one too: ore arrives in bursts when a rock breaks, and a burst is one pickup to the ear. Deaths and the boss scream are deliberately left alone — several things dying together really is several events.

One existing case had to move rather than be weakened: test_sfx's pool-saturation check was driven by shots, which by design can no longer saturate anything. It is driven by deaths now — what the pool actually has to absorb — and gained a case asserting a volley takes exactly one voice, measured against the real pool rather than the gate.

Verified in reverse: without the window, "8 ships firing together started 8 shot sounds".

Done in 885f977. Every hull owns its gun and asks for its own shot sound, so eight ships firing on the same cooldown started **eight voices playing the same sample in the same frame**. Those amplitudes add, which is exactly the "louder the more ships there are" in the title — a full fleet was the loudest thing in the game by a wide margin. `Sfx.play()` now takes a per-sound coalescing window. A volley is one event to the ear, so it gets one voice. 70ms, which the test checks is inside the fastest gun's 500ms cooldown — it collapses "six guns at once", never "six shots in a row". `PICKUP` and `ASTEROID_BREAK` got one too: ore arrives in bursts when a rock breaks, and a burst is one pickup to the ear. Deaths and the boss scream are deliberately left alone — several things dying together really is several events. One existing case had to move rather than be weakened: `test_sfx`'s pool-saturation check was driven by shots, which by design can no longer saturate anything. It is driven by deaths now — what the pool actually has to absorb — and gained a case asserting a volley takes exactly one voice, measured against the real pool rather than the gate. Verified in reverse: without the window, "8 ships firing together started 8 shot sounds".
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
metaheavens/spaceship#229
No description provided.