Skip to content

MIDI NRPN (Octatrack): host-tested protocol core (draft) - #2538

Draft
huupsel wants to merge 6 commits into
repeat98:mainfrom
huupsel:module/midi-nrpn
Draft

huupsel wants to merge 6 commits into
repeat98:mainfrom
huupsel:module/midi-nrpn

Conversation

@huupsel

@huupsel huupsel commented Dec 2, 2026 •

Copy link
Copy Markdown

A fix or improvement outside a module? Not applicable; this is a module draft.

A module or module update: MIDI NRPN 0.1.1-experimental by @huupsel (Octatrack, planned OS 1.40C compatibility). The standalone C protocol core now has host tests: per-channel NRPN selection, playback-start and project-load cache resets, 7-bit and 14-bit messages, receive parsing, per-knob scaling and a proposed versioned project list. It is not connected to the base, installable or tested on an Octatrack; no existing instrument behaviour changes.

The planned page has MSB, LSB, size and maximum. A paper check using a 4-pixel character pitch fits every value into four columns; the actual text hook area, font, encoder mapping and legibility remain untested. The Octatrack's 128 knob positions cannot select all 165 values of a 0–164 parameter. A receiver that commits on CC 38 uses 14-bit format even for a maximum of 127. Integration must serialize complete outgoing packets and lifecycle events, connect the playback-start and project-load resets on every output stream, observe other selectors, reset receive state across project/Part changes, and stage and validate the full project list before writing it. Auto channel, CC DIRECT CONNECT routing, MIDI LEARN and message consumption remain to be implemented and tested.

Source is original MIT-licensed module code; no firmware or factory content is included. UI/media and release evidence are not present. The core contains no stock addresses or hook indices. Shared hooks must land before integration or unit trials; #2540 records their design and separate stock traces.

Tested on a unit: Not tested on a unit: the NRPN module is not integrated or built. #2540's stock traces do not test NRPN.

Edge cases

Case Why this change makes it a risk How run Result
NRPN 34, range 0–164 Only 128 positions are selectable and the receiver commits on CC 38 Host C core test Pass: all 128 positions span the endpoints; output ends CC 6=1, CC 38=36 at 164
Selectors and partial messages on separate channels; RPN and reset Stale or cross-channel selection could update the wrong knob Host C core test Pass for tested sequences; actual routing not run
Other sender changes selection or enqueue fails Cached selection could address the wrong parameter Host C core test Pass for explicit invalidation and failed enqueue; integrated serialization not run
Receiver restarts before playback starts or a project loads Receiver forgets its selected NRPN while the sender remembers it Host C lifecycle tests on all 16 channels in both formats Pass: selection is resent on the next value; event hookup and receiver hardware not run
Invalid, newer-version and duplicate project entries A malformed list could corrupt settings Host C core test Pass for line validation and duplicate detection; file integration and transactional save not run
Knob left on CC 0–127, unmapped messages and MIDI LEARN Stock behaviour must remain unchanged Not run: hooks and UI not implemented Not run: no integrated build
NRPN number and value split across a Part change A partial sequence must not set the wrong knob Host parser reset test Pass for explicit reset; actual Part-change integration not run
Four-field page, including maximum 16383 The longest value could overflow its column Paper calculation at 4 pixels per character Pass for proposed cell bounds; actual drawing and unit legibility not run

What the guides lacked or got wrong, and where I fixed it: nothing identified in the guides.

  • Changing a module someone else wrote: its author said yes before I started, and I link it here (a GitHub link, or Discord and the day). Ask the author first
  • I read the guide for its category in docs/module-guides/ (and sequencing.md if it acts in time), and TESTING.md lists what I did not test. An effect module holds one effect.
  • Source and media are mine or properly licensed, with authors and full licence texts kept. Nothing comes from Elektron firmware: no extracted code or tables, upgrade files or factory content, and nothing is modelled on another current Elektron product.
  • Screenshots are real captures of the current module UI. Hardware results are what a named person saw on this exact build; emulator results are labelled as emulator results.

Registered module authors can opt into automatic publication after reviewing all the evidence; a first release leaves both boxes unticked. An update that reaches firmware or hardware addresses the published version did not use goes to owner review instead, and followers hear about an automatic release 48 hours after it goes live:

  • Automatically merge and publish my module update after checks pass.
  • I verified the source, licences, UI and qualification reports, including instance isolation and Part/project/reboot persistence where applicable; no required acceptance check is failed or untested.

Reviewer (an assigned device reviewer or a repository maintainer for a first release, the registered author for their own update):

  • I checked the cycle and memory reports against the worst case, the attributed hardware evidence against the submitted source and build, and the screenshots, tutorial and access steps against the current UI. I read the submitter's test record (the test procedure) against the diff and did not have to test it myself; a missing or unexplained step goes back to the submitter.

Validation commands and results:

  • python3 -B sdk/drafts/midi-nrpn/test_nrpn.py: passed.
  • npm run module:doctor -- --draft midi-nrpn: experimental checks passed; release evidence and an integrated module remain missing.
  • npm run modules:check -- --base origin/main: failed; the changed draft lacks the OT UI access instructions and screenshots required for publication. The UI is not built.
  • git diff --check: passed.

