1-Bit AVR Synthesizer

October 2009

Revision 2 with paper front panel

(a.k.a. "The Nastysynth," "The Sarnov-I")

This is a weird-looking synthesizer/noisebox I made in a couple of days. It's an extremely simple circuit; an ATmega48 directly generates stereo audio without a DAC or any external circuitry. However, since the AVR's pin outputs are digital (either 5V or 0V) the resulting audio waveforms have only 1 bit of amplitude resolution. In other words, it does pulse waves and nothing else.

This is the same method used by the TIA chip in the Atari 2600. Thus, the synthesizer makes some very nostalgic, Atari-esque sounds. Its feature set is quite minimal:

controls

The controls consist of eight knobs. The older version had six knobs and two pushbutton BCD switches. Here's what they control:

Closeup of the front panel
Pitch
Technically, the audio oscillator period. Not much to explain.
LFO rate
Controls the frequency of the low frequency oscillator. The low frequency oscillator modifies the audio pitch, so this knob controls vibrato rate.
LFO depth
Controls the amplitude of the low frequency oscillator; i.e. vibrato intensity. When all the way to the left, there is no change in pitch. When all the way to the right, the change in pitch is significant.
Envelope rate
Controls the rate of the 1-bit envelope. When all the way to the left, the sound is constantly on.
Envelope width
Controls the duty cycle of the envelope waveform; i.e. the percentage of the envelope period where the sound is not muted. Turning the knob to the left decreases the duty cycle, resulting in short staccato bursts.
Low pass filter
OK, so it's not totally digital. This knob controls a simple, first-order passive low-pass filter. Can be used to sharpen or muffle the sound.
Audio waveform
Selects one of eight 1-bit waveforms. 0 through 6 are 16-bit patterns; 7 is white noise generated with a 16-bit linear feedback shift register.
LFO waveform
Selects one of eight LFO waveforms, allowing you to make "laser," "siren," or "computer" sounds:
  1. Triangle
  2. Sawtooth up
  3. Sawtooth down
  4. Square
  5. Half square
  6. Half sawtooth up
  7. Half sawtooth down
  8. Random pitches
In Version 2, I replaced the two push switches with regular potentiometers. BCD switches and rotary switches are really expensive. Pots are nice and cheap, but don't have those satisfying click-stops. To make up for the lack of tactile feedback, the power LED pulses every time you select a new waveform.

midi

The synthesizer can be connected to a MIDI keyboard, PC, or other device and played directly. MIDI support is basic; only note-on and note-off messages are interpreted, and it's monophonic.

hackability

There are plenty of unused pins on the ATmega48, so feel free to add more buttons, switches, LEDs, whatever. There are also two unused analog channels, which you could connect to additional potentiometers, photocells, anything that outputs a 0-5V signal.

The firmware is written in C (using avr-gcc and avr-libc) and weighs in at under 3k. You'll need an ISP programmer to upload new firmware. (If someone wants to make the board Arduino-compatible, it probably wouldn't be too difficult.)

code

The code is on GitHub and is released under the msarnoff.org license. Feel free to fork it and add new stuff!

Additionally, I've added a file called tiasnd.c that contains an implementation of the actual waveforms from the Atari 2600 TIA chip. I have adopted the algorithms from the source code of the Stella emulator.

The TIA uses a 9-bit linear feedback shift register connected in interesting ways. By default, this code is unused (I'd rather have the thing make its own sounds, instead of mimicking another device) but it shouldn't be hard to hook it up.

photos

Photo gallery is on Flickr.

schematic


(click to enlarge)

Download gEDA schematic: https://github.com/74hc595/1-Bit-AVR-Synthesizer/raw/master/circuit/synth.sch
May require custom symbols from my symbols directory.