Every sound in my game is a function, not a file

STARSWING ships with zero audio files. No .wav, no .mp3, no .ogg. Every sound you hear is computed the instant it plays.

The game was almost done and something felt hollow — it had no sound. My first move was the obvious one: go find royalty-free loops and a few effects. Then I stopped. I was already generating every pixel from code; why was audio the one asset I was about to download?

What if the whole sound system is a function of the game state, not a folder of files?

The effects are one-shot synths

Each effect is a short function that writes PCM samples — a catch is a bright blip with a fast decay, a launch is a rising whoosh, death is a downward thud. No sample libraries, no trimming, no licensing. The build doesn't get bigger when I add a sound; it gets a few lines longer.

Tap to hear — every effect is generated from code

The music is three layers, always playing

The soundtrack isn't a track. It's three loops — normal, combo, high combo — running in sync the entire time. The game never switches songs; it crossfades which layer you hear over 700ms, based on how well you're doing. Chain catches and the second layer rises under you; push a long combo and the third opens up. Nobody presses a button. The music reads the state.

Three layers — the game fades between them as you play

Why this turned out to be the right call

Three things fell out of it for free. The download is smaller — there's no audio payload at all. There's nothing to license, ever. And because the music is a function of the game state rather than a fixed clip, adaptive scoring came for free: the intensity already tracks the player, because the player is the input.

Is it lo-fi? Completely. It sounds like a console from thirty years ago. That's the charm, and it's the honest sound of a game whose art is a triangle and some circles. It fits.