Skip to content

Freeze 0.1.0 (draft): a grid-locked, tape-like live loop on FX2 (needs a delay-ring hook) - #1971

Draft
Jacobphono wants to merge 6 commits into
repeat98:mainfrom
Jacobphono:claude/octatrack-freeze-effect-92661b
Draft

Jacobphono wants to merge 6 commits into
repeat98:mainfrom
Jacobphono:claude/octatrack-freeze-effect-92661b

Conversation

@Jacobphono

@Jacobphono Jacobphono commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Freeze (draft): a tape-like live loop on FX2, locked to the track's steps

A new, original Octatrack effect in sdk/drafts/freeze/. It holds the last seconds of a track and plays them back slower and lower, like tape, in a loop that repeats every 1 to 8 of the track's own steps. Odd lengths (3, 5, 7) drift against a 16-step pattern, and two tracks with different lengths run independently.

Status: not runnable. The engine and its host tests are here. The base hook it needs is not, and that needs an owner decision (below). Nothing has run in ot_emu or on a unit. Ghost Cut (#1935) and Tape Echo are untouched, and Freeze does not depend on either.

What is in it

  • freeze.c / freeze.h: freestanding fixed-point C engine with no floats, heap or runtime calls. It uses the stock per-track 4 s delay ring.
    • With GRAB off, the track passes through bit for bit while its dry signal is recorded into the ring.
    • GRAB holds at the next track step, writes the ring's own frames back so history survives, and reads the held audio with a tape head.
    • Each held cycle finishes on its latched STEP length. Turning STEP during the cycle takes effect at the next boundary. A second head reads the audio just before the loop start and crossfades in, so the period is exactly STEP steps.
    • Steps come from the track's sequencer tick byte (0x800064f0 + track), so tempo, track speed and swing follow the sequencer. There is no clock of Freeze's own.
  • Controls:
    • Page 1: STEP 1-8 (5), SPIN 0.25-1.0x (0.5x; FUNC stops 0.25/0.5/1.0), JTR, POS, GRAB OFF/HOLD, MIX.
    • Page 2: FADE, SEAM.
  • test_freeze.c, verify.py, test_freeze.py: host gate with a simulated ring (written 16 frames a block like the stock DMA) and a simulated track sequencer (ticks per track speed, swing as a delayed tick).
  • DELAY_HOOK_PROPOSAL.md: the shared hook Freeze needs.

Owner decision needed: a shared hook for the stock delay ring

Tape Echo takes the delay routine's seam (0x4000361a, and 0x40002f44 for reset) with its own detours. The base also patches three other places in the same routine (status.s). A second module cannot take the same seam, and the ring is naturally shared per track by FX2 id. The proposal:

  • ev_delay_track (62): a call hook at 0x4000361a that passes one record (track, FX2 id, knobs, ring, write frame, audio, record, tempo, run flag, tick, scale). The first handler to return nonzero takes the track. The base does the stock scratch-buffer toggle, accumulator clear, filter-iterator step and rejoin.
  • ev_delay_reset (63): a notify hook at 0x40002f44.

Tape Echo would keep its detours under a pending-migration entry until its author moves it. Nothing here edits Tape Echo or the base. Details and open questions (page-2 knob bytes at the seam, swing on the tick byte, USB effect ids, CPU) are in the proposal.

Tests

python3 -B sdk/drafts/freeze/verify.py: 65 of 65 checks pass under -fsanitize=undefined,address. m68k-elf-gcc with Tape Echo's flags (-mcpu=54454 -O3 -ffreestanding ...) builds 6,116 bytes of text with no undefined symbols. npm run module:doctor -- --draft freeze: the experimental lines and host tests are green. The listing lines (catalog, packages, CPU price, hardware) are not met yet.

Check Result
lerp/mulq15 over INT32_MIN..INT32_MAX within 4 / 1 LSB, no UB
GRAB OFF bit-exact dry, ring receives the dry input
Period N = 1, 3, 5, 7, 8 (120 BPM), 5 at 90 BPM, 5 at 2x, 3 at 1/2x cycle vs next cycle 1.000; at half the period at most 0.06
5-step and 7-step tracks together 7 and 5 cycles in 35 steps
STEP 5 to 2 after the first held step first and second boundaries at steps 5 and 7; new length latched at first boundary
STEP 2 to 5 after the first held step first and second boundaries at steps 2 and 7; new length latched at first boundary
SPIN 0 / 64 / 127 on 1 kHz 250.6 / 501.1 / 999.6 Hz
JTR 127 490-510 Hz wander, period unchanged
POSITION, full 4 s ring at 30 BPM no read past the held history; 2.36 s range
Swing 25 %, tempo 120 to 90 cycles count track steps; next period exact
10 s hold ring history bit-identical
Release / STOP / dirty entry back to exact dry / fades to dry / no garbage reached the output
Grab, seams, SPIN/POS/STEP moves, release on a 110 Hz sine no step larger than the sine's own

Not tested: ot_emu, hardware, CPU cost, fx:audit, stock flows. Known sound limits: linear interpolation dulls the highs at fractional SPIN, and the seam lifts correlated audio up to 2.8 dB.

A finding on the behavioural reference this brief started from (written by Codex, not in the repository): its two heads half a period apart with sin² gains repeat every half period (correlation 1.000 at both P and P/2 on its own model). Freeze repeats only at P.

Edge cases

Case Why this change makes it a risk How run Result
STEP 5 to 2 after the first held step The live knob used to end a five-step cycle at step two, before its planned seam. test_step_change(5, 2) in the sanitized host gate; inspect both cycle boundaries and the new latched period. Pass, host: boundaries at steps 5 and 7; the two-step setting applies only to the second cycle.
STEP 2 to 5 after the first held step The live knob used to extend the current cycle beyond its planned seam. test_step_change(2, 5) in the same gate. Pass, host: boundaries at steps 2 and 7; the five-step setting applies only to the second cycle.
Short and long cycles, track speed and tempo A changed length can exhaust the held ring or drift off the track grid. Host period tests at 1, 3, 5, 7 and 8 steps, 90/120 BPM and 2x/0.5x track speed; full-ring test at 30 BPM. Pass, host: consecutive cycles correlate at 1.000; the full-ring test stays in bounds.
STEP change with the real sequencer, swing and live tempo The host fixture models the tick byte and swing; it cannot prove when the unit emits them. After a shared delay hook and Freeze adapter exist, inspect the tick at the seam in ot_emu, then change STEP during a held loop on the unit at swung and changed tempo. Not run: the base has no shared delay hook; there is no runnable Freeze package.
Two FX2 instances on opposite DSP cores beside stock effects and Tape Echo State and the per-track ring must stay separate, while the stock site belongs to Tape Echo today. Host test with simultaneous five- and seven-step instances; later use the shared hook for a unit trial on two tracks and check stock flows. Pass, host: 7 and 5 cycles in 35 steps. Not run on unit: hook and adapter are absent.
GRAB release, STOP/PLAY, Part/project reload, Undo and power cycle Runtime loop state and the base's package lifecycle may differ from the fixture. Host release and STOP tests; after a package exists, run the test procedure and check the unit's actual playback and restoration. Pass, host: release returns to exact dry and STOP fades out. Not run on unit: no package; Part/project, Undo and power cycle remain untested.
Maximum CPU load and real delay-ring bounds Two read heads and ring preservation add work in the frame interrupt. Host full-ring bounds test; later measure CPU and both cores on the unit at maximum modulation and two instances. Pass, host: held-ring reads stay in bounds. Not run on unit: no adapter or CPU measurement.

What the guides lacked

  • No hook exists for the stock delay ring, which is the only multi-second per-track audio memory, and the guides don't say Tape Echo holds its seam. That is covered by this PR's proposal, not yet in a guide.
  • The track's step and tick bytes (0x800064d0 / 0x800064f0 + t) are documented in OCTATRACK_HARDWARE_TRAPS.md and in Deja Vu. sequencing.md points only to Euclid's PLAY-reset clock, whose PLAY sites a second module cannot patch. A sentence there would help; it will go in its own Docs: PR rather than this module PR.

Credits

Original code by @Jacobphono, written with Claude Code. The idea of jitter that slowly changes a loop comes from looking at a Reaktor ensemble's control descriptions; no Reaktor code, structure, artwork or samples are used. No Elektron firmware, code or tables.

🤖 Generated with Claude Code

Jacob Phono Thiessen and others added 3 commits November 22, 2026 01:27
Original fixed-point engine (freeze.c) for an FX2 loop that repeats every
1-8 of the track's own steps at 0.25x-1.0x tape speed, with JTR wander,
POSITION scrub, GRAB/release fades and exact dry passthrough. Host gate:
53 checks under ASan/UBSan plus a ColdFire 54454 build with no runtime
calls. Not runnable yet: needs the shared delay-ring hook proposed in
DELAY_HOOK_PROPOSAL.md (owner decision). Tape Echo and Ghost Cut untouched.

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

Copy link
Copy Markdown
Owner

Thanks for writing up the delay-ring proposal. I checked the two sites and Tape Echo still owns both of them. A shared base hook is the right place to explore this. Please keep the hook and Tape Echo migration separate from the Freeze module while we settle the interface.

I added one case to the host fixture. Start a five-step hold and turn STEP down to two after the first step. The active loop ends at step two because the boundary check reads the live knob while the seam was planned for five steps. Could you have the active cycle finish on its latched length and apply the new setting at the boundary? A small test for shortening and lengthening a held loop would cover it. Please add the PR’s Edge cases table too, with the host results and the cases that need the hook and a unit.

@repeat98

Copy link
Copy Markdown
Owner

Thanks for fixing the mid-loop STEP change. I reran the host tests and all 65 passed. In both directions (5 → 2 and 2 → 5), the loop finished its original cycle before picking up the new length.

Are the engine and the shared delay-ring proposal ready for review now? Do you feel the host tests cover what you wanted to check before we decide on the hook, or is there a case you’re still working on? I see why the Octatrack trial has to wait for the hook and a runnable package.

Happy to talk through the hook and what to test on the first unit run in the Modwerk Discord.

repeat98 commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Hi @Jacobphono, a short update on the delay-ring hook, because two things have moved since we last talked:

  • Hook indices 62 and 63 are taken now. main has ev_frame_deadline at 62 and ot_lfo_pmtr_dest at 63, and 66 to 91 are held on the agent board. So DELAY_HOOK_PROPOSAL.md will need fresh indices. Claim the next free ones on the board before you write them in.
  • Glitchbox asked for a step clock. In Octatrack: a step and trig clock for DSP effects (for Glitchbox, SHRED, Freeze), and one effect or three? #2491, Glitchbox asks for a base hook that gives DSP effects the step, the transport and trig timing, and it names Freeze. Your record already carries the tick, so the two designs should agree on where a track's step comes from.

The easiest next step is the way #2436 did it: move the proposal into its own Docs: pull request against base/octatrack-next, with the open questions at the end for me to answer. Freeze can stay here, unchanged, until the hook is settled.

Are you still planning to carry this on? If you'd rather pause, just say so. I'd close this draft for now, and you can reopen it once the hook exists.

Who acts: you, @Jacobphono. Ran on a unit: no. It can't run until the hook exists.


Generated by Claude Code

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