tSample counter — increments by 1 each sample
t
→
Sawtooth ramp at sample rate
+Addition
t+t
→
Doubles the value of t
-Subtraction
t-128
→
Shifts waveform down by 128
*Multiplication
t*t
→
Parabolic curve, creates harmonics
/Division
t/4
→
Slows the ramp, lowers pitch 2 octaves
%Modulo (remainder)
t%256
→
Wraps t every 256: sawtooth wave
&AND — keeps bits present in both
t&127
→
Masks to 7 bits, caps value at 127
|OR — sets bits present in either
t|128
→
Forces bit 7 high, adds DC offset
^XOR — flips bits that differ
t^t>>4
→
Cancels shared bits, metallic timbre
~NOT — inverts all bits
~t
→
Inverts the waveform
>>Right shift (divide by 2ⁿ)
t>>4
→
16× slower: drops pitch 4 octaves
<<Left shift (multiply by 2ⁿ)
t<<2
→
4× faster: raises pitch 2 octaves
t*(42&t>>10)
t>>10 changes every ~1024 samples. AND with 42 (101010₂) selects alternating bits — creates a two-note melody multiplied against t.
t*((t>>12|t>>8)&63&t>>4)
Three time scales (>>12, >>8, >>4) combine via OR and AND to create a cycling pattern of multipliers. The &63 caps values to 0–63.
(t*5&t>>7)|(t*3&t>>10)
Two independent voices mixed with OR. Each voice uses a different harmonic (×5, ×3) and rhythmic rate (>>7, >>10).
t*(t>>5|t>>8)>>(t>>16)
t>>16 changes very slowly (~8 sec at 8kHz). Using it as a shift amount creates a gradual volume/timbre fade.
t*(t^t>>8)>>12
XOR of t with its shifted self creates symmetry-breaking. >>12 and multiply shape the result into slowly evolving arpeggios.
Each sample, the counter t increments by 1. Your expression is evaluated and the lowest bits become a PCM audio sample — 8 bits at 8-bit depth (values 0–255), 16 bits at 16-bit, or 32 bits at 32-bit.
Sample rate sets the clock. A right-shift creates a slower clock: t>>8 changes ~31 times per second at 8kHz (useful as rhythm), while t itself ramps at the full sample rate (a pitched sawtooth).
Bit shifts set time scale: >>4 ≈ 500Hz, >>8 ≈ 31Hz, >>12 ≈ 2Hz, >>16 ≈ 0.12Hz (at 8kHz). Multiply (t*N) sets pitch. AND, OR, and XOR combine and shape these time scales into melodies, rhythms, and timbres.
The characteristic sound comes from arithmetic overflow as values naturally wrap at 256 (8-bit) or 65,536 (16-bit). Bitwise masking carves structure out of this wrapping. Changing a single constant can dramatically alter the output.