Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2026-11-30-digitakt-ii-fx-slot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SDK, Digitakt II base: effect modules get a shared slot. Up to eight effects run side by side on the sound chip as track inserts before the stock sends, through the new `core_fx` table, and one FX page in the Mixer, after COMP, lights each effect's tracks with the TRIG keys and sets its values with knobs A-H; the project saves them. `ev_audio_frame` subscribers now only read the transfer, and the build refuses a module that writes it.
10 changes: 10 additions & 0 deletions docs/verification/2026-11-25-digitakt-ii-fx-slot.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,13 @@ Only Sidechain Comp (`digitakt-ii/dt2-sidechain`, the developer's own module, no
1. Builder tests with the owner's OS (`MODWERK_DT2_STOCK`): no effect leaves section 7 stock. Two test effects build through the same base code bytes, with only slots and records differing. A set over the budget, a ninth effect, or code outside a package's own allocation is refused.
2. Emulator, coupled ColdFire and sound chip. First, before the rest of the FX page code: ten Mixer pages (stock, FX and four module pages) navigate both ways and draw. The stock OS has only been seen with nine; if it has a fixed limit, the FX page needs another home and the design changes. Then, generated 220 Hz tone on T1 as in the earlier records: the dispatcher with no track lit gives PCM byte-identical to stock. A test effect halving T1 gives -6.02 dB on T1 only. Sidechain Comp through the slot matches its 18 November results. The FX page draws, takes TRIG and knob input, and survives a project save and reload.
3. Unit, OS 1.17, exact image named by SHA-256: boot and playback with nothing lit, the test effect on one track and not another, Sidechain Comp's existing checks, settings after Save Project, reload and a power cycle, and a cycle count with all slots busy.

## Results of the base code (29-30 November 2026)

A private test effect, FX Probe (one value, GAIN 0-127, scaling its lit tracks by GAIN/128, cost 4,000), stood in for a real effect. It never enters the repository.

- **Builder:** 79 builder, preflight and assembler tests pass with the owner's OS. Two effects build with the same dispatcher and mailbox bytes as one; a ninth effect, a record without routines, routines without a record, two effects in one module and a set over 60,000 are refused.
- **Emulator, ten Mixer pages:** with the FX page and four test module pages, FUNC + MOD steps through all ten and wraps to COMP, and each draws. The FX page keeps its place after COMP.
- **Emulator, sound:** 220 Hz tone on T1 and T2. FX Probe on T1 at 64: T1 x0.5000 (-6.02 dB), T2 sample-identical to stock. Lit through the FX page (TRIG 1, knob A): T1 x0.4998 and T2 x0.9996 of stock, within about 0.004 dB; not sample-exact, most likely from alignment between the two runs, not proven. The busiest stock moment (all sixteen TRIG keys, FX knobs up) measured 342,016 busy instructions a block before the slot; the probe on one track added about 6,000 in the emulator.
- **Unit, OS 1.17, image `3a3a37c22cb65d13764d238f7dd3c73aff6cd1492b0f5f76d959fa619ca10164`** (base `22a85ada`, FX Probe `153b44f7`), run by Claptom-music on 30 November 2026, all passed: playback unchanged with nothing lit; FUNC + MOD shows the FX page after COMP with FX PROBE and GAIN 64; TRIG 1 lights T1, which then plays at about half volume while T2 is unchanged; knob A follows from silent to full; TRIG 1 again restores T1; T1's 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 back to COMP.
- **Not done yet:** Sidechain Comp through the slot (it still uses its own path and moves in its own change), the no-track-lit byte comparison against stock, and a cycle count on the unit with all eight slots busy, which sets the budget again before the base ships.
15 changes: 12 additions & 3 deletions scripts/build-elemod-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,24 @@ for (const machine of machines.filter(item => item.sdk?.platform === 'elemod'))
for (const target of sites.flatMap(site => 'target' in site ? [site.target] : (site.relocs ?? []).map(reloc => reloc.target))) if (!Object.hasOwn(module.symbols, target) && !module.imports.includes(target)) module.imports.push(target)
module.imports.sort()
if (build.sharc) {
// A Digitakt II machine module's sound-chip player, assembled from its source; the site composes it into section 7.
if (machine.id !== 'digitakt-ii') throw new Error('Only Digitakt II modules carry a sound-chip player: ' + document.id)
// A Digitakt II module's sound-chip part (a machine's player or an effect's routines), assembled from its source; the
// site composes it into section 7.
if (machine.id !== 'digitakt-ii') throw new Error('Only Digitakt II modules carry a sound-chip part: ' + document.id)
const program = assembleSharc(await readFile(await resolveModuleFile(folder, build.sharc.source), 'utf8'))
const players = build.sharc.players.map(player => {
const entry = program.symbols.get(player.entry)
if (entry === undefined) throw new Error(document.id + ': no label ' + player.entry + ' in ' + build.sharc.source)
return { type: player.type, entry }
})
module.build = { ...module.build, dt2_sharc: { version: 2, allocations: program.blocks.map(block => ({ address: block.address, data: Buffer.from(block.bytes).toString('base64'), code: block.code })), players } }
const label = name => {
const at = program.symbols.get(name)
if (at === undefined) throw new Error(document.id + ': no label ' + name + ' in ' + build.sharc.source)
return at
}
// An effect's routines for the base's effect slot (docs/verification/2026-11-25-digitakt-ii-fx-slot.md).
const fx = build.sharc.fx && { ...(build.sharc.fx.listen ? { listen: label(build.sharc.fx.listen) } : {}),
...(build.sharc.fx.process ? { process: label(build.sharc.fx.process) } : {}), cost: build.sharc.fx.cost }
module.build = { ...module.build, dt2_sharc: { version: 2, allocations: program.blocks.map(block => ({ address: block.address, data: Buffer.from(block.bytes).toString('base64'), code: block.code })), players, ...(fx ? { fx } : {}) } }
}
parseElemod(module)
const plan = { schemaVersion: 1, machine: machine.id, id: document.id, version: document.version, release, module, sites, derive: build.derive,
Expand Down
27 changes: 26 additions & 1 deletion sdk/digitakt-ii/core-profile/interface.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"handler": "void f(unsigned int data_bytes, const void *data, unsigned int frame_bytes, const void *reply)",
"order": "lower subscription order first; linker breaks ties by module ID and contribution order",
"room": 4,
"purpose": "The arguments are the original stock transfer arguments and are borrowed for this call. A subscriber may update its own preallocated state and its explicitly reserved DSP frame-tail data words only. Preserve stock data, command words and reply storage. Do not allocate, block or retain the pointers."
"purpose": "The arguments are the original stock transfer arguments and are borrowed for this call. A subscriber may read them and update its own preallocated state only: it writes no word of the transfer, whose tail is the base's (machine wire and effect mailbox). A module sends data to the sound chip through core_fx_set; the preflight refuses a module that names the transfer's queue pointer (0x400cd48c). Do not allocate, block or retain the pointers."
}
],
"tables": [
Expand Down Expand Up @@ -163,6 +163,13 @@
"entry": 4,
"room": 4,
"purpose": "Null-terminated pointers to struct dt2_machine records (mk2/machines.h): track machines added after the seven stock types, each with its own machine type 7-10 (claimed as machine:<type>, saved with kits), the stock type it stands for, its names and its five knob names on the stand-in's parameters. The base lists them in the machine menu, keeps them through kit load, shows their knob names while a page shows that machine and, when the module's package carries a build.sharc player, sends their voices to it on the sound chip through that type's registry slot; without one they play as the stock type they stand for."
},
{
"name": "core_fx",
"since": "1.1",
"entry": 4,
"room": 8,
"purpose": "Null-terminated pointers to struct dt2_fx records (mk2/fx.h): the effects on the sound chip, one per module, in the order band of their kind (10-39 tone and drive, 40-69 time, 70-99 dynamics). An entry's place in the table is its slot. At the pre-send render site, before the stock sends, the base calls each slot's listen routine, then each process routine, of the module's package build.sharc.fx, with I4 at the slot's sixteen settings words (0-14 the effect's, 15 its track mask), and skips a slot whose mask is 0. The base's FX page in the Mixer, after COMP, lists every effect without DT2_FX_OWN_PAGE: the TRIG keys light its tracks and knobs A-H set its values. The base saves the values and tracks with the project, by tag. The builder refuses a ninth effect and a set whose declared costs pass 60,000 instructions a block."
}
],
"exports": [
Expand Down Expand Up @@ -213,6 +220,24 @@
"prototype": "volatile uint32_t core_machine_sample_views (mk2/machines.h)",
"purpose": "Counts the SRC page's sample view as it draws: it changes in every frame composed while the second page shows and in no other, so an ev_draw handler that sees it changed since its last call may draw over the sample view of the current track. Read-only."
},
{
"name": "core_fx_slot",
"since": "1.1",
"prototype": "int core_fx_slot(const struct dt2_fx *fx) (mk2/fx.h)",
"purpose": "The slot of an effect's own record in core_fx, or -1 when it is not there."
},
{
"name": "core_fx_set",
"since": "1.1",
"prototype": "void core_fx_set(unsigned int slot, unsigned int index, uint32_t value) (mk2/fx.h)",
"purpose": "Sets settings word index (0-14, or DT2_FX_TRACKS for the track mask) of the module's own slot on the sound chip, from the UI task. The base sends changes first, then every word in turn in the transfer's tail, so the sound chip catches up after a load. The FX page sets the values and the mask of the effects it shows; an effect with DT2_FX_OWN_PAGE sets its own."
},
{
"name": "core_fx_get",
"since": "1.1",
"prototype": "uint32_t core_fx_get(unsigned int slot, unsigned int index) (mk2/fx.h)",
"purpose": "The value core_fx_set last set for that word (0 before any). Read-only."
},
{
"name": "core_store_conflicts",
"since": "1.1",
Expand Down
7 changes: 4 additions & 3 deletions sdk/machines/digitakt-ii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ By the core's documentation (emulator-tested, not hardware-tested), both data ar

**Linked voices are the base's.** SETTINGS > VOICES lets a lead track play its notes on the tracks after it, for every machine, stock or added ([VOICES.md](elekloader/modwerk/VOICES.md)). A machine module that wants polyphony relies on it and never allocates voices across tracks itself; a voice track plays its lead's machine, and the machine wire gives it the lead's type.

The Digitakt II core does not start DTIM0 and exposes no audio-render hook yet ([proposal and emulator measurements](../../../docs/verification/2026-11-10-digitakt-ii-pre-send-render.md)). Audio is rendered by the separate SHARC DSP; these hooks are not sample-accurate.
The Digitakt II core does not start DTIM0 and exposes no audio-render hook; the base's effect slot below is the way in ([proposal and emulator measurements](../../../docs/verification/2026-11-10-digitakt-ii-pre-send-render.md)). Audio is rendered by the separate SHARC DSP; these hooks are not sample-accurate.
The [guarded render probe](../../../docs/verification/2026-11-14-digitakt-ii-render-probe.md) records the local OS 1.17 build and dispatcher test.
**Effects wait for the base's effect slot.** An effect module (delay, reverb, drive) does not patch the render site: the [effect slot proposal](../../../docs/verification/2026-11-25-digitakt-ii-fx-slot.md) gives every effect, Sidechain Comp included, a slot in the base table `core_fx` with track inserts before the stock sends and one shared FX page in the Mixer. The owner approved its design on 26 November 2026; the base code follows.
**Effects take a slot in the base's `core_fx`.** An effect module (delay, reverb, drive) never patches the render site or writes the transfer to the sound chip. It contributes a `struct dt2_fx` record (`mk2/fx.h`) to `core_fx` and names its sound-chip routines and worst-case cost in `build.sharc.fx` (`{ "listen": "label", "process": "label", "cost": 4000 }`). The base calls them as track inserts before the stock sends, and its FX page (Mixer, after COMP) lights tracks and sets up to eight values for every effect ([design](../../../docs/verification/2026-11-25-digitakt-ii-fx-slot.md)). A routine starts with `I4` at its slot's sixteen settings words (word 15 is the track mask, bit t for track t + 1) and processes track t's 32 left and 32 right floats at `0x252df8 + 0x100 * t`. It may change R0-R15, I0-I2, I4, M4-M6 and L0-L2, keeps every other register, and returns with `RTS`. Effects, machine players and filters share one budget of 60,000 instructions a block, each counted over the stock work it replaces.
**Filters wait for the base's filter types.** A filter module does not patch the per-voice filter on the sound chip: the [filter-type proposal](../../../docs/verification/2026-11-25-digitakt-ii-filter-types.md) lists module filters after the stock types on the FLTR page (base table `core_filters`), each standing in for a stock type's knobs and movement. The owner approved its design on 25 November 2026; the base code follows.

The proposed Mixer and frame interfaces are declared in [core-profile/interface.json](../../digitakt-ii/core-profile/interface.json).

| Interface | Timing, order and room | Arguments and permitted writes |
| --- | --- | --- |
| `core_mixer_pages` | The UI reads the collection when building the Mixer cycle and draws the active registered page. Up to four entries follow COMP, lowest contribution order first. Ties use module ID and contribution order. | Each entry points to a native page descriptor and `void draw(void *view, void *bitmap)`. Draw into the supplied bitmap and update module-owned state. The borrowed view and stock navigation state are read-only. |
| `ev_audio_frame` | ColdFire calls up to four handlers immediately before the stock DSP transfer. Lower subscription order runs first. Ties use module ID and contribution order. | `void f(unsigned int data_bytes, const void *data, unsigned int frame_bytes, const void *reply)` receives the stock transfer arguments. Write only module-owned state and explicitly reserved DSP frame-tail data words. Preserve stock data, commands and reply storage. The pointers are valid for the call. Keep the callback allocation-free and nonblocking. |
| `core_fx` | Up to eight effects; an effect's slot is its place in the table, lowest contribution order first (10-39 tone and drive, 40-69 time, 70-99 dynamics). The sound chip runs every listen routine, then every process routine, at the pre-send render site, and skips a slot with no track lit. | A `struct dt2_fx` record: tag, name, flags and up to eight values `{name, max, initial}`. Call `core_fx_set(slot, index, value)` and `core_fx_get` from the UI task. `DT2_FX_OWN_PAGE` keeps an effect off the FX page so it can draw its own pages. The base saves values and tracks with the project. |
| `ev_audio_frame` | ColdFire calls up to four handlers immediately before the stock DSP transfer. Lower subscription order runs first. Ties use module ID and contribution order. | `void f(unsigned int data_bytes, const void *data, unsigned int frame_bytes, const void *reply)` receives the stock transfer arguments. Read them and write only module-owned state: the transfer's tail is the base's, so send data to the sound chip through `core_fx_set`. The preflight refuses a module that names the transfer's queue pointer. The pointers are valid for the call. Keep the callback allocation-free and nonblocking. |

Find a screen from the frame the OS has just drawn, not from UI object pointers: digikit fills some that stay 0 on the unit (the view controller's page set at `+0x9c` on OS 1.17), so a mod that follows them works in the emulator and never on hardware. [Track Names](../../digitakt-ii/modules/track-names/) recognises the mixer this way.

Expand Down
33 changes: 32 additions & 1 deletion sdk/machines/digitakt-ii/elekloader/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"../modwerk/project-archive.c",
"../modwerk/project-kitdata.c",
"../modwerk/mixer.c",
"../modwerk/fx-page.c",
"../modwerk/fx.c",
"../modwerk/mixer-entry.s",
"../modwerk/machines.c",
"../modwerk/machine-knobs.c",
Expand All @@ -59,6 +61,21 @@
"event": "ev_settings",
"fn": "core_voice_settings",
"order": 10
},
{
"event": "ev_draw",
"fn": "core_fx_page_after_draw",
"order": 10
},
{
"event": "ev_enc",
"fn": "core_fx_page_enc",
"order": 10
},
{
"event": "ev_key",
"fn": "core_fx_page_key",
"order": 10
}
],
"contribute": [
Expand All @@ -74,6 +91,19 @@
0
]
]
},
{
"to": "core_project_archive",
"order": 20,
"data": "00000000",
"relocs": [
[
0,
"abs32",
"sym:core_fx_archive",
0
]
]
}
],
"defsym": {
Expand Down Expand Up @@ -339,7 +369,8 @@
"core_mixer_pages": 4,
"ev_audio_frame": 4,
"core_project_archive": 4,
"core_machines": 4
"core_machines": 4,
"core_fx": 4
}
},
"dev": {
Expand Down
Loading