7 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 962f695226 Generated footsteps on grass, leaves, gravel, snow, wood and concrete
movement.footstep(surface, seed) makes one footstep, and each seed gives a
slightly different step, so a game can register several and play them at
random. Every surface except grass is the heel landing and then the toe:

- leaves: bright crisp crackles that spread out, over a soft rustle.
- gravel: dozens of small stones knocking under the heel and toe, over a
  low grind.
- snow: a muffled crunch that gets denser as the foot packs it down.
- wood: a hollow knock with the boards ringing, and on some steps a creak.
- concrete: a hard heel and a scuff of grit on the toe.

Grass is one swish instead, with blades flicking off the shoe, as a foot
swings through. The loose surfaces are built from many tiny filtered
bursts of noise, and how many there are, how bright, and how they spread
over the step is what tells stones from snow or leaves. Each surface was
tuned by ear against how real footsteps sound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 22:00:22 -05:00
Storm DragonandClaude Opus 5.5 d598818fb1 Generated music: battle_music and moonlight_metal
sfx.music holds looping background music pieces, made from code like the
sound effects. There are two so far, both for distorted guitars, bass and
drums:

- battle_music: original heavy metal in D minor in the manner of Bach's
  D minor harpsichord concerto. A unison opening riff, arpeggios through
  a circle of fifths, a gallop over a held A, then the riff again. It
  loops every 24 seconds at 160 beats a minute.
- moonlight_metal: Beethoven's Moonlight Sonata sped up and made heavy,
  in C sharp minor. The sonata's triplet arpeggios and opening chords,
  with a new lead melody, a triplet gallop and double kick. It loops
  every 27 seconds at 140 beats a minute.

Each piece is its own module in sfx/music/pieces, named after its
function, and is loaded the first time a game asks for it. A game only
loads the pieces it plays, and a piece is added by adding its module,
with nothing to register. The instruments the pieces share are in
sfx/music/instruments.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:33:35 -05:00
Storm DragonandClaude Opus 5.5 00db02b236 Play generated music through play_bgm, just like a music file
sfx.make_music turns a generated sound into the bytes of a WAV file, and
play_bgm (the global function, the Sound method and the Game method) now
takes those bytes as well as a file's path. The music is loaded into
pygame's music player from memory, so everything that already works on
background music works on generated music unchanged: looping, pausing and
fading for dialogue and menus, and the music volume.

Like make_sound, make_music turns down only music that would go past full
scale. It needs no mixer, so music can be made while a game loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:33:15 -05:00
Storm DragonandClaude Opus 5.5 ec82210ea6 Generated jump sound, matched to Wicked Quest's jump
movement.jump is a triangle tone sweeping straight up from 300 to 1000 Hz
over 0.24 seconds. It holds full volume for 0.04 seconds, then fades out
along a half sine. It matches the SoX recipe the original was most likely
made with (synth 0.24 triangle 300:1000 fade h 0 0.24 0.2), and it was
compared with the original by ear.

It peaks at 0.3, like the library's other short tones, so a game that
wants it as loud as the old file can pass a volume to make_sound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:33:01 -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