๐Ÿ”Š Procedural Audio Synth Lab

Generate game sound effects from raw waveforms โ€” no audio files, just math.
Tap a preset or tweak the oscillators, envelopes, and FM parameters in real time.

Presets (tap to play)

Oscillator

440 Hz
0.15s

Envelope (ADSR)

5ms
20ms
0.60
50ms

FM Synthesis

Off
0.0

Pitch Sweep (Glissando)

440 Hz
๐Ÿ“– How it works

Oscillators generate raw waveforms: sine (pure tone), square (odd harmonics, buzzy), saw (all harmonics, bright), triangle (odd harmonics, soft), noise (percussion, textures).

ADSR envelope shapes the amplitude over time: Attack (rise), Decay (settle), Sustain (hold), Release (fade). This is how a pluck differs from a pad.

FM synthesis modulates the carrier frequency with a second oscillator. Higher modulation index = more harmonics = brighter/metallic timbre. Classic for bells, lasers, brass.

Glissando sweeps the pitch from the base frequency to the end frequency, useful for jumps, falls, whoosh effects.

Everything runs in the Web Audio API โ€” no audio files needed. The waveform preview is drawn on a canvas from the generated buffer.

๐Ÿ Python engine

The same synthesis logic is available as a Python script (audio_synth.py) that writes 16-bit PCM WAV files. It uses only the standard library โ€” math, wave, struct โ€” no external packages.

Generate all 8 game SFX presets: python3 audio_synth.py sfx/

Each preset is <50 lines of math: sine_gliss for jumps, fm() for lasers, noise + exponential_decay for explosions, adsr + square for hits, arpeggiated glissando for power-ups.