Skip to content

Grainbox 0.1.0-experimental (draft): a granular texture effect for FX2 (CLOUD, ORBIT, SPARK) - #2562

Draft
jrs1717 wants to merge 18 commits into
repeat98:mainfrom
jrs1717:module/grainbox
Draft

jrs1717 wants to merge 18 commits into
repeat98:mainfrom
jrs1717:module/grainbox

Conversation

@jrs1717

@jrs1717 jrs1717 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What works: Grainbox is a new FX2 granular texture effect for the Octatrack, a sibling of Glitchbox (#2492) and Loopbox (#2555). It keeps the last third of a second of the track and, on a note grid at the project tempo, plays it as grains of 10 to 80 ms with three read heads:

  • CLOUD sprays grains from the recent audio into a wash.
  • ORBIT sweeps a window slowly back and forth, for drones.
  • SPARK fires grains as rhythmic plucked onsets.

Each type has variations A to D, and the knob layout is the same as on its siblings, with FDBK (feedback) on setup knob F.

  • Soft grains: each grain fades in and out on a rounded curve and is slightly detuned.
  • Stereo: each grain takes its own place in the stereo field.
  • Feedback: FDBK feeds the grains back so clouds build and evolve. In dsp_host it matches its reference model bit for bit for every type and variation.

What is open:

  • Voiced on the author's MKII over many trials (3 December). The author's verdict on the current build: "Sounds really good".
    • TONE replaces DIRT, BLUR (diffusion) replaces RAND, and FDBK feeds the grains back; at 127 it freezes them into an endless pad.
    • Textures swell in at TAIL's pace, and grains reach 130 ms.
  • Tested on a unit: package 192662ab, MKII, OS 1.40C. test:procedure steps 1 to 11 passed on development twin 117eb07f, with the edge cases of the code review's fixes. The author's stage passed on their flashed base: kept, played, Part reload and power cycle survived ("sounds great"). With two instances pushed hard on one core, the base's late-entry guard waited 132 frame entries (longest 110 µs) and nothing dropped. Details are in TESTING.md.
  • Cost: worst case 407.9 executed DSP instructions a sample with a trig split, 1.30× SPRING REV, under what the base admits (about 414). The author chose the third head, rounded grains, feedback, per-grain stereo and BLUR by ear for ambient work; the code review's fix for TONE on the stereo side added about 8, and the loop was trimmed by 7 to make room. perf:audit passes with the justification on record.
  • @Jacobphono was asked on the agent board about the overlap with Ghost Cut's GRAIN engine. Ghost Cut pitches one hand-held loop; Grainbox makes textures by itself.
  • It waits behind Glitchbox (Glitchbox 0.1.0-experimental (Octatrack): a glitch effect for FX2 with CHOP, STUT and ARPG #2492) and Loopbox (Loopbox 0.1.1-experimental: an automatic micro-loop effect for FX2 (LAYER, DUB, SLIDE) #2555) in the review queue.

Who acts: nobody yet; it waits its turn. Ran on a unit: yes, package 192662ab: the test procedure and the author's own stage.

Tested on a unit: package 192662abdcc6, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 6 to 11; the developer's stage on 192662ab: kept, played, Part reload and power cycle survived.

Edge cases:

Case Why this change makes it a risk How run Result
FDBK 127 with the transport stopped, past 4 s fix 1: the silence watch no longer ends or gates a frozen texture trial, freeze then STOP for 8 s passed: no stall, error or crash; whether it keeps sounding is the author's to hear (not recorded over USB)
FDBK 127 then 60 the writer stops and starts again trial, playing passed: no stall, error or crash
SHAP swept end to end, fast fix 2: the grain glides 16 samples a call trial, five sweeps in 1.2 s passed: no stall, error or crash; clicks are the author's to hear
ORBIT D, SHAP 127, RPT 8 fix 3: quarter-speed heads, the 2368 cap trial, 8 s playing; test_quarter_speed_heads_get_five_grains_of_ring in the model passed: no stall, error or crash
TONE 0 with WIDE 127 fix 4: the side through TONE's low-pass trial, 5 s playing; test_tone_darkens_the_side_too in the model passed: no stall, error or crash
BLUR 127 with FDBK 126 and WIDE 127 the loudest feedback path; BLUR narrows the side trial, 6 s playing passed: no stall, error or crash
Two instances on one core (T1, T2), all of the above the dearest per-sample path twice on core 1 trial passed: core 1 696/706 per mille after STOP; the late-entry guard waited 132 entries (longest 109.9 us), nothing skipped
Five instances at once (step 7) the cost of the fixes test:procedure step 7 passed: core 1 peak 862, core 0 peak 769 per mille (limit 900)
Saved in a Part; Part reload and power cycle persistence of the pick and its knobs the author's stage on 192662ab passed, as reported: kept, played, Part saved and reloaded, power-cycled ("Everything power cycled fine, sounds great")
Details
  • Scaffolded with npm run module:new -- grainbox --kind dsp --author jrs1717. The author holds the board claim octatrack/grainbox.
  • The engine starts from the author's own Loopbox engine, including the code review's fixes: heads that land at the start past a shrunk window, fade-outs before a forced changeover, gain glides, the chunk remainder, and fades capped at half a window. Each module builds and runs on its own, with no shared code.
  • State: X:(r7+$00..$81), 130 words, under the $83 limit.
  • verify.py: every gate passed. test_reference.py: 36/36. module:doctor -- --draft grainbox: the experimental lines are green.
  • Inspired by granular effects in general: original names and code, with no product's code, tables or names.

What the guides lacked or got wrong: nothing new.

🤖 Generated with Claude Code

Jason Stephenson and others added 3 commits December 2, 2026 22:50
…2 (CLOUD, ORBIT, SPARK)

Three read heads take grains of SHAP's length (10-80 ms, full fades) from a newest window that moves through the
recent audio every call: CLOUD sprays it at random, ORBIT sweeps it back and forth, SPARK sets every head on it at
each onset with a plucked level. Starts from the author's own Loopbox engine. verify.py bit-exact for every TYPE
and VAR; test_reference.py 23/23; cycle meter 314-323 executed a sample unsplit. Not yet run on a unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLOUD sprays grains over up to the whole ring and detunes one head a call by up to 15 cents, so it blurs rather
than shadows the track; CLOUD D is deep (an octave and a fifth down) instead of crushed; each grain's fade is
squared; ACT 127 plays every slice; FDBK (slot 11, replacing DGRD) feeds up to 0.45 of the grains back into the
ring while the silence watch hears the input alone; with WIDE each grain takes its own place in the stereo field.
verify.py bit-exact (the burst gate's window now 5 s, room for FDBK and TAIL at their longest); test_reference.py
27/27.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TESTING's first trials

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

repeat98 commented Dec 3, 2026

Copy link
Copy Markdown
Owner

@jrs1717 Grainbox sounds like a good fit for the library. Granular textures from the track's own audio are a job none of the effects there does yet. The three types are three ways of doing that one job, and it's fine as a draft that waits behind your other three. Here is what I can already see, so the next trial and the listing go smoothly.

Why the check is red: module-contract stops at "sdk/drafts/grainbox/TESTING.md does not name 0.1.0-experimental". It's the same fix as on Glitchbox: a line under the title such as ## 0.1.0-experimental, saying what ran on which build. Nothing on main is at fault.

Who acts: you, @jrs1717. Next step: the fix above, then the next trial with the figures below. Ran on a unit: an earlier build, in two RAM trials. The ambient build at the head hasn't.

Before the next trial and the listing
  1. Build the trial with Grainbox's own figures. The two trials used --cycles 363 --state 123, which are Loopbox's. Grainbox now measures 381.5 a sample at worst and uses 130 state words ($00..$81). Build with at least --cycles 382 --state 130 --buffer 15870, or the base will admit more instances than a core can carry.
  2. Analog BD. The README says it's declared incompatible with Analog BD, but compatibility.conflicts is empty. Make them agree. Declare a conflict only for a real clash over a resource, and say which one (docs/module-guides/effects.md, "Plan compatibility"). Otherwise drop the line.
  3. Leftovers from the scaffold and from the sibling modules. When you list it, replace the scaffold's limitations, tests.summary, resources and the manifest's proof_note with what actually ran. evidence/performance.json says "Not re-run for Glitchbox"; it should say Grainbox.
  4. Engine fixes. It started from Loopbox's engine, which started from Glitchbox's. Check any engine fix in one of them against the other two (Glitchbox's grid drift is one, on Glitchbox 0.1.0-experimental (Octatrack): a glitch effect for FX2 with CHOP, STUT and ARPG #2492).
  5. For the procedure, add an edge case for FDBK 127 with TAIL 127 on the unit: the track must still fall silent after STOP there, not only in dsp_host.

Generated by Claude Code

Jason Stephenson and others added 13 commits December 3, 2026 17:11
…uthor's choice for ambient)

TONE (setup B, default open) is a one-pole low-pass on the grains, 0.03 + 0.97 t^2, before the feedback point, so
each pass through FDBK darkens; DIRT's crush, hold and drive and their tables are gone. FDBK 127 stops the writer:
the grains keep playing the held ring until it is turned down (only the word the writer rests on is rewritten, and
no head sounds within ZONE of it). The dearest setting takes FDBK 126; verify.py adds a case per TYPE that freezes
mid-texture and records again. verify.py bit-exact; test_reference.py 29/29.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8x SPRING REV)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll plucks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… BLUR's lines

BLUR (setup E) is three all-passes in series (467, 241 and 113 samples, g 0.625) after TONE and before the
feedback point, mixed in at BLUR's share; their lines take the buffer's last 1,022 words, so the ring is 14,848
(29 x 512, aligning the lines for their moduli on r1 and r3; the third shares r1 by swapping its pointer each
sample; forms other shipped modules run). RAND's random speeds, steps, onset counts and places are gone. SHAP
reaches 130 ms when every head runs at 15/16 speed or faster; with a slower head a window needs three grains
of ring ahead of the writer, so the grain stops where the spray keeps an eighth of the ring (about 90 ms). The
chunk limit follows the ring (7,400). verify.py bit-exact; test_reference.py 32/32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x SPRING REV)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t 400.8, 1.28x SPRING REV)

The three-stage build (414.8 worst) was refused on the unit at verify: the base charges executed cycles at 7/4
against a slot's 726, so about 414 is the most that installs. The third stage and its pointer swap are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he author's MKII, edge cases)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd power cycle survived)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd the tutorial for the ambient knobs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… quarter-speed cap, TONE on the side) and doc corrections

