d58d0d3b099543c10d48337b8fcedbfd06164c18
Synthesizes kick, snare, hi-hat, bass, and acid lead from scratch. 32-bar song structure with filter sweeps and pattern variation. Outputs raw float32 stereo at 44.1 kHz to stdout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
techno-gen
Generates infinite procedural techno music as raw float32 stereo audio on stdout. 138 BPM. No samples — everything is synthesized from scratch.
Build
make
Or manually:
gcc -O2 -Wall -lm -o techno-gen techno-gen.c
Play
Pipe directly into paplay (PulseAudio):
./techno-gen | paplay --format=float32le --rate=44100 --channels=2
Note:
paplayis part of thepulseaudio-utilspackage. On Debian/Ubuntu:sudo apt install pulseaudio-utils
Mono version (if you only want 1 channel)
The program outputs stereo (2 channels). If you want mono, mix down with sox:
./techno-gen | sox -t raw -r 44100 -e float -b 32 -c 2 - -t raw -r 44100 -e float -b 32 -c 1 - | paplay --format=float32le --rate=44100 --channels=1
Record to file
./techno-gen | sox -t raw -r 44100 -e float -b 32 -c 2 - output.wav trim 0 120
This records 2 minutes (trim 0 120) to output.wav.
What it sounds like
| Time | Section |
|---|---|
| 0–3 bars | Intro — kick + bass, filter closed |
| 4–7 bars | Rise — hi-hats join, filter opens |
| 8–15 bars | Full — snare, acid lead, LFO filter sweeps |
| 16–19 bars | Breakdown — bass only, stripped down |
| 20–23 bars | Build — kick returns, filter climbs |
| 24–31 bars | Heavy — syncopated kick, acid variation 2 |
| then loops | Back to bar 8 (never the sparse intro again) |
The cycle is 32 bars (~1 min 23 sec at 138 BPM), then repeats with continuous filter and pattern variation.
Synthesis
All audio is synthesized in real time:
- Kick — sine oscillator with pitch envelope (200 → 45 Hz), amp decay, transient click
- Snare — high-pass filtered noise blended with a 185 Hz tone
- Hi-hat — noise through a 7 kHz high-pass; open/closed variants with different decay times
- Bass — sawtooth oscillator through a resonant (Q=4.5) biquad low-pass with per-note filter envelope and glide
- Acid lead — dual slightly-detuned sawtooth through a very resonant (Q=6) low-pass; filter sweeps with LFO per section
- Stereo width — short delay line (~11 ms) ping-ponged between channels on hats and acid
- Master —
tanhsoft saturation to keep levels honest
Description
Languages
C
98.6%
Makefile
1.4%