1.5 KiB
1.5 KiB
Stupid Synth Design Document
Overview
Stupid Synth is a minimalist, 4-voice polyphonic synthesizer designed for the RP2040. It prioritizes zero external component count (other than the sound transducer itself) and code simplicity.
Hardware Design
- MCU: Raspberry Pi Pico (RP2040).
- Audio Output:
- Method: High-speed PWM (Pulse Width Modulation).
- Pin: GP28.
- Circuit: Connect a piezo buzzer directly between GP28 and GND, or a speaker/headphones in series with a 220Ω resistor.
- Input: USB Serial Console (no physical buttons/pots required).
Software Architecture
Audio Engine
- Carrier Frequency: ~490 kHz (125MHz sys clock / 255 wrap). This pushes PWM noise far above human hearing, minimizing the need for an analog filter.
- Sample Rate: 22,050 Hz.
- Bit Depth: 8-bit.
Synthesis Engine
- Waveform: Sawtooth (generated via simple phase accumulation).
- Polyphony: 4 simultaneous voices.
- Envelope: Simple Decay (percussive/plucked sound).
- Mixing: Tanh saturation (soft clipping) to prevent digital distortion when voices sum.
Interface
- Control: Keyboard characters sent via Serial Monitor trigger notes.
- Keys:
a,s,d,f,g,h,j,k(Scale C4 - C5).
- Keys:
Execution Plan
- Configure RP2040 Hardware PWM on GP28.
- Setup a repeating timer interrupt at 22.05kHz.
- Implement the mixing loop and voice management in the interrupt handler.
- Process Serial input in the main loop.