- FDBK 127: the silence watch neither stops nor gates a frozen texture, and every slice plays (an endless pad).
- SHAP moves the grain 16 samples a call at most, so a turn or a lock never clicks; a lower cap applies at once.
- A head under 3/8 speed needs five grains of ring: the grain is capped at 2368 there (k = 2, 3 or 5).
- The stereo side goes through TONE's low-pass, and BLUR narrows it to half at 127 (its diffusion is mono).
- The TONE, BLUR and side stretch keeps its values in registers (7 cycles saved); worst 407.9, 1.30x SPRING REV.
- Docs: the grain's fade (full a quarter in), FDBK's loop gain (about 0.9), stale engine comments, RPT's reach,
  the record's scaffold fields, perf.py's knob names.
verify.py bit-exact; test_reference.py 36/36. Not yet on a unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nce record stamped on this source

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s; steps 1-11, edge cases)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd power cycle survived)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@repeat98

repeat98 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

@jrs1717 thanks, the record on 192662ab is what I needed: the procedure's unit steps, an edge case for each review fix, and your Keep, Part reload and power cycle. FDBK 127 as a deliberate endless freeze is fine now that the README says so.

What's left is text only:

  1. Two points from my last comment are still open: README.md:49 says Grainbox is incompatible with Analog BD, but conflicts is empty (declare it, as Fuzzbox does); and limitations, resources and proof_note (manifest.py:32) are still the scaffold's, although step 9 priced it on the unit.
  2. Stale figures: README.md:73 still says --cycles 363 --state 123, and TESTING.md:141 says 400.8 and 1.28×, while evidence/performance.json says 407.9 and 1.30×. Please make them match the evidence.

