Repository navigation
Conversation
`createEuclid()`, `euclid()` and `rotate()` lived inside `worklet.ts`, the same file that calls `registerProcessor(...)` at module scope, so reaching the generator - a pure function of two integers - meant stubbing `AudioWorkletProcessor` and `registerProcessor` and running a render quantum. `arp` and `clock` both have a `dsp.ts` for exactly this reason; `euclid` was the last module of its size without one. Moved into `packages/euclid/src/dsp.ts`: `createEuclid`, `stepIncrement`, `clampWidth`, `euclid`, `rotate`, `RENDER_QUANTUM`, the three function types and the `_gate` import. Every comment travelled with the code it documents. `worklet.ts` is now the thin processor - class, `process()`, `parameterDescriptors`, `DISPOSE`, `registerProcessor`. One shape change, and it is additive: `createEuclid()` returns `[generate, update, reset]` rather than a pair, so a test can drive the reset path directly. The processor still destructures two. Pure refactor otherwise. Nothing is fixed - not the three `NaN` paths, not the float division in `euclid()`, not the `while` loop. A `Clock` -> `Euclid` chain rendered over 3600 parameter cells (bpm x steps x beats x rotation x subdivision x pulseWidth, `steps: 0` and `beats: 0` included), 200 blocks each with a reset edge every 50, is equal sample for sample to the pre-refactor build: 92160000 samples, 18432000 `NaN`s, 27704945 non-zero, SHA-256 564e8bbc8beb180656c0026a1329976f4c6ca83c39e296e9a370b04ecd7255e9 both sides. `worklet.test.ts` passes unmodified, snapshot included. `processor.ts` 1927 -> 1933 characters. The bundle is the same code reordered and remangled; the six characters are the third element of the returned tuple.
`Euclid(ac, { clock })` - the README's own usage block - emitted `NaN` on every
sample, forever. `steps` and `beats` both declared `defaultValue: 0`, so
`euclid(0, 0)` was the empty pattern and `pattern[0] * gatePulse(...)` was
`undefined * 1`. In Chrome that silences the branch of the graph it reaches for
the lifetime of the context. Two more paths had the same shape, an out-of-range
index feeding a multiply, and all three are closed here.
**Defaults that make sound.** `steps: 8`, `beats: 3` - the tresillo, `E(3,8)`,
which is the rhythm the module is named for and the README's own worked example.
`steps: 0` stays a declared, settable value and now means silence, which is the
honest reading of "a pattern with no steps".
**`current` clamped where the pattern is rebuilt.** `update()` is the only place
`pattern.length` can change, and `step()` only reduced the counter `% length` on
a step boundary - so turning a `steps` knob from 16 down to 8 left `current`
pointing past the end until the next wrap. Measured at 5 of the 16 step offsets
of an `E(5,16)` -> `E(3,8)` change, worst case 5376 samples = 121.9 ms.
**`reset()` guarded on the empty pattern.** It aimed at `pattern.length - 1`,
which is `-1` when there is no pattern. Plus a floor at the read, deliberately
narrow: `pattern.length ? pattern[current] : 0` rather than
`pattern[current] || 0`, so the clamp above stays load-bearing instead of being
masked into a silent wrong step.
**Integer counts.** `steps`, `beats` and `rotation` are floored at the top of
`update()`, before the change-guard compares them. All three arrive from an
`AudioParam` as floats and all three are counts: `steps: 8.5` fell out of
`i < steps` as a nine-step pattern, `beats: 3.5` divided as 3.5 and put four
onsets in `E(3,8)`, and `rotation: 2.5` returned a seven-step pattern from an
eight-step one, because `rotate`'s two `slice` calls truncate independently.
The new suite in `dsp.test.ts` is the net this module has never had: 768
settings across the declared range, 200 blocks each, every sample asserted
finite - 19.7 M samples - plus the shrink sweep at all 64 switch instants, the
reset-on-empty case, and the tresillo read out of `PARAMS`. Six of its eight
tests fail against the previous engine.
Nothing else moves: sample-identical to `04a20d4` over 448 parameter cells and
11.5 M samples, `steps: 16, beats: 5` among them, verified against a checkout of
the old `dsp.ts` and not shipped. `worklet.test.ts` and `clock-skew.test.ts`
pass unmodified; the descriptor snapshot changes by exactly two `defaultValue`
lines.
`euclid()` was Morrill's construction evaluated in accumulated float:
const v = Math.floor(i * (beats / steps));
pattern[i] = v !== d ? 1 : 0;
`beats / steps` is a binary float and `i * (beats / steps)` accumulates its
rounding error, so near a step boundary the error was enough to push
`Math.floor` across an integer and move an onset. It is now the same
construction stated the way Morrill 2022 section 4 states it, on the descents of
the residue row `n_i = (beats * i) mod steps` - step `i` is an onset when adding
`beats` wrapped past `steps`, which is exactly `n_i < beats`:
pattern[i] = (i * beats) % steps < beats ? 1 : 0;
`i * beats` peaks at 10000 over the declared range, far inside exact float64, so
nothing can round. The `d` accumulator goes with it: each step is now an
independent O(1) expression with no carried state.
39 patterns inside the declared range change and every one of them was wrong.
Each violated Morrill's Corollary 2 - a rhythm's minimal period must occur
gcd(beats, steps) times - so none was a Euclidean rhythm, and none was even a
rotation of the correct one. `E(18,66)` is the worked example: gcd is 6, so it
must be (4 4 3) six times, and the float form gave four clean cells followed by
4 4 4 3 4 3, a pattern with no repeating period at all. All 39 are at
`steps >= 44`; nothing at `steps <= 43` moves, so every named rhythm - tresillo,
cinquillo, bossa, samba - is byte-identical, and asserted so.
And `beats: 0` is now silence. The old loop seeded `d = -1`, so step 0 always
compared unequal and always became an onset: `euclid(8, 0)` was
[1,0,0,0,0,0,0,0]. That contradicted Lemma 2 ("contains exactly k notes") at
every one of the 100 declared `steps` values. Zero beats is zero hits, the same
way `steps: 0` is already silence. `beats` at or above `steps` remains every
step, now written down as a decision rather than left as a side effect.
The tests are the two lemmas rather than a list of patterns: exactly `beats`
onsets and gcd-many minimal periods over every declared setting
(0 <= beats <= steps <= 100), plus a reference Bjorklund ported from the
research harness - an independent construction - over all 528 rhythms with
`steps <= 32`: 291 identical, 237 a rotation, none different. That last number
is what the morning audit established and this must not lose; no pattern's
origin moves.
Two independent defects in `packages/euclid`, neither worth a ticket alone.
`pulseWidth` unreachable from TypeScript. It has been in `params.ts` since
0.2.0 - the factory wires it, the processor reads it, the README documents it -
but `EuclidInputs` and `EuclidWorkletNode` never gained the field, so
`Euclid(ac, { pulseWidth: 0.1 })` was a type error and `node.pulseWidth` was
untyped. Both types now carry it, and `PARAMS` drops its
`: readonly ParamDescriptor[]` annotation for `as const satisfies readonly
ParamDescriptor[]` - which keeps the shape check the annotation was doing while
narrowing the descriptor names to literals. Two type-level assertions then hold
the input type and the node type to that list. They fail `npm run build`, not
just an editor: `tsup --dts` type-checks and CI runs the build. Verified by
deleting fields - dropping `pulseWidth` from `EuclidInputs` gives
`error TS2344: Type '"pulseWidth"' does not satisfy the constraint 'true'`, and
dropping `subdivision` from both types names it twice.
The `while` loop in `step()`. `while (p > 1) p -= 1` ran up to `subdivision`
subtractions per sample where one does; it is now an exported `wrapPhase`,
`p - Math.floor(p)`, measured 7.9x faster at `subdivision: 20` (2e7 iterations,
median of five, Node 24 on Apple silicon). The loop also left a scaled phase of
exactly 1 standing, which `gatePulse` reads as low - the one value in `clock`'s
declared range that behaved unlike its neighbours, since a phase held anywhere
below `pulseWidth` holds the gate open. It now reads as 0, the top of the ramp
being the bottom of the next step. `Clock` emits `[0, 1)` and never produces
it; a hand-patched `clock` can. Step boundaries are otherwise unmoved.
`dsp.test.ts` gains a `wrapPhase` block checking it against the expression it
replaced over `subdivision` 1..20 and `clock` swept across `[0, 1)` - exact
equality, since every intermediate is representable below 21 - plus the one
input where the two deliberately disagree, and one behavioural test on a clock
pinned at 1. `clock-skew.test.ts` and `worklet.test.ts` pass unedited.
`packages/euclid/README.md`'s parameter table needed no change: it has listed
`pulseWidth` correctly since 0.2.0. The docs were right and the types were
wrong. Both it and the docs page gain the phase wrap.
`Euclid` gains a second output, `.rests`, playing the boolean complement of the pattern it is already playing - the steps the hits leave empty. The worklet now declares `numberOfOutputs: 2, outputChannelCount: [1, 1]` and hangs a `GainNode` off output 1, published through `Compound` as `.rests` and disposed with the node - `Clock.gate` exactly, which is the repo's only other multi-output node. Deliberately two outputs and not two channels: a node connected to an `AudioParam` down-mixes to mono, so a `[hits, rests]` stereo output would reach every existing `trigger` as the average of the two - 0.5 on every step, which under the `> 0` gate contract is a gate that never falls. Output 1 is `.rests` permanently; euclid ticket 06 appends 2, 3 and 4. `GenerateFn` now takes the processor's `outputs: Float32Array[][]` rather than a positional buffer, matching `packages/clock/src/dsp.ts`, so a later output is an index rather than a signature change. Why it has to be an output rather than a second node is Morrill 2022's Lemma 3 plus a measurement. Lemma 3 - "Euclidean rhythms distribute their rests in the same manner as their notes" - says the complement of E(k,n) is E(n-k,n) at some rotation, and that is asserted here rather than trusted: over all 2016 pairs with 1 <= k < n <= 64, the current integer generator gives 0 failures. (The pre-03 float generator gives 6, on E(14,44), E(30,44), E(20,46), E(26,46), E(22,52) and E(30,52) - which is why this ticket depended on 03.) In those same 2016 pairs the rotation is never 0, so a second `Euclid` at `beats: steps - beats` plays the right necklace from the wrong place and no rotation value is discoverable by ear. The recipe needs no rotation arithmetic at all, because `pattern` is already rotated when `step()` reads it: `1 - hit`, times one shared `gatePulse`. Both outputs are one step read twice - one pattern, one counter, one clamped `pulseWidth`, one `reset` - so they partition every step and cannot skew. The `pattern.length ?` guard on the rest line is load-bearing: without it `steps: 0` would silence the hits and fire the rests on every sample. Purely additive. Output 0 verified byte-identical to the previous engine over 396,492,800 bytes across 9,680 settings of steps x beats x rotation x subdivision x pulseWidth x reset. No new parameters, so the worklet snapshot is unchanged. Cost of the second write at 48 kHz, 128-sample blocks: 0.789 us/block before, 0.912 with the output present but unwritten, 1.081 written - worst case +0.29 us against a 2667 us budget, 0.011% of one core. Not zero: the gain is eager, so output 1 is always connected in the browser. Also drops the redundant `dispose(): void` from `EuclidWorkletNode` - `Disposable<N>` supplies it and `ClockWorkletNode` does not declare it. The type-level parameter guard from ticket 07 stays pointed at `EuclidWorkletNode` and still fails the DTS build by name; verified by deleting `pulseWidth` and watching `_EveryParamIsOnTheNode` report `Type '"pulseWidth"' does not satisfy the constraint 'true'`. Adds `index.test.ts`, this package's first node-level test.
`Euclid.pattern(steps, beats, rotation)` returns the array the node is
playing, as 1s and 0s. It is pure and control-thread - no `AudioContext`,
no worklet, callable in node - and it draws: a UI ring of LEDs is
`Euclid.pattern(...).map(...)`.
It is not a reimplementation of what the engine does. `dsp.ts` gains
`euclidPattern()`, and `update()`'s rebuild line now calls it, so the
exported answer and the played pattern are one expression rather than two
copies of it that a test could only catch drifting after the fact. Named
`euclidPattern` and not `pattern` because `createEuclid()`'s closure
declares `let pattern`, which would shadow a module-level one inside the
very function that has to call it. It is exposed only as `Euclid.pattern`,
beside `descriptors` in the same `Object.assign`, because
`packages/synthlet` re-exports this module with `export *` and `pattern`,
`euclid` and `rotate` are all words another module could want.
`EuclidRhythm` is the table: sixteen `{ steps, beats, rotation }` triples
ready to spread into the factory. It exists because `rotation: 0` is not
the named rhythm and no rule says which rotation is - 13 of Toussaint 2005
§4's 22 published rhythms come out right at the generator's own origin and
9 do not, and no stated rule does better (lex-largest 5, lex-smallest
starting on an onset 13, biggest-gap-last 6). Where a tradition enters a
necklace is ethnomusicology, not arithmetic, so the nine were looked up.
The table is an oracle, not folklore. `dsp.test.ts` holds all 22 of the
paper's §4 rhythms as box-notation literals and checks each three ways:
against §5's own interval vector, against a reference Bjorklund, and
against what `euclidPattern` returns. If the table and the paper disagree
the paper wins, and the 13-of-22 count is asserted rather than remembered.
The paper's E(5,16) prints seventeen boxes at both `:236` and `:322`; that
is a typo, and the 16-box reading is confirmed by the interval vector
`(33334)`, by Bjorklund, and by the paper's own 16-box "actual Bossa-Nova"
string being a rotation of it. The README table is parsed by a test, so the
documented sixteen triples and the shipped object cannot diverge - verified
by editing a digit and watching it fail.
The presets are necklaces. Where Toussaint distinguishes the necklace from
the rhythm as played, the README's second table carries the played variants
with their rotations. That resolves the contradiction in the notes:
bossa-nova at 6 is the rhythm as played - "usually starts on the third
onset" - and 12 is the necklace. Both numbers are right about different
things.
`worklet.test.ts` renders the shipped processor and reads the pattern back
out of the audio for all sixteen presets plus four edge settings, which is
the claim the shared expression does not make: that the engine reads the
array in step order and at the step it says. Its two new imports sit above
the `beforeAll` that installs the worklet stub, which is itself the proof
that `Euclid.pattern` is reachable with nothing stubbed.
Also fixes `rotate()`, which returned a doubled pattern whenever `rotation`
was a non-zero multiple of `steps`: `n % len` was reduced after the
`n === 0` short-circuit, so `n` was still `len` at the slice and
`array.slice(-0)` is the whole array. 482 of the 10100 reachable
`(steps, rotation)` pairs came back twice as long. It was inaudible through
the worklet - a doubled pattern is the same rhythm over twice the steps -
and it is not inaudible through a public array people read rotations off,
so it is a defect in this ticket's deliverable rather than one to leave.
The reorder is exactly behaviour-preserving: over
`steps 1…64 × beats × rotation 0…100` every setting that changes is one
the old form returned the wrong length for, and none of its well-formed
answers moved.
Both site demos were playing the wrong rotation of the bossa-nova and now
spread `EuclidRhythm.BossaNova`. Note on the ticket's criterion 4, which
asks for an assertion that the demos play the rhythm they name: there is no
such assertion and there cannot be one here, because `site/` is neither a
jest project nor a turbo workspace, so nothing in the test run reaches
`site/examples/*.tsx`. What discharges it structurally is that the examples
now hold no pattern numbers of their own - they spread a preset - so the
README and table tests are the examples' test. Said plainly rather than
claimed as coverage that does not exist.
Purely additive otherwise. No parameter added, no default moved, `PARAMS`
and the worklet snapshot untouched, and `EuclidRhythm` is tree-shaken out
of the worklet bundle - `processor.ts` gains only `euclidPattern` itself.
`Euclid` gains one k-rate parameter, `spread`, and three more outputs. Channel
`i` plays `Euclid.pattern(steps, beats, rotation + i * spread)`: four entry
points into one necklace, off one pattern array and one step counter, so they
cannot drift apart and one `reset` aligns all of them. Outputs 0 and 1 are
unchanged - the hits and `.rests` - and 2, 3 and 4 are `.b`, `.c` and `.d`,
the indices ticket 05 reserved. Nothing renumbers.
One necklace is several named rhythms at once, and they are the parts different
players hold simultaneously rather than variations on one part. At
`{ ...EuclidRhythm.Samba, spread: 2 }` three of the four channels are rhythms
Toussaint names.
**The sign.** The read is `pattern[(current - i * spread) mod n]`, implemented
as a block-scoped positive offset. `rotate` is a right rotation and `pattern`
is already rotated by `rotation` when `generate()` gets it, so moving a
channel's entry point forward means reading the array backward. The ticket's
prose says `+` and its four illustrative strings follow the prose; both
describe the other fan, which runs 0, 14, 12, 10 where the README's table of
Toussaint's played variants counts 0, 2, 4, 6. Swept over 1600 settings the `+`
read mismatches the ticket's own success criterion 2 on 650 of them and the `-`
read on none. The fan runs the way the documentation counts, and the ticket's
four strings are corrected wherever they reach code or docs.
**Two honesty guards, both in the README and the docs page.** Tiling is a
property of the *setting* and not of `spread`: `E(5,16)` at `spread: 4` fills
every step and strikes none more than twice, and the same pattern at `spread: 3`
leaves eight of sixteen silent and strikes two with all four voices - worse than
the four-independent-generators row it is contrasted with. Four of sixteen
spreads tile; one is unison. Both profiles are pinned as tests so a later edit
cannot generalise the claim. And no single `spread` reaches all three of
E(9,16)'s published entry points, because `spread` gives evenly spaced entry
points and a tradition's are not evenly spaced - the "no canonical origin"
finding one level up.
`spread: 0` is unison and is the default, so nothing that does not set it plays
differently; `spread === steps` is unison again. Asserted at the engine and
through the processor.
No new state: `step()` now returns the shared pulse and `generate()` does all
five reads itself, which *deletes* ticket 05's `restLevel` rather than growing
it to four. The closure holds one variable fewer than it did with two outputs.
`.rests` stays the complement of channel a alone - the complement commutes with
rotation, so any other channel's is one patched node away, where the base
complement is reachable from no second node at all. The gains stay eager, which
discharges the note `packages/clock/src/index.ts` left for whichever ticket
proposed a fifth output.
Measured at 48 kHz: five connected outputs cost +0.79 us on a 2667 us block,
0.030 % of one core, and one or two cost what they did. The offset is written
`(n - (s % n)) % n` rather than `((-s % n) + n) % n` because the latter
evaluates `-0` at every multiple of `steps` - a double, not a Smi - which gave
the per-sample `%` double type feedback and cost 2.30 us/block against 1.65 at
exactly the unison settings, `spread: 0` among them. The two are numerically
identical over `n` 1…64 and `s` -200…200.
The site demo becomes the fan with a Spread slider, since unison-to-hocket on
one control is the argument for the feature. It stops demonstrating `.rests`
interactively; `.rests` keeps its code block on the page and in the README.
`swing` moves one boundary inside each pair of steps: a pair's two steps start at `0` and `swingPoint = swing / (1 + swing)` of the pair rather than `0` and `0.5`, and each step's phase is rescaled to `[0, 1)` against its own - now unequal - length. So `pulseWidth` still means "this fraction of *this* step", the boundary detector is untouched, and a swung step's gate is not subtly wider than a straight one. Not "delay the odd steps", which is the phrasing that invites getting the gate width wrong. One new exported `stepPhase(scaled, paired, swingPoint)` replaces the bare `wrapPhase(clock * subdivision)` on `step()`'s first line. `step()` is the only place it goes: `generate()` makes all five output reads off that one value, so the hits, `.rests` and the fan's `.b`, `.c`, `.d` swing together sample for sample with no per-output arithmetic at all. Three k-rate quantities hoisted into `generate()`, one each per block: `swingPoint`, `paired` and `shortStep`. `swing: 1` is bit-identical to no swing, not merely close. At a swing point of 0.5 the pair reduction is algebraically the step reduction - with `q = wrapPhase(scaled / 2)`, an even `floor(scaled)` gives `q / 0.5 = w` and an odd one `(q - 0.5) / 0.5 = w` - and every operation in it is exact in binary floating point: halving and doubling are exponent shifts, a fractional part is a suffix of a significand, and `q - 0.5` for `q` in `[0.5, 1)` is exact by Sterbenz. Verified under `Object.is`: 4.8M samples of the expression and 46.08M samples of all five outputs held against the pre-swing engine, zero differing. The clamp survives it too, because `shortStep` is exactly 1 at `swing: 1`. Odd `subdivision`: the leftover step is straight and full length. A decision, not a fallback. Letting the half-pair truncate would give that step a phase spanning only `[0, 0.5/swingPoint)`, so any `pulseWidth` above 0.67 would produce a gate that never falls in it. The invariant it protects is that every clock cycle holds exactly `subdivision` boundaries - verified at every subdivision 1..20 x swing 1..3, no cell dropping or gaining a step - and `subdivision: 1` falls out of it as exactly inert, which is right: swing subdivides the beat, and there the step is the beat. The `pulseWidth` clamp is now computed against the short step of a pair, the binding one, and there is still one width per block shared by every output. It holds over the whole declared space except where the short step is itself under a render quantum: of 2268 cells swept, 96 leave the gate under a quantum, none at `swing: 1`, and all of them at `bpm 700 x subdivision >= 16` or `bpm 1000 x subdivision >= 12`. The tests assert the honest domain and pin the corner rather than claiming the criterion everywhere. `swing` is k-rate, default 1, range 1..3. `minValue: 1` is arithmetic rather than taste: below 1 the short step comes first, which is a pushed feel and not swing, and at an odd subdivision it would put an extra boundary inside the leftover half-pair. It goes into `params.ts`, `EuclidInputs` and `EuclidWorkletNode` together because 07's type guard otherwise fails the DTS build naming it - confirmed by adding the descriptor alone first and watching `error TS2344: Type '"swing"' does not satisfy the constraint 'true'` fire twice. Two corrections to what the ticket assumed, both documented rather than papered over. Which half of a pair a sample falls in is a pure function of the clock phase, so two `Euclid`s on one clock always swing the same direction, `reset` or not; what `reset` anchors is where the *pattern* sits on that grid, and a reset landing past the swing point puts step 0 on the short half. And the pairing belongs to `subdivision`, not to `steps`: an odd `steps` beats against the grid with period 2 pattern cycles, which is asserted rather than fixed, because fixing it would mean the counter skipping or repeating a step. The knob is the MPC/DAW constant-ratio convention and not a model of jazz swing, and the README, the `params.ts` comment, the docs page and the changeset all say so. Honing & de Haas (2008) test exactly the constant-ratio-at-any-tempo model every DAW implements and reject it - the swing ratio "is not kept constant, but it is systematically adapted to a global tempo", and swing "cannot be transposed in tempo by multiplying all durations with a constant factor" - and they reject the linear alternative and Friberg & Sundstrom's ~100 ms floor as well, find their own data stabilising "around a swing ratio close to 2.2:1" at slower tempi, and decline to fit a curve: "a more complex model is needed". So ship the convention users expect and can turn, and say that is what it is. Measured, and flat: 1.67 us/block at `swing` 1, 2 and 3 alike at subdivision 4, against 1.72 for the pre-swing engine - no penalty at the default setting, and none of the `-0`/Smi de-optimisation ticket 06 found, because neither operand of the one `%` on this path can be negative.
Eight tickets each patched the docs for their own change. This is the pass for
coherence: both files read end to end against each other and against the code,
reordered for the module the folder produced, plus the benchmark three tickets
deferred and the last of `rotation`'s coverage.
The rewrite. `packages/euclid/README.md` is now the idea / Install / Usage /
Named rhythms / Five outputs / Parameters / Swing / The generator. The rhythm
table moves from seventh section to fourth - it is the answer to the page's most
likely question and everything above it is forty lines. The "there is no
canonical rotation" argument was being made twice in different words seventy
lines apart, under `## The generator` and under `## Named rhythms`; it is now
made once, next to the table that answers it, with a pointer from the other.
`Euclid.pattern` is introduced once rather than twice. `## Parameters` gains the
two things it never said: that `spread` rebuilds nothing, and that `rotation`
clamps on the node where the pure function wraps.
`site/content/docs/(sequencers)/euclid.mdx` leads with the idea, gains
`## Named rhythms` and `## Recipes`, and renumbers `####` to `###`. Three live
falsehoods fixed: a usage block spreading `EuclidRhythm.BossaNova` under inline
comments showing a tresillo and its complement; two surviving `an euclidean`s;
and a `/docs/sequencers/clock` link that 404s, because `(sequencers)` is a
fumadocs route group and is dropped from the URL. Verified against a static
export - `out/docs/euclid.html` exists and `out/docs/sequencers/` does not - not
read off the slug builder. Only this page's links are fixed; the other 30 are
raised to the roadmap.
The demo draws the pattern. `PatternView` renders `Euclid.pattern` - the shipped
export, so the picture cannot disagree with the audio - one row per fan channel,
and `EuclidExample` gains Rotation and Beats sliders. `Slider` gains an optional
`onChange`, added the way `defaultValue` was, so every other example is
untouched. The demo's clave has been playing the bossa-nova all along, at
rotation 12 off `spread: 4`, and now the page says so.
The benchmark. `benchmarks/euclid-rate/` reconciles two numbers the folder
published without saying which was which: ticket 07's `wrapPhase` claim was 5.8x
and its implementation measured 7.9x. Under 07's own harness this machine reads
5.9x at `subdivision: 20`, and the spread is the input distribution rather than
the change. Inside the engine's per-sample step it is 1.5x and 0.23 us/block -
0.009% of one core, which is the honest size of that argument. Five output
buffers cost +0.68 us/block over one (0.026%), swing costs nothing measurable at
any setting, and ticket 06's unexplained "spread: 0 is slower than spread: 4"
does not reproduce - it was the machine's load. The runner exits non-zero above
half a core of load average and prints the load it ran at, so that cannot happen
silently again.
Coverage. Every rotation of E(5,16) driven end to end through the processor, all
sixteen asserted distinct because gcd(5,16) = 1. Rotation reduced modulo `steps`
past the declared maximum, asserted against `Euclid.pattern` rather than against
another render, replacing coverage that only appeared to exist: worklet.test.ts's
`{ steps: 7, beats: 9, rotation: 40 }` makes every step a hit, so no rotation is
observable in it and it cannot fail on a rotation bug - it keeps its place, with
a comment saying what it does not cover. `rotation` and `steps` changing
mid-cycle under a live step counter, counting step boundaries rather than hits so
a dropped or duplicated step fails even when it lands on a rest, and swept across
all sixteen offsets because 02's `current` clamp only bites at five of them. And
a guard that parses the README's parameter table against `PARAMS` - the third
hand-maintained copy of a list whose second copy made `pulseWidth` unreachable
for two releases.
Each new test was watched failing: the `current` clamp deleted, `rotate()`'s
multiple-of-`steps` fix reverted, `update()` shifted by one step, and one digit
changed in the README's parameter table.
No behaviour change. `params.ts`, `dsp.ts`, `worklet.ts`, `processor.ts`, the
snapshot and `clock-skew.test.ts` are untouched. Changeset is a `patch`,
departing from the ticket's own checklist, following `.changeset/clock-docs-page.md`:
a README rewrite is a change to the published tarball.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.