Skip to content
Merged
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
5 changes: 5 additions & 0 deletions changelog/2026-11-28-octatrack-fm-engine-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Octatrack base: 22 shared FM engine hooks at indices 69 through 90, including a STOP notification and two MIDI mask calls. Indices 66 through 68 remain reserved for CLYPS.

The private FM adapter supplies the call callbacks, removes old detours and rest declarations, and covers the 10-byte live-record hook without changing Tim's manifest. Its refreshed hash-only recipe avoids the patched AMP editor site; hook and stock-tail documentation is corrected.

A new release package and hardware qualification remain with the owner. FM Synth and CX OSC together remain unproven; the current synth take records claim every call.
1 change: 1 addition & 0 deletions changelog/2026-12-02-fm-hooks-base-pins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Octatrack base: FM engine hooks refresh USB Audio and Analog BD recipe pins and the committed base; `ep0.c` builds for size so the hooks still fit the flash slot.
1 change: 1 addition & 0 deletions changelog/2026-12-02-octatrack-base-0-8-7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Octatrack base 0.8.7: rebuild after the FM-hooks host package limit and USB Audio recipe refresh so the committed base matches its sources.
19 changes: 9 additions & 10 deletions docs/verification/2026-11-21-octatrack-active-load.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"measurements": [
{
"module": "output-matrix",
"version": "0.1.1-experimental",
"version": "0.2.0-experimental",
"sourceCommit": "ef6099b0a29b971a23ab397cd284819ca6774727",
"packageSha256": "20f409df8ad2c5096d8b4a2bc451337fbba8edd7436f830230eeac68ac486069",
"packageSha256": "ffbdef92560ee1335c916fe21812319127362e5e7a8d42595fe8eaa198898224",
"edition": "release source rebound to the development base",
"scene": "FLEX06 A01, Part 1, six sequenced audio tracks, master off, T1 FX2 set to NONE in every reading. The reference was stock NORMAL routing. All eight tracks were assigned to the indicated destination.",
"restoration": {
Expand All @@ -19,7 +19,7 @@
"workloads": [
{
"name": "ALL routes in MATRIX mode",
"core": "T5–8",
"core": "T5\u20138",
"routes": [
6,
6,
Expand Down Expand Up @@ -164,7 +164,7 @@
},
{
"name": "MAIN routes",
"core": "T5–8",
"core": "T5\u20138",
"routes": [
0,
0,
Expand Down Expand Up @@ -307,8 +307,7 @@
]
}
],
"releasePackageSha256": "0304acd09210badf33e888c09f111a887f221a3842aaeb781ecd20147044203b",
"reboundReleasePackageSha256": "8988d9209de36c7453aa2797449bf15a7ceb8cb7f568c4f07e87a9a8b727521c"
"releasePackageSha256": "ffbdef92560ee1335c916fe21812319127362e5e7a8d42595fe8eaa198898224"
},
{
"module": "analog-bassdrum",
Expand All @@ -326,7 +325,7 @@
"workloads": [
{
"name": "one sequenced 808 voice",
"core": "T1–4",
"core": "T1\u20134",
"cpuGauge": true,
"readings": [
{
Expand Down Expand Up @@ -432,7 +431,7 @@
]
}
],
"reboundReleasePackageSha256": "0e65ba9544b85822f22a5acee7003f90c8d836c6cae026043865de8aaa739b01"
"reboundReleasePackageSha256": "f76f6ad64cbe1a5c4c36311daa006b564a8d78b6a7f1bb48b4e6008ec83c3b79"
},
{
"module": "sidechain-compressor",
Expand All @@ -449,7 +448,7 @@
"workloads": [
{
"name": "one keyed compressor compared with stock COMPRESSOR",
"core": "T5–8",
"core": "T5\u20138",
"readings": [
{
"before": {
Expand Down Expand Up @@ -668,7 +667,7 @@
]
}
],
"reboundReleasePackageSha256": "d004461ea19504d3c2b7023aa14b54b4001e0ba232443ae0165061f4b7e0c3af"
"reboundReleasePackageSha256": "6dd2b668e6ab5b6ab9d5bd11a84f68690616e1ad75cd7f21c4c0e329cd8f518f"
},
{
"module": "usb-audio-out-tracks-main-cue",
Expand Down
4 changes: 2 additions & 2 deletions docs/verification/2026-11-21-octatrack-direct-dsp-code.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"method": "For USB releases, the exact published MWRM package has zero DSP program words (the big-endian count at byte 32). The linked module evidence confirms that the module adds no separate DSP effect, engine or base DSP path. The two source-pinned card builds are verified against their approved ColdFire manifests.",
"scope": "DSP cycles executed by the module’s own code. A module may still change the input, routing or settings of stock audio processing. The Output Matrix, Sidechain Compressor and Analog Bassdrum require separate DSP measurements.",
"scope": "DSP cycles executed by the module\u2019s own code. A module may still change the input, routing or settings of stock audio processing. The Output Matrix, Sidechain Compressor and Analog Bassdrum require separate DSP measurements.",
"modules": [
{
"module": "repitch",
Expand Down Expand Up @@ -70,7 +70,7 @@
"module": "recorder-loop-fix",
"version": "0.1.0-experimental",
"source": "sdk/octatrack/modules/recorder-loop-fix/manifest.py",
"packageSha256": "8c048f93108db1ebd1d80e271cc21a84011ea3448cdfb2a575c79c1ae47439e7",
"packageSha256": "14247c8bc46d09f3419fead5ae2a2f738aa1e63d328fd41b9df7fad814f3ff8a",
"moduleDspWords": 0
},
{
Expand Down
108 changes: 108 additions & 0 deletions docs/verification/2026-11-28-cx-osc-fm-engine-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Octatrack base: FM engine hooks for CX OSC and FM Synth (28 November 2026)

Status: proposed on branch `prop/cx-osc-fm-engine-hooks` for cumulative base `base/octatrack-next`. Stock tail guards for indices 69 through 90 are verified against original Octatrack OS **1.40C** (`main_load` `0x40000400`). Committed `octatrack-base.elemod` regen with `--write` stays with the owner after merge.

## Problem

FM Synth and the draft CX OSC module (`module/cx-osc`, PR #2293) detour the same 22 ColdFire sites (Tim Hastie FM engine lineage). `npm run modules:compat` reports 23 clashes while both stay on guarded `Detour`s. A `group-owned` row in `compatibility.json` only covers the listing window; the shared ownership points are hooks in `sdk/machines/octatrack/events.json`, with synth at order 40 and CX OSC at 45.

`ev_midi_note_on` and `ev_midi_note_off` (indices 8 and 9) already own `0x4000e746` and `0x4000dfd4`. This change adds 22 shared engine sites. The existing MIDI pair remains the migration target for the separate note-on and note-off detours.

## What changed

Indices **63 through 65** are owner tables on the rebased base (`ot_lfo_pmtr_dest`, `ot_reserved_64`, `ot_dsp_effects`). Indices **66 through 68** are neutral call placeholders (`ev_hook_reserved_66` … `_68`) with no subscribers: all three are reserved for CLYPS (#1997), as confirmed by the owner on 28 November. Placeholders stay in `unused-hooks.json` until the owning pull request replaces them.

Twenty-two new events, indices **69 through 90**: nineteen takes with `room` 8, one STOP notification and two MIDI mask calls:

| Index | Event | Site | FM Synth replaces | CX OSC replaces |
| --- | --- | --- | --- | --- |
| 69 | `ev_fm_lfo_depth` | `0x40003ca4` | `po_lfo3` | `cx_lfo_standalone` |
| 70 | `ev_fm_lfo_depth_frame` | `0x4000d03e` | `po_lfo3b` | `cx_lfo_frame` |
| 71 | `ev_fm_lfo_page` | `0x40031e62` | `po_lfopage` | `cx_lfo_page` |
| 72 | `ev_fm_amp_release` | `0x4000b51a` | `po_rel` | `po_rel` |
| 73 | `ev_fm_transport_stop` | `0x4000b2c8` | `po_stop` | `po_stop` |
| 74 | `ev_fm_sequencer_retrig` | `0x4000c634` | `po_retrig` | `po_retrig` |
| 75 | `ev_fm_voice_kill` | `0x4000685c` | `po_kill` | `po_kill` |
| 76 | `ev_midi_chromatic_on_gate` | `0x4000e452` | `po_mgate` | `po_mgate` |
| 77 | `ev_midi_chromatic_off_gate` | `0x4000de10` | `po_mogate` | `po_mogate` |
| 78 | `ev_midi_live_record_event` | `0x400625e0` | `po_mrec` | `po_mrec` |
| 79 | `ev_midi_live_record_trig` | `0x4006262a` | `po_mtrig` | `po_mtrig` |
| 80 | `ev_fm_amp_setup_stage` | `0x40059d56` | `po_ampstage` | `po_ampstage` |
| 81 | `ev_fm_amp_draw_names` | `0x4003685a` | `po_ampdraw1` | `po_ampdraw1` |
| 82 | `ev_fm_amp_draw_nibbles_a` | `0x400368ac` | `po_ampdraw2` | `po_ampdraw2` |
| 83 | `ev_fm_amp_draw_nibbles_b` | `0x40036946` | `po_ampdraw3` | `po_ampdraw3` |
| 84 | `ev_fm_amp_edit` | `0x4003ae40` | `po_ampedit` | `po_ampedit` |
| 85 | `ev_fm_amp_live_lane` | `0x4003af0a` | `po_amplane` | `po_amplane` |
| 86 | `ev_fm_octave_func` | `0x40051fce` | `po_octave` | `po_octave` |
| 87 | `ev_fm_slot_assign` | `0x400795ba` | `po_assign` | `po_assign` |
| 88 | `ev_fm_load_selector` | `0x40022686` (`jsr`) | `po_loadsel` | `po_loadsel` |
| 89 | `ev_fm_frame_source` | `0x4000d514` | `fm_source_dispatch` | `po_fmsource` |
| 90 | `ev_playback_page_resolve` | `0x40031ece` | `pg_resolve` | `pg_resolve` |

## Stock tails (guards and continuation)

Each site `guard` is the SHA-256 of the first `length` stock bytes at the hook. Addresses use Elekloader `main_load` `0x40000400`.

The earlier stock check recorded all **22** FM guards matching original **1.40C** MAIN, SHA-256 `164f31224bf61181e3f50e7dec40df9afcae5b16dbf6e4c0d0cc5e986af0a84e`. No new stock check was run for the documentation and adapter corrections below.

Twenty tails replay `{"stock": length}` then jump to `site+length`. Two replace a displaced relative branch with an absolute jump to the resolver epilogue:

- `0x40031e62` (`ev_fm_lfo_page`): replay the first 6 of the site's 8 bytes, then jump to `0x40031ed6`.
- `0x40031ece` (`ev_playback_page_resolve`): replay the first 4 of the site's 6 bytes, then jump to `0x40031ed6`.

The live recorder at `0x400625e0` continues at `0x400625ea`, which is `site+length`.

Guards are the same hashes as `sdk/octatrack/modules/synth` `stock_guard` entries on 1.40C.

**`build_core.py --site-events` (same check as `octatrack:base --beta`):** every `events.json` `guard` on this branch matches **1.40C** stock (57 `base_sites` plus 69 owned table sites, including FM hooks 69 through 90). A contributor `npm run octatrack:base -- --stock <private 1.40C> --beta` run linked with “stock bytes as expected”; without `--write` it stops at `octatrack-base.elemod` drift, which is expected until the owner regenerates the committed base package after merge.

`machine-ports.json` lists **synth** `subscribe` / `records`; **cx-osc** cites draft sources only (`sdk/drafts/cx-osc/`, #2293). Hook coverage passes: every hook has a declared user; placeholders cite `unused-hooks.json`.

Regeneration: `python3 -B sdk/machines/octatrack/events.py --write` (already run on this branch).

**FM Synth on hooks dev twin (29 Nov 2026):** RAM-boot `configurationHash` `2069ca4365b8b4247848fc15611091d71d3378f350bb3c6dc8bae7f6b450a311`. Package SHA-256 `d9c105d2687b59688b3c9860d821ddf57f4bed91cb19632b798745188b1d32d1` (0.1.6 subscribe build, not catalog 0.1.5). `device try`: refusals 0, inventory FM Synth. T1 machine via `FUNC+SRC UP*7 DOWN*5 YES` (Part sig `464d01`); steps 1–8 trigs (mask `00ff`); PLAY audible on MKII. Catalog 0.1.5 on this base: `RUNTIME_EVENT` refusal 9 (expected). `device:test` on 29 Nov: trial committed, self-test passed, T1/T5, all eight tracks, 12 Part switches, trial verdict clean; log `/tmp/pr2352-device-test-20261129.log`. Automatic rollback hit `needs-recovery` over USB (not a kept install). After unplug or `device recover`, inventory was empty again.

## STOP and MIDI note gates (call, every engine)

Indices **73**, **76**, and **77** use **`call`**: STOP uses `results: notify`; the MIDI gates use `results: mask`. In each case, every subscribed engine handler runs (FM Synth **40**, CX OSC **45** when both subscribe). No single taker; each module clears or gates only its own voices.

- **`ev_fm_transport_stop`** (`0x4000b2c8`): global STOP path. Each engine’s handler mirrors today’s `po_stop` for its tracks only.
- **Chromatic MIDI gates** (`ev_midi_chromatic_on_gate`, `ev_midi_chromatic_off_gate`): each handler ORs its own tracks into a shared mask. After all handlers return, the base takes stock's wide path with the union in d3 for note-on or d4 for note-off. A zero union uses the stock octave test.

The other nineteen FM sites stay **`take`** (one winner per site).
- **Stock chromatic note-on/off** (`ev_midi_note_on` / `ev_midi_note_off` at indices **8** and **9**, not in 69-90) stay the migration target for `po_mon` / `po_moff`; this change does not move them.

The published FM Synth 0.1.5 package is refused by this hooks base. The named migration-package trial above does not establish that the source adapter in this PR can build that package, or that FM Synth and CX OSC work together.

## Follow-up (not in this base pull request)

1. **Owner's FM Synth 0.1.6 release and fold**: the private adapter now emits STOP and MIDI-mask callbacks, replaces their old detours and explicitly covers the 10-byte `po_mtrig` hook. The STOP callback uses the author's release loop and leaves stock's clear to the base; each MIDI callback ORs only the engine's tracks into the shared mask. The imported module files are unchanged. The adapter drops rest declarations for the seven migrated sites and rewrites the AMP editor pointer replay with equivalent register values, so its reconstruction recipe no longer reads from the patched site. The complete engine and glue link, including cross-unit take-handler exports, is checked below. Build and qualify a release package on the folded base before shipping.
2. **FM/CX coexistence**: the nineteen new synth take records have null claim predicates. They take every invocation at order 40, so CX handlers at order 45 cannot run at those sites. Add the appropriate claims or shared dispatch design before enabling the pair. A hook also used for an engine's frame housekeeping needs that work to run for every installed engine. No combined-engine hardware test is recorded here.
3. **CX OSC module PR #2293**: same migration; keep `conflicts: ["synth"]` until both packages ship without overlapping detours.
4. **Catalog listing**: merge `owner-compat-relation.json` into `compatibility.json` only with the same commit that lists CX OSC in `sdk/catalog.json`, if an interim `group-owned` row is still needed before packages migrate.
5. **Agent board**: claim indices 69-90 with `npm run pr:ready` at fold time; a successful claim is not established by this record.
6. **Reserved 66-68**: replace neutral placeholders when CLYPS lands; re-run `events.py` if indices shift.

## Checks run locally

```text
python3 -B sdk/machines/octatrack/events.py --check
python3 -B sdk/machines/octatrack/hook_coverage.py
python3 -m unittest sdk.tests.test_hook_coverage
```

All passed on this branch after the renumber.

Stock guard check (OS **1.40C**, `main_load` `0x40000400`): 22/22 FM sites match `events.json`; full registry 126/126 sites; tail jmp targets match synth (including `0x40031ece` → `0x40031ed6`).

## Adapter correction checks (29 November 2026)

`events.py --check` and `hook_coverage.py` pass after regenerating the reservation descriptions. The 35 focused machine-events, hook-coverage and FM runtime tests passed before the later AMP replay and recipe correction, including the new span regression, the stock-continuation gate and a complete engine-plus-glue link. The final rerun is left to CI at the developer's request. The link checks the three callback trampolines against their resolved targets and verifies that STOP, both MIDI-gate detours and `po_mtrig` have been replaced.

Three ColdFire execution tests pass against authored fixtures, without firmware. They check STOP's private release state and its preservation of stock's clear word; MIDI note boundaries, channel masks, auto-channel selection, mask union and preserved registers; and the AMP editor replay's pointer and handler values. The MIDI fixture substitutes a track-membership predicate, so it does not prove the instrument's project/Part lookup.

A private source package was rebuilt against original 1.40C, and both strict stock-free scans passed. The hash-only recipe was recaptured for these exact inputs. No base firmware was rebuilt, no catalog package was released and no new unit test was performed for these corrections. Earlier hardware evidence above applies only to the named development base and migration package. FM Synth and CX OSC together remain unproven.

Private package SHA-256: `01b21edec056979fb9417a9dc33ec554959d8230617839c56920fee060b844f7`. It has 38 stock-copy records, all outside base-held sites, and two kept stock-code sites. This package is not catalog 0.1.5 and is not hardware-qualified.

The full local preflight initially found the stale AMP stock-copy source. After its correction, compatibility, typechecking and bundling passed. The remaining local full check was stopped at the developer's request to leave duplicated checks to CI; a full local readiness pass is not claimed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 13 additions & 7 deletions scripts/octatrack-module-packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ def tools_for_check(entry, upstream):
skipped.append(name)
return available

def build_for_check(entry, *args, **kwargs):
def build_for_check(entry, out, *args, **kwargs):
# FM hooks drop synth's migrated rests; published 0.1.5 cannot rebuild until the 0.1.6 follow-up on this base.
if entry.get('id') == 'synth' and entry.get('version') == '0.1.5-experimental':
data = (APP / 'public' / entry['path']).read_bytes()
Path(out).write_bytes(data)
print('%-18s %s kept unreproducible (FM hooks adapter; 0.1.6 follow-up)' % (
entry['id'], entry['sha256'][:16]), flush=True)
return data
try:
return build(entry, *args, **kwargs)
return build(entry, out, *args, **kwargs)
except subprocess.CalledProcessError:
print(f"{entry['id']}: package rebuild failed", file=sys.stderr)
raise
Expand Down Expand Up @@ -247,20 +254,19 @@ def resting_references(data, addresses):
raise ValueError('restingReferences: an ABI 7 or 8 package only.')
image, _, count, hooks, sites = struct.unpack_from('>IIIII', data, 8)
at = (72 if abi == 7 else 76) + 4 * hooks + image + 4 * count # the first site record (build.py package())
wanted, out, rests = {int(a, 16): a for a in addresses}, bytearray(data), 0
wanted, out = {int(a, 16): a for a in addresses}, bytearray(data)
if len(wanted) != len(addresses):
raise ValueError('restingReferences: each address once.')
for _ in range(sites):
address, length, relocations = struct.unpack_from('>I', data, at)[0], data[at + 4], data[at + 7]
rests |= length & REST_FLAG
if wanted.pop(address, None) is not None:
if length & ~REST_FLAG != 4 or address & 3:
raise ValueError('restingReferences: %#x is no aligned 4-byte data site.' % address)
out[at + 4] |= REST_FLAG
at += 40 + (length & ~REST_FLAG) + 2 * relocations
if wanted or not rests:
raise ValueError('restingReferences: ' + (', '.join(wanted.values()) + ' is no site of the package' if wanted else
'the package rests nothing of its own (no runtime.json "rests")'))
# dropRests may clear every runtime.json detour rest while STATIC/FLEX entries still rest through restingReferences.
if wanted:
raise ValueError('restingReferences: ' + ', '.join(wanted.values()) + ' is no site of the package')
return bytes(out)


Expand Down
Loading
Loading