Repository navigation
Conversation
…next hook is 91 The registry ends at 65 on base/octatrack-next (28 November 2026). The owner keeps 66-68 for CLYPS (repeat98#1997) and confirmed repeat98#2352's 69-90 there. These placeholder tables, shaped as ot_reserved_64, let a hook at 91 follow without a gap; each is replaced in place when its owner lands, and the whole commit drops if repeat98#2352 folds first.
…ap (repeat98#1145) The base owns the project's shared scale (elekloader/scale.c): SEQUENCER rows SCALE (OFF or one of the 52 catalogue IDs), ROOT, TRACK and FOLLOW before any module's; a '#MODWERK_SCALE=1:scale:root:audio-off:midi-off' line in project.work through fxmap.c's seams (staged on the storing pass, in force when the load succeeds); an 'MWSC' record in battery RAM (0x100f8f28-0x100f8fb0, battery-ram.json). ev_project_new resets it first ("base" handler in events.json, events.py). ev_scale_snap (91, the next free index on 28 November 2026; it follows merge order) is a base accessor: a module raises it as any raised event and its raise entry tail-calls modwerk_scale_snap_track(track, pitch), which reads one word. Audio tracks pass semitone raw (64 the untransposed note), MIDI tracks MIDI notes; SCALE OFF, FOLLOW OFF or an out-of-range input comes back unchanged. To the package builder an accessor is a raised call event, so build.py and every recipe pinning it stay as they were; the loader and the site refuse a subscription to it. Saved projects keep their scale: Scale Quantizer's and FM Synth's '#SEQUENCER_SCALE' lines, and on the first boot their bytes in the stock settings block, are read once through modwerk_scale_from_quantizer. A '#MODWERK_SCALE' line this base cannot read (a newer version, or damaged) plays no scale, shows NEWER or BAD, and is written back as it was. Draft limit: published Scale Quantizer and FM Synth keep their own 24-scale state, so a base with ev_scale_snap refuses to install them at PREPARE and SWITCH (removal allowed) until their updates read the base's (owner, repeat98#1145, 24 November 2026). Tests: test_scale.c and test_fxmap_scale.c on the host, the ColdFire build under Unicorn through a module's raise slot, the admission guard, registry and builder checks (sdk/tests/test_base_scale.py).
… can link it The base links every .text before every .rodata, so modwerk_scale.s's 16-bit PC-relative lea to its .rodata table spanned 74 KB and the base link refused it. The code now reads a 32-bit PC-relative offset word beside it (R_68K_PC32, which the base link, ld and runtime packages all resolve) and adds it: no absolute reference, the same bytes at any address, the same snap (test_shared_scale.py's note-for-note runs). test_scale.c's plain line no longer spells a stock project-file key.
…changed) The new hooks change the event header both records pin; the packages rebuild byte for byte (test_runtime_loader's published-package rebuild).
The beta base with the shared scale packed to 851,836 bytes, 124 more than a flash slot holds. scale.c and scale_state.c now build for size, as the other files nothing times (SIZE_OPTIMIZED), and the TRACK and ROOT rows' names lose their pointer tables: 1,141 bytes less code.
…base does; tidy the browser kinds table
|
Thanks Tim, this is careful work, and it follows what we agreed on #1145.
Next step is yours: run tests 1 to 7 on your MKI on the exact development twin, put the results and the build in the description, then run |
|
Hi @timhastie, an update from the other side of the base, so you know what to expect. Where it stands: the hook shape and the draft guard are settled (my 30 November comment). The branch now conflicts with What I'll need when #2352 is in (I'll ping you here):
One question only you can answer. #2352 moves FM Synth onto the new hooks, and FM Synth 0.1.6 (detours off, the same engine) is set to ship with that base from our side. FM Synth is yours, so:
Base roomWith #2352 the base has 848 container bytes free, and this change needs about 3.5 KB. As I said, I'll make the room at the fold. You don't need to cut anything. Generated by Claude Code |
|
@repeat98, thanks. Yes, FM Synth 0.1.6 with the detours off is fine to ship with that base. I'll follow with my own FM Synth update that reads the base's scale, so it's ready before #2415 leaves draft. Now that #2352 is in, I'll merge base/octatrack-next, drop the 66 to 90 placeholders and keep 91, then run tests 1 to 7 on my MKI and put the results and the build in the description. |
|
Hi @timhastie, thanks for the merge and the MKI run. Where it stands: the base's SCALE, ROOT, TRACK and FOLLOW rows, the saved What's broken: nothing in your change. Who acts: you, next. As you said, this stays a draft until your Scale Quantizer and FM Synth updates read the base's scale. One question before you start those, since only you can answer it:
Next step: your answer here, then the two updates as their own pull requests, then the guard change on this branch. Nothing has to run on your unit again for that until the guard changes. Checked on this pass
Generated by Claude Code |
The base now keeps the project's SCALE, ROOT and FOLLOW, and any module can ask it to snap a note with one call,
ev_scale_snap(track, pitch). Projects saved with Scale Quantizer or FM Synth keep their scale. Merged withbase/octatrack-nextafter #2352. Draft: published Scale Quantizer and FM Synth are refused on this base until their updates read its state, as agreed on #1145.Related to #1145.
What was wrong or hard: Scale Quantizer and FM Synth each keep their own 24-scale SCALE, ROOT and FOLLOW, so a module that wants to play in the project's scale has to depend on one of them. You asked for the scale in the base, wired to the saved settings, with one "snap this note for this track" event (#1145, 21 Nov).
What this changes:
machine_registry.c.#MODWERK_SCALE=1:scale:root:audio-off:midi-off, through fxmap.c's existing project-file seams (staged while loading, kept only when the load succeeds). Battery RAM keeps them across a power cycle or RAM boot (MWSC, a new base range inbattery-ram.json, 0x100f8f40-0x100f8fc8). No new stock site.ev_scale_snap(track, pitch): tracks 0-7 take semitones (64 is the untransposed note), tracks 8-15 MIDI notes. It answers the nearest note in the scale, the lower one on a tie, 0-127, and leaves the note as it is for SCALE OFF, FOLLOW OFF or an out-of-range input. It is a new accessor kind: the base provides it and a module can only call it. The loader and the site refuse anything but a zero raise slot on it.ev_project_newgets a base handler, so PROJECT > NEW and the start of CHANGE or RELOAD reset to OFF, C, every track following, as Scale Quantizer's defaults did.#SEQUENCER_SCALE,ROOT,AUDIO_SCALE_OFFandMIDI_SCALE_OFFlines go through the shared table from Improvement: a shared scale file for the Octatrack SDK, with its host test #1631 (modwerk_scale_from_quantizer) once at load; a#MODWERK_SCALEline wins. On the first boot without anMWSCrecord, the base reads Scale Quantizer's and FM Synth's saved bytes the same way.#MODWERK_SCALEline from a newer version, or a damaged one, is never guessed: that project plays no scale, the SCALE row shows NEWER or BAD, and a save writes the line back as it was (up to 115 characters). Editing SCALE, ROOT or FOLLOW replaces it.machine_admission_runtime.crefuses Scale Quantizer and FM Synth by module id, so every version (FM Synth 0.1.6 included), at PREPARE and SWITCH on a base withev_scale_snap, because they would play their own scale while the rows show another. Removing them stays allowed, and a saved set that names one restores without it. Before the base ships, their updates have to read the base state (or the base has to cover them by translation), and this guard comes out. Their updates follow as their own pull requests. As I said on this pull request on 4 December, FM Synth 0.1.6 with the detours off is fine to ship with the base; my FM Synth update that reads the base's scale follows it.modwerk_scale.sread its table with a 16-bit PC-relativelea. The base places.rodatamore than 32 KB from its code (74,096 bytes), so the base could not link it. It now reads a 32-bit PC-relative offset word beside the code. The snap is the same, and it still links anywhere.scale.candscale_state.cbuild with-Os(SIZE_OPTIMIZED, beside the base's own list).Index:
ev_scale_snapis 91, the next index after #2352's 69-90 (66-68 are kept for CLYPS). I mergedbase/octatrack-next(bfe926476) once, as you asked: the merge took #2352's 66-90 entries, so the placeholder tables are gone and noot_reserved_66..90is left. Against the base, this branch now adds only hookoctatrack/91, which is claimed on the agent board for this pull request.The merge (
7bcb7b0cc, a merge commit, no rebase): conflicts inevents.json,unused-hooks.json,site-events.jsonand the three generated hook files (taken from the base, 91 added, regenerated withevents.py --write), intest_runtime_loader.py(the base's 66-68 plus 91), inbuild_core.py'sSIZE_OPTIMIZED(both lists kept) and inbattery-ram.json: Output Matrix 0.2.0'sMET_REC(0x100f8f30-0x100f8f32) now sits inside the rangeMWSChad, soMWSCmoved past it to 0x100f8f40-0x100f8fc8 (the same 136 bytes). USB Audio's two reconstruction records re-pin the regeneratedmodwerk_events.hagain.Base size (
node scripts/base-size.mjson the merged head): Octatrack base 0.8.7: 850,956 of 851,712 container bytes, 756 free (largest layout off; MAIN 1,365,375 of 1,572,864). With this change the packed beta base is 854,028 bytes, 2,316 over the flash slot: it takes 3,072. You said you would make the room at the fold, so I have cut nothing.Build tested: development twin
cd84b551(configuration hashcd84b5510d2f775b39b6086fd423707550df982969e677bc9e62c99f0cd37276; MAIN.raw sha2569c782a0206c8bcefa85515b5d8d6f59b2ae7de1fb59fbf91b90cc9aa39d5e511, 1,371,342 bytes) of7bcb7b0cc:build_core.py --devwith the flagsoctatrack-base.mjspasses for--beta, without the controller rows (docs/OCTATRACK_DRIVING.md). It packs 857,644 bytes, 5,932 over the flash slot; unchangedbase/octatrack-nextpacks 854,188 the same way (2,476 over, 64 over without--stream-channel), so no twin of 0.8.7 builds under the slot today. I built it with onlybuild_core.py's slot refusal lifted, for RAM boots (a RAM boot sends MAIN.raw and writes no flash). Everything else in the build ran as it is. It was never flashed.Left to the fold, as you asked on #2352: base identity, rebuilt assets and
requiredBase. Sooctatrack-base.test.tsreports the committed base as stale; that is the one test this branch fails.How I checked it (on
7bcb7b0cc):npm run pr:ready -- --base-branch base/octatrack-next --remote origin --draft: every stage beforetestpasses (prepare, licenses, machines, modules with the Tape Echo gate, elekloader, compat, the three generators, board, lint, typecheck, bundle), and the generators leave the tree clean. Its whole-suite Vitest run was still going after 22 minutes, the zoom-file hang I saw on an unchanged base on 28 November; the only failure it had printed was the stale base. Without the zoom files: 4,252 pass, 1 fail, the stale base. This branch touches no zoom or MIDI file.npm run sdk:check: 880 cases, all pass except the two USB Audio trim tests andtest_usb_midi_shared_framer.py, which need ctypes or Unicorn memory hooks, off on my test computer; they fail the same way on an unchangedbase/octatrack-next.python3 -B sdk/machines/octatrack/events.py --checkandhook_coverage.py: pass.test_runtime_loader.py26 OK (1 skip, the opt-in private firmware case), all published packages rebuild byte for byte;test_base_scale.py9 OK (the ColdFire build under Unicorn through the generated accessor included);test_base_scale_state.py,test_shared_scale.py(9),test_machine_events.py(22, the admission guard),test_hook_coverage.py,test_battery_ram.py,elekloader/test_recipe.py(43): all OK.test_base_scale.pychecks the record at its new address.Emulator rehearsal (emulator results, not hardware):
ot_emu --dspwith the MKI panel on the twin above, no module installed, a project saved with Scale Quantizer.MWSCrecord#MODWERK_SCALE=1:2:0:134:2in the project and its saved copy#MODWERK_SCALE=2:line, RELOAD, SAVE PROJECT, power-upTested on a unit: twin cd84b551, MKI, 4 December 2026: tests 1 to 5 and 7 pass (test 3 without its RELOAD and CHANGE steps, which I did not confirm); 6 not run (no caller yet). The unit ran Modwerk base 0.8.5 (
ddb56b72) from flash and the twin from RAM, three RAM boots, all clean.#MODWERK_SCALE=1:6:5:0:2), power cycle, RAM boot: the rows show them. RELOAD and CHANGE not confirmed on the unit (test 5 shows RELOAD reading the line)2:line shows NEWER after RELOAD; SAVE PROJECT writes it back unchanged in project.work and project.strd; after a power cycle and RAM boot, NEWER with no RELOAD.1:99:0:0:0shows BAD; a scale set and saved makes a normal1:line. Editing FOLLOW on a NEWER project turns SCALE to OFF, as documentedev_scale_snapfrom a real installed callerNothing audible changes yet: no module calls
ev_scale_snapuntil a module's update does.Edge cases
MWSCpast Output Matrix'sMET_RECtest_battery_ram.py(no overlap); emulator: the record written at 0x100f8f40 at boot, 0x100f8f30-0x100f8f32 untouchedev_scale_snapat every track and pitchevents_test.c, loader, site test#SEQUENCER_linesnpm run octatrack:base -- --beta,base-size.mjsKnown limits:
#MODWERK_SCALEline, so an older base opens it with SCALE OFF.Disclosures:
test_shared_scale.pynow expectsR_68K_PC32instead ofR_68K_PC16, with themodwerk_scale.schange above. Its note-for-note tests are unchanged and pass.modwerk_events.h(the hash only; the images are unchanged), first in their own commit and again in the merge. You can drop or regenerate them at the fold.src/engine/elekloader/module-set.tschanges 4 lines (the accessor's raise slot). The Tape Echo gate passed with it.Who must act: you, at the fold: the room for this change and the base identity. Before release: my Scale Quantizer and FM Synth updates, then the guard comes out.
Guides: the SDK README's shared-scale section, HOOKS.md (generated) and the
ot_sequencer_rowsandev_project_newcontracts now describe the base's scale. What they lacked: the shared scale read its table with a 16-bit PC-relativelea, which links into a module or a card build but not into the base; the README now says how it reaches the table.