Skip to content

Octatrack: a step and trig clock for DSP effects (for Glitchbox, SHRED, Freeze), and one effect or three? #2491

Done

Description

@jrs1717

What I want to build: Glitchbox, an FX2 glitch effect. It captures the track into the FX2 buffer and fires tempo-sized slices back as chops, stutters or pitch-stepped arpeggios, with ACTIVITY setting how often. Author @jrs1717; the plan is on the agent board.

Question 1, timing. docs/module-guides/sequencing.md says to follow the transport, track speed and swing, and never keep a clock of our own. A DSP insert today sees only the tempo word (tempo24). Nothing gives an effect:

  • the step phase,
  • PLAY and STOP,
  • the swing grid, or
  • the moment its track trigs.

Euclid gets these with its own ColdFire detours on the PLAY sites, which a second module can't patch. Two others need the same thing:

Would you take a shared base hook that publishes these per track into the FX parameter block? For example: a step counter and the phase within the step at the track's speed, transport running, and a trig-this-block flag. Until then, Glitchbox would use tempo-length slices that are free-running, the way Ghost Cut does, and move to the hook once it exists.

Question 2, one effect per module. Glitchbox's TYPE switches between CHOP (re-sequence recent slices), STUT (rolls, cuts, reverse) and ARPG (step a slice through pitches). Each has variations A–D: plain, pitch steps, soft fades, and pitch plus bit-crush. All of them replay the same capture ring at tempo-sized lengths, so I read it as one effect with a MODE, like Euclid's TYPE. Do you agree, or should ARPG be its own module?

The design is original: the names and the variations are its own. The techniques are inspired by glitch pedals in general, with no product's code, names or tables.

🤖 Generated with Claude Code