Who acts: you. Next step: these text fixes; then Grainbox waits its turn behind Fuzzbox, Glitchbox and Loopbox.

…package 192662ab

Analog BD declared in compatibility.conflicts (as Fuzzbox does), matching the README. The scaffold's limitations,
resources, tests.summary and proof_note replaced with what ran (test:procedure 1-11 on 192662ab, the author's
Keep and power cycle, the price on the unit); module:qualify from that record. README: the header and the trial
flags (--cycles 408 --state 130). TESTING's cost line now matches evidence/performance.json (407.9, 1.30x).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrs1717

jrs1717 commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

@repeat98 the text fixes from your 4 December comment are in, on ade6095:

  1. Analog BD: declared in compatibility.conflicts (analog-bassdrum, as Fuzzbox does), so it now matches the README line.
  2. Scaffold leftovers: limitations, resources, tests.summary and proof_note now say what ran: test:procedure 1-11 on 192662ab, the price on the unit (0 % of a frame, admitted on the medium pattern) and the author's Keep, Part reload and power cycle. The qualification record is written from that procedure.
  3. Stale figures: the README's trial flags are Grainbox's own (--cycles 408 --state 130), and TESTING.md's cost line matches evidence/performance.json (407.9, 1.30x).

The engine and package are unchanged (192662ab, as tested). Who acts: nobody yet: it waits behind Glitchbox and Loopbox. Ran on a unit: yes, 192662ab.


