A wavetable-based polyphonic synthesizer (sawtooth) on an Atmega328P. Note-on and note-off MIDI events can be received over the Atmega's USART module. The sound is generated by driving an external 8-bit DAC (MCP4901) over the SPI module. Finally, the output of the DAC is put through an RC bandpass filter to remove DC offset and frequencies above 8kHz.
- 16kHz sample rate
- 6 independent voices
- audio signal in 8 bit fixed point precision
- sawtooth signal is stored in low-pass filtered wavetables to avoid aliasing. Tables with different filter cutoffs are generated in Python before compilation. At runtime, the appropriate table index for specific notes is selected when they are played.
synth.mp4
The CKDIV8
bit in the low fuse byte (FLB) needs to be unprogrammed (set to 1
) to set the clock frequency to 8 MHz
.
With the other bits left to default, this results in a value of 0xE2
for FLB.