Related to #2540 and #2436.

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

repeat98 commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Hi @huupsel, thanks for sharing the NRPN design early. It's a nice idea, and asking for the base hooks first (#2540) is the right way to do it.

What works: the design and the board claim. What's broken: one check, and it's an easy fix (below). Who acts: you. Next step: fix the scaffold details now. Leave the code until the hooks are settled on #2540.

What to fix
  1. The red check (module-contract): modules:check wants TESTING.md to name the version. Add a line like "0.1.0-experimental: not tested yet, nothing is built". The scaffold leaves this out, so it isn't your mistake.
  2. The version: please make it 0.1.0-experimental, the version a first Octatrack release is listed under. Otherwise the test procedure has to run again when it's renamed.
  3. The manifest: the scaffold's ColdFire defaults don't fit this module yet. Set category to midi-usb (as your description says) and compatibility.location to MIDI tracks. Once the hooks are agreed, add uiClaims for what it takes over: the CTRL1 and CTRL2 SETUP press and the NRPN page.

Generated by Claude Code

@huupsel

huupsel commented Dec 5, 2026

Copy link
Copy Markdown
Author

The CTRL hook design has now passed the requested unit traces and is ready for your review in #2540. Nothing NRPN has run on a unit yet. You previously asked me to leave the code until the hooks are settled there: may I already implement and host-test a standalone NRPN protocol core in this draft, without patching stock sites, claiming hook indices, or testing it on the unit, while the shared hooks wait for the agreed order? I will keep the draft unqualified and wait for your answer before adding code.

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

huupsel commented Dec 5, 2026

Copy link
Copy Markdown
Author

The scaffold now has the requested experimental version, MIDI category, location, planned UI claims and testing line; local module doctor experimental checks and modules:check passed. Nothing NRPN has run on the unit. There is also a proposed design change for review: a per-knob maximum (default 127), mapping the Octatrack’s 128 positions across that range, and output including CC 38 for receivers that commit only on that message. This differs from #2540’s fixed 0–16383 scaling; the exact wire formats, receive routing and MIDI LEARN behavior remain to be settled. The draft stays open while the shared hooks and those decisions are worked out.

@huupsel
huupsel marked this pull request as ready for review December 5, 2026 10:00
@huupsel
huupsel marked this pull request as draft December 5, 2026 10:03
@repeat98

repeat98 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@huupsel thanks, both are good questions.

The protocol core: yes, go ahead. The hook design is settled on #2540, so the module's own code no longer has to wait for the hook order. Write and host-test the NRPN core in this draft: the send side (CC 99 and 98 only when the number changes on that channel, then the value), the receive parser (CC 99, 98, 6 and 38, with an RPN select ending a pending NRPN), the per-knob scaling and the project.work list format. As you said, keep it free of stock addresses, hook indices and unit runs until the hooks are in events.json.

The per-knob maximum: yes, it's better than a fixed 0-16383. Receivers count an NRPN value in the parameter's own range, so a parameter that goes 0-1023 or 0-4 can't be reached cleanly by scaling to 16383. A maximum of 16383 gives you the old scaling back, so nothing is lost. Please keep the 7/14-bit size next to it, though. Some receivers take a 7-bit value on CC 6 alone, while others want it split over CC 6 and CC 38, and the size is what decides which. That makes four fields on the NRPN page (MSB, LSB, size, maximum), so check that they fit before you draw it.

#2540 still describes the fixed scaling. It can merge as it is, because the hooks are the same either way. When you add the hooks to events.json, update its "14 bit" bullet and the scaling line under "Owner's decisions" to the per-knob maximum in that same pull request.

Who acts: you. Next step: the protocol core and its host tests here. It stays a draft until the hooks land.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@huupsel huupsel changed the title MIDI NRPN (Octatrack): NRPN on the MIDI tracks' CTRL knobs, design draft MIDI NRPN (Octatrack): host-tested protocol core (draft) Dec 5, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@repeat98

repeat98 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@huupsel thanks, the core reads well. The selection cache, the 7/14-bit split on receive (a 14-bit knob waits for CC 38, and a later CC 38 on its own still updates it), the RPN and null-NRPN resets, and rounding that lands exactly on 0 and the maximum are all as I'd hoped. Building it with -Werror in test_nrpn.py is a good guard.

One thing to build in while it's still host-only. The sender only sends CC 99 and 98 when the number changes on that channel. If the receiver is switched off and on, or replugged, mid-set, it forgets the selected number. Every turn after that is a bare CC 6 that goes nowhere, until a knob with another number on that channel selects again. Please clear the cache (valid[]) when playback starts and when a project loads, so the number goes out again at the moments a player naturally resets things. Add that to the host tests too.

Who acts: you. Next step: the same as before: it stays a draft until the hooks land.

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

huupsel commented Dec 5, 2026

Copy link
Copy Markdown
Author

The host core now clears the sender selection on playback-start and project-load callbacks, so the next value includes CC 99/98 again. Host tests passed for all 16 channels in both 7- and 14-bit formats. The callbacks are not yet wired to the Octatrack, and nothing ran on a unit; this stays a draft until the hooks land. modules:check -- --base origin/main currently reports the unbuilt UI lacks its publication screenshots and access evidence.

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