State Machine
Virtual Boolean-Logic-Only Synthesizer
State Machine is a virtual modular synthesizer you can play in your browser. What separates it from other more conventional synthesizer approaches is that every signal of the system is either zero or one. Instead of patching together VCOs, filters, envelopes, and delays, you have things like logic gates, shift registers, flip-flops, and binary counters. In this way, State Machine is less like a modular synthesizer, and more like a primitive computer that happens to make sound.
The approach is inspired by Stanley Lunetta, and a practice of making synthesizers using CMOS 4000 series logic ICs, something we have also visited in hardware form in our project the 40xx Synth.
GETTING STARTED
-
Click an input or output port, then click the destination port. (No dragging — just click once, then click again.)
Click an existing connection to unpatch it.
-
Click the + in the top left corner, then click a module’s button to add it to the canvas.
-
⌘/Ctrl + Click and Drag on a blank area — Move around the canvas
Scroll Wheel — Zoom in and out
On many laptops: ⌘/Ctrl + Scroll to zoom
Or, use the Zoom In/Out icons in the top-right corner
-
⌘/Ctrl + A — Select all modules
⌘/Ctrl + C / ⌘/Ctrl + V — Copy / Paste selection
⌘/Ctrl + Z — Undo
⇧ Shift ⌘/Ctrl + Z — Redo
-
Click the sound icon in the top right corner to start your patch and enable audio.
-
You can save to and load patches from your computer by clicking the save and load icons. The last saved patch will be loaded when revisiting the page.
-
Click and drag a module’s title bar to move it.
To move multiple modules, select them first, then drag.
To select modules:
⌘/Ctrl + Click a module, or
Use the selection box to select multiple modules.
-
Press Delete or Backspace to remove selected modules.
To select modules:
⌘/Ctrl + Click a module, or
Use the selection box to select multiple modules.
GENRAL TIPS & PATCHING IDEAS
You might be thinking, this is fun for making weird noises and buzzing alarms but what about something more… musical? Here are some tips that might help!
ENABLE or Disable Any Signal using an AND Gate
The AND gate only lets sound through if both inputs say "yes" at the same time.
For example, if you connect an oscillator (which constantly produces a tone) to an AND gate, and the second input is a button, the sound will only come through while the button is pressed. This makes it possible to enable or disable parts of your patch.
MULTIPLEXERS: MAKE CHOICES
Multiplexers are how your patch makes choices. They’re like a digital switchboard: you send in several options (like different oscillators or rhythmic patterns), and the multiplexer picks one based on a binary selector (A, B, and C)
In our example, a simple four-note sequencer is built using a binary counter that steps through four oscillator outputs. The counter chooses the sound, the multiplexer sends it to your ears.
Toggle a button using a flip-flop
Normally, the button only works while you’re holding it. If you want it to toggle on and off instead, you can use a flip-flop.
A flip-flop turns the momentary press into a state change: press once for ON, again for OFF. This is also the same logic used inside binary counters, so you can use those modules too.
You can also assign a key map to the button by clicking the assign button and then pressing any key.
Divide Time and Pitch with Binary Counters
Binary counters are time dividers. You feed them a clock pulse, and they start counting in binary. Each output (Q0, Q1, Q2…) blinks at half the speed of the one before.
That makes useful for:
Slowing down rhythms (every output gives a slower pulse)
Creating octave divisions for pitch control
Talking to other logic modules like multiplexers
In the earlier sequencer example, you can swap the four different oscillators for one oscillator at four different octaves, selected by the multiplexer.
Multiplexer + Ring Counter: generate melodic subharmonics
The ring counter can be used to divide the oscillators’ pitches into whole subharmonic divisions. Patch each of the ring counter’s Q outputs to different D inputs of the Multiplexer, then patch the Multiplexer’s output to the ring counter’s reset. Listen to the Q0 output of the ring counter. You can use any patch you want to select the different inputs of the multiplexer, but here we have a binary counter simply counting through the different ring counter divisions.
DISCRETE GATE TO TRIGGER CONVERTer
Sometimes, you’ll want a very brief trigger instead of a full oscillator cycle. For example, in the subharmonic patch above, we needed a trigger to reset the binary counter after a certain number of counts. Because each module has a propagation delay (the time it takes for the gate to process its signal and return a result), the oscillator will be cancelled out in the AND gate except for the brief moment it takes for the NOT gate to flip. Want the two signals to completely cancel? Just patch the oscillator to an OR gate instead of going directly into the AND.
SHIFT REGISTER AS A DATA LOOPER
A shift register stores a sequence of bits that move one step forward with each clock pulse, like a digital bucket brigade. Each bit advances to the next position, preserving the pattern as it shifts.
If you take the last bit (Q7, in this example) and feed it back into the input, it becomes a looping pattern. You can write new data into it by pressing a button connected through an OR gate, and you can reset the whole thing if you want to start over and clear the register.
MAKE THINGS RANDOM: LFSR
A Linear Feedback Shift Register (LFSR) is a special type of shift register that, instead of looping perfectly, creates pseudo-random sequences of bits.
It does this using XOR gates and feedback loops. The result is a pattern that seems random but is actually a very long cycle of bits—up to 255 different states for an 8-bit version.
Want different kinds of randomness? Just change which outputs you feed back into the XOR. These are called "taps," and they shape the character of your random signal.
CREATE MANY FLAVORS OF NOISE USING XOR GATES
If you patch together a bunch of XOR gates and fast oscillators, you’ll start hearing chaotic, noise-like sounds. This is because XORing high-speed signals creates a pattern too fast and irregular for your ears to track—so it becomes digital noise.
In this case, we also feed the noise back on itself using tiny NOT + XOR loops. Adjusting oscillator pitch will change the texture of the noise. For even more varied results, send the noise through a binary counter to create rhythmic randomness and filtered-sounding variants.
Discrete OSCILLATOR
You can also create a tone generator using only logic gates — no oscillators needed.
By feeding the output of a gate back into its input with a delay (which naturally exists in each of the gates), you create a feedback oscillation.
The more gates you add into the feedback loop, the slower the oscillation becomes. That’s how you can control its pitch. And because everything—counters, registers, multiplexers—is built from gates, you can design all those from just discrete gates too.