# Never Three: how it is built

A drum pattern from a theorem: strike on every doubling bit of rule 30's edge spectrum and the bar can never strike three times in a row.

## What it imports

```html
<script src="../../../sitoolz/js/clocks.js"></script>
```

From `SIClocks`: `rhythm(n)` (the bar as a string of `x` and `.`), `doublingBits(n)` (the positions, A094604), `noTriples(bar)`, `spectrum(driver, nbits, steps, kmax)` (the XOR driver's spectrum for the second voice), `triXorCols` and `weather` (the rain bit of the almanac for the third).

## The twenty lines that make it

```js
const C = SIClocks, n = 42;
const edge = C.rhythm(n);                                             // "x.xx.xx.x.....xx.......xx.x.x....x.xx.x.x."
const xs = C.spectrum(6, 40, 1 << 13, 12), xor = Array.from({length: n}, (_, i) => xs[i + 1] === xs[i] + 1 ? "x" : ".").join("");   // doublings of the XOR driver: powers of two
const cols = C.triXorCols(14), rain = Array.from({length: n}, (_, i) => C.weather(14, i + 1, cols).rain ? "x" : ".").join("");
const ctx = new AudioContext(); let step = 0, nextAt = ctx.currentTime + 0.05;
function kick(t){ const o = ctx.createOscillator(), g = ctx.createGain(); o.frequency.setValueAtTime(150, t); o.frequency.exponentialRampToValueAtTime(45, t + 0.12);
  g.gain.setValueAtTime(0.9, t); g.gain.exponentialRampToValueAtTime(0.001, t + 0.28); o.connect(g).connect(ctx.destination); o.start(t); o.stop(t + 0.3); }
setInterval(() => { while (nextAt < ctx.currentTime + 0.12){ const i = step % n; if (edge[i] === "x") kick(nextAt); /* rim on xor[i], hat on rain[i] */ nextAt += 60/bpm/2; step++; } }, 40);
console.log(C.noTriples(edge));                                        // true, and not by luck
```

## How to change the law

- `bars` (8 to 42 steps): the bar is a prefix of the same sequence; the verified spectrum reaches depth 42, so 42 is the longest bar the theorem covers.
- The driver of the second voice: `spectrum(6, …)` is XOR (doublings at powers of two); `spectrum(2, …)` is the comb (b AND NOT a), `spectrum(14, …)` the edge itself. Every one of the sixteen drivers has a power-of-two spectrum (the theorem behind `cards/clocks.md`), so every one gives a bar.
- The third voice reads the almanac: `weather(14, t, cols).cloud` or `.wind` instead of `.rain` for a different clock (periods 2048, 512 and 64).

## How to verify it

`fixtures/clocks.json` holds the bar, the doubling bits, three shorter bars and the no-triples check, written by `sitoolz/clocks.py` and checked by `tests/twins-clocks.test.cjs`; the spectrum itself is checked to depth 42 by `fixtures/ruler-land.json`'s cone section. The post-doubling law and its proof are in `rule30-edge-spectrum/docs/POST_DOUBLING_LAW.md` (Lars Rocha, 2026-08-25). `smoke.cjs` here checks the bar against A094604, the no-triples check at five lengths, and that the click makes an AudioContext.

## What was missing

Nothing.

![](shot.png)
