Writing · Ep. 4 · 0x0957–0x09B8 · Hardware
A synth that fits in 2 KB of RAM
Notes from building Pocket Synth: fixed-point phase accumulators, an 8-bit wavetable, and why the speaker sounded like a kazoo at first.
Budget
Part | Bytes |
|---|---|
Wavetable (256 × 8-bit) | 256 |
Four voices | 48 |
Serial buffer | 128 |
Everything else | the rest |
Phase accumulators
Each voice adds a fixed step to a 32-bit phase every sample. The top eight bits index the wavetable, so the frequency is
No floating point, no division, one addition per voice per sample.
The kazoo problem
The PWM carrier was audible. Raising it above 30 kHz and adding a simple RC low-pass filter fixed it.