Generated by Claude Code

repeat98 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@jrs1717 thanks, everything from my last two comments is in on ade6095b: the Analog BD conflict, limitations, resources and proof_note that say what ran, and figures that match evidence/performance.json. The checks are green, and the engine and package are still 192662ab, the build your record covers, so nothing changes in how it sounds.

One thing is left, and it's text: the end of the description still describes the first prototype. It says Ran on a unit: not yet, "Not tested on a unit: a first prototype", and its edge-case table lists both cores and eight instances as "not run yet" (with 123 state words). Please replace that part with the "For the pull request" lines and the edge-case table for 192662ab from TESTING.md, and take Fuzzbox out of the queue line, since it has merged.

Who acts: you, on the description. Ran on a unit: yes, 192662ab: the test procedure and your own stage. Next step: after that, Grainbox waits its turn behind Glitchbox and Loopbox. Then it gets the listing and pr:ready, and you mark it ready.

A small quote to fix while you're there

README line 3 and tests.summary quote "everything survived" for 192662ab. That's what you said about 7ee24439 (TESTING.md line 126). For 192662ab, TESTING.md line 66 has "Everything power cycled fine, sounds great". Use that one, or leave the quote out.


Generated by Claude Code

…ine, sounds great"), and the persistence row filled from their stage

Text only; the engine and package are still 192662ab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrs1717

jrs1717 commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

@repeat98 done on 27a39b1, text only (the engine and package are still 192662ab):

  • The description: its end now has the "For the pull request" lines and the edge-case table for 192662ab from TESTING.md, in place of the prototype's "not yet" lines. Ran on a unit says yes, and Fuzzbox is out of the queue line.
  • The quote: README line 3 and tests.summary now quote "Everything power cycled fine, sounds great", which is what I said about 192662ab. TESTING's persistence row for 192662ab was still "not run"; it now records my stage.

Grainbox waits its turn behind Glitchbox and Loopbox.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants