Skip to content

Digitakt II base: the effect slot (core_fx) and the FX page - #2445

Draft
Claptom-music wants to merge 5 commits into
repeat98:base/digitakt-ii-nextfrom
Claptom-music:base/dt2-fx-slot-code
Draft

Claptom-music wants to merge 5 commits into
repeat98:base/digitakt-ii-nextfrom
Claptom-music:base/dt2-fx-slot-code

Conversation

@Claptom-music

Copy link
Copy Markdown
Contributor

The base code for the Digitakt II effect slot, as the owner asked when merging the design (#2146). Up to eight effect modules run side by side on the sound chip as track inserts before the stock sends, and one FX page in the Mixer sets them up.

What a musician gets

  • An Effects page in the Mixer, right after COMP (FUNC + MOD). It lists the installed effects; UP/DOWN chooses one, the TRIG keys light the tracks it processes, knobs A-H set up to eight values.
  • The lit tracks and values are saved with the project.
  • With no effect installed, nothing changes: no FX page, and the sound chip stays stock at the render site.

What changes in the base

  • core_fx table (mk2/fx.h): one struct dt2_fx record per effect; an effect's slot is its place in the table (order bands 10-39 tone and drive, 40-69 time, 70-99 dynamics). core_fx_slot, core_fx_set, core_fx_get.
  • FX page: the base's own Mixer page 37, after COMP, outside the four core_mixer_pages entries (DT2_MIXER_PAGE_CAPACITY 9 -> 10). DT2_FX_OWN_PAGE keeps an effect off it.
  • Mailbox: transfer tail words 0-15 carry FXM1, a sequence number and seven {slot<<8|index, value} pairs a transfer (changes first, then a round-robin refresh). The machine wire (16-66) is also sent while any effect is registered.
  • Sound chip: a fixed dispatcher at the pre-send render site (0x1c18a6) in the base's L2 (0x200c3000-0x200c4000). It calls listen routines 0-7, then process routines 0-7, with I4 at the slot's settings block, and skips a slot with no track lit. The base code bytes are the same for every set; only the sixteen registry slots change.
  • Builder: build.sharc.fx {listen?, process?, cost} in the package contract. It refuses a ninth effect, a record without routines or routines without a record, two effects in one module, and a set over the 60,000 shared budget.
  • Preflight: refuses a module (not the base) that names the transfer's queue pointer 0x400cd48c. ev_audio_frame is narrowed to read-only in the interface and guide.
  • FXS1 project archive (order 20): each effect's values and track mask, matched by tag on load.

Evidence

  • npm run check passed. 79 builder, preflight and assembler tests pass with MODWERK_DT2_STOCK (the owner's OS 1.17, never in the repository).

  • Emulator (coupled ColdFire and sound chip), using a private test effect (FX Probe, GAIN scales lit tracks, never committed):

    • Ten Mixer pages (FX page plus four module pages) step through and wrap to COMP. This was the owner's first check.
    • FX Probe on T1 at 64: T1 x0.5000 (-6.02 dB), T2 sample-identical to stock. Through the FX page: T1 x0.4998, T2 x0.9996 (about 0.004 dB, likely run alignment, not proven).
    • Busiest stock is 342,016 busy instructions a block; the probe on one track adds about 6,000.
  • Unit, Digitakt II, OS 1.17, image 3a3a37c22cb65d13764d238f7dd3c73aff6cd1492b0f5f76d959fa619ca10164 (base 22a85ada built from 67f9c7b, FX Probe 153b44f7). Claptom-music ran it on 30 November 2026, and all eight steps passed:

    • playback unchanged with nothing lit;
    • the FX page after COMP;
    • TRIG 1 halves T1 while T2 is unchanged;
    • knob A follows from silent to full;
    • TRIG 1 again restores T1;
    • the light and GAIN survive Save Project and a power cycle;
    • the stock reverb and delay sends take the quieter T1;
    • FUNC + MOD steps through every Mixer page.

    The last commit only adds docs; the base bytes are unchanged.

Why this is a draft

  • Sidechain Comp still uses its own render path (build.dt2_sharc version 1, tail words 0-10). With this base, the preflight refuses it, and a set with Sidechain and an effect is refused ("Two SHARC plans set the same site"). It moves onto the slot in its own change: a listen routine, a process routine in the dynamics band, core_fx_set, and DT2_FX_OWN_PAGE for its SC and ENV pages. planDt2Render and the version 1 path come out after that. Sidechain is not in the library, so nothing released is affected.
  • Still to do: a cycle count on the unit with all eight slots busy, which sets the 60,000 budget again before the base ships, and the no-track-lit byte comparison against stock in the emulator.

What the guides lacked

The Digitakt II guide said the core has no audio-render hook and that effects wait for the slot. It now says how an effect takes a slot, what its sound-chip routine may touch and that ev_audio_frame only reads. The interface list declares core_fx and its exports. Nothing else.

🤖 Generated with Claude Code

Claptom-music and others added 5 commits November 29, 2026 18:25
The page list puts it after COMP, outside core_mixer_pages' four entries
(capacity 10). Emulator: a test build with the FX page and four stand-in
module pages cycles all ten pages with FUNC + MOD and wraps to COMP.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…patcher

core_fx (mk2/fx.h), core_fx_set and the FXS1 project block (fx.c); the
mailbox in the transfer tail's words 0-15 before ev_audio_frame; the
machine wire also while an effect is registered. The builder places a
fixed dispatcher at the pre-send render site with eight listen and eight
process slots, adds the mailbox routine to the frame receiver, orders
effects as the linker orders core_fx and refuses a set over 60,000 busy
instructions a block. build.sharc takes an effect's routines and cost.

Emulator, private FX Probe test effect (track 1 at value 64): track 1 at
x0.5000 (-6.02 dB) against stock, track 2 sample-identical to stock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
UP and DOWN choose the effect, a TRIG key lights or clears a track, knobs
A-H set the values (twelve counts a step); the page draws the effect's
name, values and sixteen track boxes. Events reach the stock OS unchanged
while the page is not on screen, and FUNC + MOD still moves on.

Emulator, private FX Probe: track 1 lit on the FX page plays at x0.4998
(-6.02 dB) against stock; track 2 at x0.9996.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The base owns the transfer tail (machine wire and effect mailbox), so the
preflight refuses a mod other than the base that names the queue pointer
0x400cd48c, as it refuses the raw +Drive write. Builder tests for effect
parts, core_fx's order, the slot's refusals and the base code being the
same for every set of effects (with the owner's OS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The interface declares the core_fx table and core_fx_slot/set/get, and
narrows ev_audio_frame to reading the transfer. The machine guide says how
an effect takes a slot and what its sound-chip routine may touch. The
proposal records the builder, emulator and unit results (image 3a3a37c2,
all passed on 30 November 2026) and what is still to do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@repeat98

Copy link
Copy Markdown
Owner

Thanks, the effect slot gives the Digitakt II what the Octatrack's effect list gives it, and all eight steps on 3a3a37c2 passing is a good start. With no effect installed neither the mailbox nor the dispatcher goes in, the FX page only takes keys and knobs while it's on screen, and the Digitakt mk1 path is untouched.

Plan for the release: #2204, #2477, this one and #2446 go into base/digitakt-ii-next, then one combined image and one unit round on that exact build. I'd merge this one first (core_fx as table 6, as #2446's interface.json already expects), and #2446 then merges it in; I've asked there for one shared budget and the duplicate const I4. Here, before it goes in:

  1. The budget is declared, not measured. Each package states its own cost, the builder adds those up, and nothing on the unit stops a set that runs over: the sound chip overruns its block and the audio drops. Your own record shows the gap: FX Probe declares 4,000 and measured about 6,000 on one track. Machine players aren't counted either, though the README says players, filters and effects share one budget. Please count players, and say in the guide how an author measures the cost they declare (on the unit, worst case), so the number can be trusted. The all-eight-slots cycle count you listed sets the 60,000 itself.
  2. The base without an effect isn't the base before. base.json always contributes core_fx_archive, so every SAVE PROJECT writes an FXS1 block with count 0. The base also takes a second of the four core_project_archive places, leaving modules two (Chord Arp uses one). Please contribute it only when a set has an effect, since the builder links per set, or say why it must always be there. Either way, please check on the unit that a project saved with FXS1 opens on the released base 948be0c4 and on the official OS.
  3. The design record still describes the proposal. docs/verification/2026-11-25-digitakt-ii-fx-slot.md puts I4 at a context record (mask, values 0-127, block count, playing flag, step samples, 32 buffer pointers), with the mask at index 255 and values 0-7. The code gives 16 settings words, the mask at index 15, values 0-14, and the buffers at a fixed address in the README. MACHINES.md still ends the base's L2 at 0x200c3000. Module authors will write routines from these, so please bring them in line with what was built.
  4. L4 in the dispatcher. It loads I4 but never clears L4, while the frame receiver clears L0-L2 for its receivers. If stock leaves L4 non-zero at the render site, an effect stepping through its settings would wrap. One instruction closes it; please clear it, or confirm from the stock path that it's always 0.
  5. Untrusted packages at link time. readDt2SharcPart accepts a part with both players and fx. The one-effect-not-a-machine rule is only checked when a package is built from its build.json, so please refuse it when a package is read too.
  6. Unit cases on the combined image, beyond the cycle count and the no-track-lit comparison against stock you already listed:
    • two effects at once, checking their order on the sound chip;
    • an effect and a machine module (Morpha) in one set;
    • ten Mixer pages (the unit saw six);
    • a kit or pattern change with tracks lit;
    • a project loaded into a set with different effects (matched by tag);
    • a listen routine.

Pull requests into base/digitakt-ii-next only get the description check in CI, so please paste the npm run check -- --base upstream/base/digitakt-ii-next result for the new head. Mark it ready once these are in.

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