Activity

  1. github-actions commented on Dec 1, 2026

    @github-actions
    Contributor

    Thanks for asking before building.

    1. Timing: yes, a shared base hook is the right way. Three effects need the same thing (Glitchbox, SHRED and Freeze), and a clock that only one module can hold would be a dead end. Please write up what it publishes per track (step counter, phase within the step at the track's speed, transport running, a trig flag) and link it from the agent board. Base work is reviewed by the owner and needs a unit test before it lands. Until it exists, free-running tempo-length slices like Ghost Cut are fine, and the module can move to the hook later. Please don't add a ColdFire detour of your own on the PLAY sites.

    2. One effect or three: one effect with a mode is fine. CHOP, STUT and ARPG all replay the same capture ring at tempo-sized lengths, so that is one effect, like Euclid's TYPE. If ARPG ever needs its own ring or its own signal path, it would become a separate module.

    Please also keep your claim on the board current.

  2. jrs1717 commented on Dec 2, 2026

    @jrs1717
    ContributorAuthor

    Proposal: a shared step clock for DSP effects

    You asked on this issue for a write-up of what a shared step clock would publish per track. Here it is. It would let a DSP effect follow the pattern's steps, swing and trigs without a ColdFire detour of its own. Three effects need it now:

    • Glitchbox (#2492): start glitches on steps, with swing.
    • SHRED: restart its filter envelope on each trig. Its author asked on the board how a DSP insert learns its track was trigged, and the answer was that no flag is documented.
    • Freeze.

    Nothing here is built. It's a proposal for you to review, and the base would own it.

    What it publishes, per track, every 16-sample frame:

    Field Meaning
    Step The track's current step (0 to length - 1), and a running step count that wraps, so an effect can count bars.
    Phase Position within the step, 0 to 1 (Q23), at the track's speed and scale, with the track's swing applied, so a finer grid stays on the swung steps.
    Transport Running or stopped, plus a "started" bit for the first frame after either PLAY path, so every effect resets its phase the same way.
    Trig Whether the track trigged in this frame, and at which sample (0-15), including a trig on sample 0. Muted and unmuted, as two bits.
    Rate The track's speed and scale as one multiplier, so an effect can turn a note value into steps.

    Where it goes:

    • Fixed words in the DSP effect's parameter block, beside the tempo word effects already read at r6+$13, so DSP-only effects can use it with no ColdFire part.
    • The base fills it from the sequencer's own records, the ones ev_play_increment and Euclid already read, once per frame for the tracks that run a subscribing effect.
    • The words and their layout are yours to pick. I haven't chosen any addresses.

    Cost: a few words a track per frame on the ColdFire, and nothing while no installed effect asks for it (it rests like other hooks).

    Glitchbox until then: free-running slices at the project tempo, as you said. Today Glitchbox has TIME on a true note grid up to 1/2, so moving to the hook later only changes where its slice boundary comes from.

    Questions for you:

    1. Is the parameter block the right place, or should it be a separate block the effect is pointed to?
    2. Should the trig's sample offset survive a trig split, where a call holds fewer than 16 frames?
    3. Should it be per track, or per effect slot (FX1 and FX2 of a track would share it)?

    Written by Claude Code in the Glitchbox author's (@jrs1717) session, with their approval.

    🤖 Generated with Claude Code

  3. repeat98 commented on Dec 2, 2026

    @repeat98
    Owner

    Thanks, this is a clear write-up, and SHRED and Freeze can use the same words. Yes to a step clock in the base. Here's the shape I'd like.

    Where it lives: a block of the base's own, not stock's parameter copies. r6 points at stock's copies of the track's frame record. Stock owns that layout and the code that builds it, so words added there would change what every effect gets, stock's included. The base already keeps records the DSP reads per slot (X:$7fb0, MODWERK_DSP_SLOT_RECORDS). Put the clock in a base block beside them, on the core that runs the effect, at an address the base PR picks against the FX2 buffer map. An effect finds its track the way it finds its slot record: (r7 >> 8) & 7.

    Per track, not per slot (your question 3). The timing belongs to the track, and the sequencing guide says to read it once per track even when a module takes both FX slots. FX1 and FX2 of a track read the same words.

    Five words a track, 24 bits each:

    Word Holds
    0 step The track's steps since PLAY, at its speed and scale. Wraps at 2^24.
    1 pos The step within the track's length in bits 0-7, and the length minus one in bits 8-15.
    2 phase The position within the current step, 0 up to just under 1 (Q23), on the swung grid: 0 where the swung step starts, so a finer subdivision stays on the swing.
    3 inc How far phase moves per sample in this step (Q23). The effect follows the step inside the frame without a clock of its own, and a swung pair's long and short steps each get their own.
    4 flags Bit 0 running. Bit 1 started in this frame (either PLAY path). Bit 2 stopped in this frame. Bit 3 a trig started the track's machine in this frame. Bit 4 that trig was muted. Bits 8-11 the trig's sample, 0-15.

    There's no separate rate word. The guide asks for rates relative to the track's speed (1/16 is one track step), and inc gives the step's length in samples.

    Trig splits (your question 2): the words are latched once per frame and never change inside it, like rest in ev_frame_deadline. The trig's sample counts from the frame's first sample, so an effect that stock calls in two parts adds the samples it has already done.

    How the base fills it: at ev_audio_frame_prepare (hook 61). It already runs once per frame, after the sequencer stages its events, and reads the sequencer's own records. That means no new stock site, no ColdFire part in the effect, and no detour on the PLAY sites. It fills only tracks whose live FX1 or FX2 is an effect that asks for the clock, through a small table the effect contributes to. That table takes one hook index: 92 is the next free one after #2415's 91, so please claim it on the agent board first. While no live effect asks, nothing runs.

    If you'd like to build it:

    1. Before writing code, ask SHRED's author and @Jacobphono (Freeze) to read these words, so one layout serves all three.
    2. Open a pull request into base/octatrack-next, cut from that branch. Run npm run pr:ready -- --base-branch base/octatrack-next and quote the node scripts/base-size.mjs line.
    3. Test the sequencing guide's cases on the host: seven track speeds, swing on and off, a tempo change and a pattern change while playing, both PLAY paths, and STOP. Then run it on a unit on the built base and measure its frame cost.
    4. Glitchbox moves to it in its own PR afterwards. Until then, free-running tempo slices are fine, as you have them.
  4. jrs1717 commented on Dec 2, 2026

    @jrs1717
    ContributorAuthor

    A correction to my board reply: I wrote earlier today that the Glitchbox author wouldn't pursue the step clock. They've decided to build it after all, on the layout you gave above.


    Written by Claude Code in the Glitchbox author's (@jrs1717) session, with their OK.

  5. repeat98 commented on Dec 5, 2026

    @repeat98
    Owner

    The questions here are answered and the layout is agreed above. The step clock itself follows as a pull request into base/octatrack-next (hook 92 is claimed on the board), and Glitchbox moves to it in its own PR. Closing this as answered so that PR can carry it from here. Reply if anything changes and I'll reopen.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions