Introduction to Sound Synthesis Shaping control signals
Logic
Logic modules combine gates and triggers by treating each as true while it is high and false while it is low. AND, OR and XOR build new rhythms from existing ones, and a flip-flop divides a clock by two.
A gate has two states, high and low, which is the kind of signal digital logic gates were designed for. A logic module takes two or more gates and produces a new one according to a rule. AND is high only while both inputs are high. OR is high while either is. XOR, exclusive or, is high while exactly one is. NOT inverts a single input, so it is high wherever the input is low. On a modular synthesiser these are small, inexpensive modules; in software and on many grooveboxes the same rules appear as conditions on sequencer steps, such as a step that plays only when another track does not.
The tool below has two sixteen-step gate patterns, A and B, combined by a logic rule into an output that plays a snare. Click the A and B rows to change them. The inputs can also be heard, quietly, as a hi-hat and a kick.
Logic on two rhythms
Two sixteen-step gate patterns, A and B, are combined by AND, OR, XOR, NOT or a flip-flop into a third pattern that plays a snare. The inputs can be heard quietly underneath.
Listen for With A every third step and B every fourth, AND plays only where both land, on the first step and the thirteenth. OR plays wherever either lands, and XOR plays where one lands but not the other, which removes the shared hits and leaves a syncopated pattern. The flip-flop plays every second hit of A.
Combining rhythms
AND keeps only the moments two gate patterns share, which with two clock divisions gives the point where they line up: every third step AND every fourth step is every twelfth. OR merges them into one busier pattern. XOR keeps the hits that belong to one pattern only and drops the shared ones, which tends to push the result off the beat. NOT turns a pattern's rests into hits and its hits into rests, so NOT applied to a kick pattern gives a part that fills the gaps around the kick.
Flip-flops and counting
A flip-flop has an output that changes state on each trigger it receives: high on the first, low on the second, high again on the third. Its output is a gate at half the rate of its input, so a flip-flop is a divide-by-two clock divider, and a chain of them divides by four, eight and sixteen. In this tool the flip-flop is fed from A, so the snare plays on every second hit of A. Counters, the circuits inside clock dividers and sequencers, are built from chains of flip-flops.
Comparators
A comparator turns any control signal into a gate: its output is high while the input is above a threshold and low while it is below. Sent a sine or triangle LFO, it gives a pulse wave whose width depends on the threshold; sent a smoothly varying random signal, it gives gates of irregular length at irregular times. On a modular synthesiser a comparator is the usual way to bring a continuous signal into a logic patch, and its output can then be combined with clock divisions by AND, OR and XOR like any other gate.
Common questions
What does a logic module do in a modular synthesiser?
It combines gate and trigger signals by treating each one as true while it is high and false while it is low. AND is high only when both inputs are high, OR when either is, and XOR when exactly one is. The output is a new gate pattern made from the inputs.
How do you divide a clock by two with logic?
Use a flip-flop, a circuit whose output changes state on each incoming trigger: high on the first, low on the second, high on the third, and so on. Its output is a gate at half the input's rate, and chaining flip-flops divides by four, eight and sixteen.
Why use XOR on rhythms?
XOR is high when exactly one input is high, so it keeps the hits that belong to only one of two patterns and removes the ones they share. Applied to two simple patterns, it often produces a more syncopated one than either.
Published Glossary
In this part: Shaping control signals