3 Commits
Author SHA1 Message Date
Storm DragonandClaude Opus 5.5 74406b9f78 Rebuild the air horn from a recording of a real handheld one.
The old horn was two reeds a major third apart, which is how car horns are
built, and it sounded like one. A canned air horn is a single reed near D5
whose second harmonic is as strong as its fundamental. For its first 100
milliseconds the reed hasn't caught: the pitch jumps about above the note, air
rushes through and it blares brighter, settling by 300 milliseconds. Then it
holds with its harmonics wavering and sags a little in pitch as the can's
pressure drops.

air_horn takes a seed; the default of 7 is the blast that was approved by ear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 03:51:59 -05:00
Storm DragonandClaude Opus 5.5 30b42f3efe Add an air horn sound, for the end of a timed match.
ui.air_horn(seconds=1.2): two brassy reeds a major third apart, each a pair of
detuned sawtooths, scooping up into pitch, blaring with a faint flutter, then a
short tail. Grave Racer's destruction derby ends with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 23:09:51 -05:00
Storm DragonandClaude Opus 5.5 f164697cf6 Generated sound effects, made from code instead of sound files
libstormgames.sfx makes sound effects with numpy and scipy, so a game can
use them without shipping sound files, and every game that asks for the
same sound with the same seed gets exactly the same samples. The sounds
come from Grave Racer and match it sample for sample.

The modules are synth (waves, filters, envelopes, loops), impacts, ui,
rewards, materials, creatures, babble, vehicles, ambience and alerts.
sfx.make_sound turns a sound into a pygame Sound for the mixer as it is
set up, turning down only a sound that would go past full scale.
sfx.add_sounds adds generated sounds by name, keeping any sound file of
the same name.

The menus' menu-move and menu-select sounds are generated when a game
has no file for them. sfx and scipy are only imported then, so a game
that ships both files, or never uses sfx, is not slowed down or made to
need scipy.

The tests check every sound against a stored fingerprint, so none can
change by accident; tools/update-sfx-fingerprints.py remakes them after
a deliberate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 15:03:48 -05:00