Skip to content

Docs: propose base hooks for NRPN on a MIDI track's CTRL knobs - #2540

Merged
repeat98 merged 11 commits into
repeat98:base/octatrack-nextfrom
huupsel:docs/octatrack-midi-ctrl-hooks
Dec 5, 2026
Merged

repeat98 merged 11 commits into
repeat98:base/octatrack-nextfrom
huupsel:docs/octatrack-midi-ctrl-hooks

Conversation

@huupsel

@huupsel huupsel commented Dec 2, 2026 •

Copy link
Copy Markdown
  • What was wrong or hard: NRPN on the MIDI track's CTRL knobs needs shared base sites; a module must not patch sites owned by other modules.
  • What this changes: Proposes the hooks for MIDI NRPN (Octatrack): host-tested protocol core (draft) #2538, records the owner's decisions and unit traces, and explains the existing Midi Mode 2 and MIDI Scenes uses. Corrects the earlier claim that 0x4004ae08 is a CTRL writer: the documented writer is for NOTE SETUP. No hook or module implementation is included.
  • How I checked it: git diff --check passed; npm run pr:ready -- --base-branch base/octatrack-next --eval-agent "Copilot SDK in VS Code (model not reported)" passed, including the assigned replay and 279 tests. Earlier, npm run check failed in test and sdk:check; the targeted test_standalone_recipe_pins.py rerun failed on the unmodified base, as did two of the three named Vitest files.
  • Tested on a unit: Hugo's Octatrack MKII, temporary development base ebc820ab7123f0ef4f9f59c36f9703009e2454ae676f866dab5a1c890462bfde, no other modules: checked incoming CC on the auto channel with CC DIRECT CONNECT on and off, and traced all CTRL1/CTRL2 SETUP encoder turns and presses with unkept counter probes. The successful trials rolled back cleanly; the test Part was restored and checked. An earlier expanded-probe attempt ended after USB suspension and could not confirm rollback; a restart verified the installed base and empty set. NRPN itself was not tested.
  • Edge cases: none, because this change only documents the proposed hooks. The module's MIDI LEARN behavior and the hook placement and writer route remain implementation checks.
  • What the guides lacked or got wrong, and where I fixed it: nothing identified in the guides; corrected this proposal's mistaken site identification.

The owner's decisions and required checks are recorded in the document. Related to #2538 and #2436.

huupsel and others added 2 commits December 2, 2026 16:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

repeat98 commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Thanks @huupsel for asking before building. Putting the shared sites in the base first is the right order.

What works: the doc is clear, says plainly what was read and what ran (nothing on a unit), and has its changelog line. My answer: yes to the hooks, with one condition and an order (below). What's missing: a check of the sites on your unit, and one thing the doc doesn't cover yet: two of the proposed sites are already in use. Who acts: you. Next step: the unit check, then the doc updated with the answers as decisions.

Yes to the hooks. These sites are already shared: the published MIDI Scenes and the Midi Mode 2 draft both send through 0x4009eec8, and Midi Mode 2 also patches 0x4004ae08. If NRPN patched them too, it couldn't be installed beside either, so they belong in the base. The design also follows ev_arp_setup_knob and ev_arp_setup_text, which is how I'd want it.

The condition: confirm the sites on your unit before any hook index is taken. Your doc says plainly that the addresses come from the image and nothing ran yet, so please check, on your Octatrack:

  • whether an incoming CC already moves a MIDI track's knobs (your question 2: a fact to read, not a choice);
  • that 0x4004ae08 is the path for every CTRL1 and CTRL2 row, and where the encoder reaches it;
  • the CTRL2 siblings of the row callbacks.

Write what you saw, and on which build, into the doc.

The order: the base is short on room. After the FM hooks (#2352) and the scale hooks (#2415) it has little left, and I'll make space as those fold in. So the four hooks come after those two, as entries in events.json with their guards and their first subscriber, the NRPN module (#2538).

Your other questions:

  • 3. The NRPN page: draw it through ev_ctrl_setup_text. A base-owned module page can come later, once a second module needs one.
  • 4. Storage: per Part in project.work, as you proposed. Stock keeps the CTRL SETUP bytes per Part, so an NRPN knob behaves like the CC it replaces when you switch Parts.
  • 5. 14 bit: the scaled 7-bit knob now. The full parameter range is useful already, and finer encoder steps aren't worth waiting for.

Please turn "Open questions for the owner" into these decisions, add the site-sharing section below, merge base/octatrack-next in (merge, don't rebase), run npm run pr:ready -- --base-branch base/octatrack-next, and mark it ready. I'll merge the doc then.

Sites already in use
  • 0x4004ae08 (your ev_ctrl_setup_knob candidate): the Midi Mode 2 draft (sdk/drafts/midi-cc-slots) already detours it, as its names_key replay, with a guard in runtime-guards.json.
  • 0x4009eec8 (your ev_ctrl_value_send): Midi Mode 2 calls it, and the published MIDI Scenes module sends through it (CC_TX in scenes.s). A take hook there sees their sends as well as stock's.

Please add a short section that says, for each of these, how the existing user moves to the hook (or is left alone) and what a take on an NRPN knob does to MIDI Scenes' sends. Then the hooks can't break a module that's already out there.


Generated by Claude Code

sandormatyi added a commit to sandormatyi/modwerk that referenced this pull request Dec 3, 2026
Turn the open questions into decisions (site 2 becomes a chain, the filter
before MON, ev_midi_cc at the CC handler's entry with mw_midi_channel_tracks,
midi:cc:<n> as a later gate change, per-project storage in project.work),
name MIDI NRPN (repeat98#2540) as the hook's second subscriber, and list what must
happen before the code commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
repeat98 pushed a commit that referenced this pull request Dec 3, 2026
…atrack base (#2436)

* Docs: propose a shared post-FX2 DSP site and a CC-in hook for the Octatrack base

Site 2 (dsp_track_commit) becomes a chain beside Sidechain's MON commit,
and ev_midi_cc takes the stock CC handler's entry that CC Map patches
today, with a per-track filter as first subscriber of both. Design only.

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

* Docs: record the owner's decisions on the post-FX2 chain and ev_midi_cc

Turn the open questions into decisions (site 2 becomes a chain, the filter
before MON, ev_midi_cc at the CC handler's entry with mw_midi_channel_tracks,
midi:cc:<n> as a later gate change, per-project storage in project.work),
name MIDI NRPN (#2540) as the hook's second subscriber, and list what must
happen before the code commits.

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

---------

Co-authored-by: sandormatyi <9422137+sandormatyi@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@huupsel

huupsel commented Dec 3, 2026

Copy link
Copy Markdown
Author

I need to correct my earlier reading before claiming any hook index: MIDI_TRACKS.md identifies 0x4004ae08 as a NOTE SETUP writer, not a CTRL SETUP writer. Midi Mode 2 detours it for its track-name editor. My earlier PR text calling it the CTRL encoder path was wrong. I am checking the actual CTRL paths; the required unit checks have not run yet. I will update the proposal and keep this distinction explicit.

@huupsel
huupsel marked this pull request as draft December 3, 2026 18:34
huupsel and others added 2 commits December 3, 2026 19:34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel

huupsel commented Dec 3, 2026

Copy link
Copy Markdown
Author

The decision and site-sharing updates are pushed, and I merged base/octatrack-next. The unit checks are still blocked: the MKII answers on release base ddb56b72… without development requests and has a saved set of 14 modules, including MIDI Scenes and Sidechain. We have not located the exact packages or flashed image needed for the documented restoration plan. I have not RAM-booted or changed the unit. Is there a safe way to verify and restore this set before running the requested checks? The PR remains a draft pending those checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel

huupsel commented Dec 3, 2026

Copy link
Copy Markdown
Author

Update: the MKII is back on its installed base and reports all 14 saved modules loaded; nothing was flashed or saved. The test Part matched its original bytes before the restart. The input test is inconclusive, and the PR stays a draft: I sent CC7 value 23 on channel 1 while the enabled MIDI track CC7 knob was at 107; it stayed at 107, but I could not independently confirm that the unit received the message or that the input routing allowed it. I recorded this and the development base identity in the doc. I also have not traced the CTRL callbacks on the unit, and have claimed no hook indices. Does the base have a safe way to confirm incoming USB MIDI delivery and trace these callbacks on hardware, or a recommended approach for the remaining checks?

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel

huupsel commented Dec 3, 2026

Copy link
Copy Markdown
Author

The incoming-CC check now works on the MKII: stock does move a MIDI-track knob, but the mapping depends on CC DIRECT CONNECT and the auto channel. On development base ebc820ab7123f0ef…, with no modules loaded, MIDI track 1 output on channel 1, auto channel 11 and CC1 assigned CC7, channel 11 CC7 moved that knob with Direct Connect on. With it off, channel 11 CC36 moved it instead. The receive FIFO advanced for each message, and an audio-track CC independently moved its pitch. The doc records values and conditions. The original Direct Connect setting and Part were restored before restart; the installed base reports zero saved and live modules. The CTRL1/CTRL2 callback and encoder paths are still not traced on the unit, so the PR remains a draft and no hook indices are claimed. This also means the proposed receive design needs to account for the auto channel and both modes, rather than only the track output channel.

@repeat98

repeat98 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Thanks @huupsel, that's a useful finding: an incoming CC already moves a MIDI track's knob, and which CC does it depends on CC DIRECT CONNECT and the auto channel. So the receive side has to handle both modes and the auto channel, as you say. Please write that into the design as a decision.

Your question, tracing the CTRL callbacks safely: the base has no ready-made tracer. This is how I'd do it:

  1. A throwaway probe, never part of this PR: a draft whose only job is to count calls at each candidate site (the CTRL1/CTRL2 row callbacks and the encoder path) in its own memory, then call through.
  2. Run it as a RAM trial on the development twin with no other modules, as you did for the CC check, and never keep it. That way it shares the sites with nobody, and a power cycle takes it away; your saved set stays as it is.
  3. Read the counters with mem: while you turn CTRL1 and CTRL2 and edit the rows, and write into the doc what counted, on which build.

Who acts: you. Next step: the callback trace as above. Then the rest of my 3 December list: the decisions, base/octatrack-next merged in, pr:ready, and mark it ready.

huupsel and others added 2 commits December 4, 2026 20:57
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel

huupsel commented Dec 4, 2026

Copy link
Copy Markdown
Author

The RAM-only trace now confirms that all four CTRL1 SETUP encoder turns reach 0x4003a7f4 and all six CTRL2 turns reach 0x4003a700; the corresponding presses reach 0x4003fc44 and 0x4003f71c. This was on my MKII with development base ebc820ab7123f0ef… and no other modules. The probe rolled back, the test Part was restored and checked, and after restart the installed base reported zero saved and live modules. The document records the probe identities and an earlier interrupted attempt as well.

The full route to the writers and the CTRL2 MIDI-learn callback siblings are still unconfirmed. I have not claimed hook indices or tested NRPN, and the PR remains a draft while I work on those checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

repeat98 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Thanks @huupsel, the traces are exactly what I needed.

Where it stands: on your MKII (development base ebc820ab…, no other modules, rolled back cleanly each time) the CTRL1 SETUP encoders reach 0x4003a7f4 and CTRL2's reach 0x4003a700, and the presses reach 0x4003fc44 and 0x4003f71c. That answers my 3 December conditions: where the encoder reaches each page, and the CTRL2 siblings of the row callbacks. You also found the auto-channel and CC DIRECT CONNECT behaviour and wrote it in as a decision. Musically nothing changes yet: this is the design the NRPN module (#2538) will build on.

What's left is not needed for this doc. The MIDI LEARN siblings and the full route from the encoder routines to the writers get settled when the hooks go into events.json. That step needs the OS file, a guard per site and a unit run of the first subscriber anyway, so you don't have to trace further for the design to merge.

Who acts: you, three small things, then I merge it:

  1. In the doc, bring the lines the traces overtook up to date: the Status paragraph and "Sites found in the 1.40C image" still say no address ran on a unit. Move the open items (the MIDI LEARN siblings, the exact take point before the clamp, the route to the writers) into "What comes next" as checks for when the hooks are written. Add one module case there too: MIDI LEARN on a knob set to NRPN writes a plain CC number through the stock writers, so the module has to drop or keep its NRPN entry for that knob.
  2. Update the PR description: "Tested on a unit" still says only the identity and inventory were read.
  3. npm run pr:ready -- --base-branch base/octatrack-next, then mark it ready. It merges cleanly into base/octatrack-next, so you don't need to merge that again.
Checked on this pass
  • The pull request changes only the new doc, its line in docs/README.md and its changelog file. It claims no hook index, and none is needed yet.
  • #2436's ev_midi_cc proposal, which this reuses, is merged into base/octatrack-next.
  • Checks on a0dcbc2da6: the description check passed and nothing is waiting for approval.

Generated by Claude Code

@huupsel
huupsel marked this pull request as ready for review December 5, 2026 07:25
huupsel and others added 2 commits December 5, 2026 08:34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel

huupsel commented Dec 5, 2026

Copy link
Copy Markdown
Author

The design and PR description are updated, and the requested unit traces are recorded. Local pr:ready passed on head 996a944837d48ac8277f9890ed991838cfa0c8ba, including the assigned replay and documentation checks. The PR is ready for review; NRPN itself is not built or tested yet. GitHub marks the current-head PR description workflow action_required, so a maintainer needs to approve its run before that check can finish: https://github.com/repeat98/modwerk/actions/runs/47494828480

@repeat98
repeat98 merged commit 2f1ccbf into repeat98:base/octatrack-next Dec 5, 2026
2 checks passed
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