Skip to content

Improvement: add SNAP alignment to Octatrack sample editor - #1165

Merged
repeat98 merged 53 commits into
repeat98:base/octatrack-nextfrom
twwwy:feature/beat-slicer-snap-base-api
Nov 21, 2026
Merged

repeat98 merged 53 commits into
repeat98:base/octatrack-nextfrom
twwwy:feature/beat-slicer-snap-base-api

Conversation

@twwwy

@twwwy twwwy commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What was hard

Beat Slicer 0.1.68 needs SNAP-aware grid alignment in the Octatrack sample editor. The shared editor service did not expose it, and the SLICE GRID shortcut needs to cycle safely through installed module actions.

What this changes

Adds an optional SNAP alignment mode to the sample-editor API while preserving the ABI-1 prefix and existing non-SNAP behavior. The beta base passes FUNC+AED from stock SLICE GRID through registered grid actions in order and back to stock; with no actions it stays stock. Actions retire their editor token on FUNC/AED before passing the key through.

Joins the cumulative base 0.7.13 (#1910), since 0.7.11 (#1840) and 0.7.12 (#1899) shipped without SNAP. Following the owner's steps:

  1. Merged base/octatrack-next (Octatrack base 0.8: playback admission, saved effects, restore outcomes, stock OS fixes and screen capture, with FM Synth 0.1.5 and Tape Echo 0.1.9 #1910 at 024c677c6) and current main, which carries the shipped 0.7.11 and 0.7.12 (no rebase). Generated base files resolved hunk by hunk to the other side, then regenerated. base-version.json is 0.7.13; base-versions.json keeps the shipped 0.7.11 (seven layouts) and 0.7.12 entries and adds one 0.7.13 entry.
  2. Rebuilt the base with SNAP on top: 0.7.13 4d1b25ebe4a2089604772e79f02cc5828fac91ba9ddcfa9950fbd90f3e00637d: 816,800 of 851,712 container bytes, 34,912 free, +4,432 over 0.7.12 (largest layout off; MAIN 1,335,062 of 1,572,864). The base-bound packages are re-bound to it: Recorder Loop Fix 0.1.0 is regenerated (43d26b27…, which resolves the conflict the owner pointed out); the other rows change only their requiredBase. Because the installer serves a re-bound package from its content address, public/octatrack-base-packages/43d26b27….mwrm is added beside it, as main does for de28d726, and the direct-DSP evidence record (docs/verification/2026-11-21-octatrack-direct-dsp-code.json) now names 43d26b27: both packages are 1,818 bytes with zero DSP program words. Beat Slicer 0.1.68's package is unchanged (195d2b46…) and its release note now says base 0.7.13. The base page's 0.7.13 row is Octatrack base 0.8: playback admission, saved effects, restore outcomes, stock OS fixes and screen capture, with FM Synth 0.1.5 and Tape Echo 0.1.9 #1910's.
  3. Beat Slicer 0.1.68 is in this PR, ported from sdk/drafts/beat-slicer/zero-cross/ into sdk/octatrack/modules/beat-slicer/ (the owner waived the base-and-module warning for this PR). It now includes the base's own modwerk_sample_editor.h instead of the draft's temporary sample_options.h. Package 195d2b46e2620bd15118478aa02d626d6d803692e02c40db4f45a67f6927b643, 5,332 bytes, byte for byte the draft's private build. Version, catalog, controls (encoder C SNAP), README, limitations, release notes and a 0.1.68 TESTING section updated; the 0.1.66 CPU figure is labelled as 0.1.66's.
  4. A base-builder fix found on the way: the package writer stores any run equal to stock as a stock reference, and the tracks layout's configuration hash ended in bytes that, with the zeros after it, matched stock, so baseIdentity refused the package ("The base package has no authored USB identity"). build_core.py now writes the digest back as literal bytes; test in sdk/tests/test_base_trust_storage.py, changelog 2026-11-20-base-identity-literal.md.

How I checked it

  • Base 0.7.13 4d1b25eb built, every USB layout reproduced in the browser builder, bootloader-safety check passed (every change inside a declared site, Startup Menu recovery available; not a boot test).
  • python3 -B sdk/octatrack/modules/beat-slicer/verify.py: host controller tests against the base's sample-editor service (sanitizers, an uncached renderer compared pixel for pixel), the ColdFire package's action record, and the package rebuilt byte for byte.
  • npm run module:doctor -- beat-slicer: green, after the unit run below (performance record, qualification, UI captures and the removal of the 0.1.66 package).
  • npm run pr:ready -- --author twwwy after the merge: pr:ready cannot say Ready on a branch built on the cumulative draft: it diffs against main, so it reports Octatrack base 0.8: playback admission, saved effects, restore outcomes, stock OS fixes and screen capture, with FM Synth 0.1.5 and Tape Echo 0.1.9 #1910's own hook 61 (ev_audio_frame_prepare, claimed by the owner) as this branch's. Against the PR's base, npm run board -- check --base upstream/base/octatrack-next says this branch adds nothing that needs a claim, and npm run check -- --base upstream/base/octatrack-next passed every step but one test, which the direct-DSP record fix above then made pass (the catalog tests, 238, pass). The remaining pr:ready lines are the owner's: module and base in one PR (waived for this PR), and not an automatic author update. Its agent replay (board-holder) passed.

Tested on a unit (an earlier build, kept as that build's evidence, as the owner asked): a development twin of base 0.7.11 with SNAP (source 3055f13f2 with --dev, booted from RAM as 54cab594…), Beat Slicer 0.1.68 195d2b46…, the author's MKII, agent's run on 20 November 2026: device:test passed, then three timed trials without a Keep: SNAP OFF and ON replaces, stopped and playing, NO at the question, FUNC+AED with and without the module, the trial ending with the popup open. Details in Beat Slicer's TESTING.md. Then the author's own test on the same twin and package, a 10-minute trial without a Keep, as reported: with SNAP ON the pops at slice boundaries "noticeably decrease a lot" against OFF; playback stayed smooth during a SNAP ON replace while the pattern played; FUNC+AED cycled stock, CREATE BEAT GRID, stock. Then, on the same twin: an MCP trial ended by an explicit Undo restored the set; the popup's draw costs 198 us a UI tick open (0.1.66: 1,058 us) and 6.3 us closed; 20 popup openings while playing, with STOP and a Part change between, never hung. module:doctor -- beat-slicer is green: performance (key-press record, stamped on source 1d373e42), qualification and UI captures now describe 0.1.68, the captures being the unit's own screens. Not run: the uninstrumented base itself, a Keep and a power cycle; and nothing yet on 4d1b25eb. As the owner asked, the next MKII run (device:test, SNAP OFF/ON, FUNC+AED and Undo) waits for the next cumulative candidate.

One slip during the stress run: a first attempt turned encoder B in each cycle, and where the popup was not open AED's own encoder moved T1 to another sample slot in Part 1's working copy. Part 1 was reloaded (its working and saved copies had been equal), and the run was repeated without encoder turns.

Open: the base's CPU budget refusal counter rose by 3 at each slice replace and FUNC+AED sequence, also with Beat Slicer removed and with nothing reported refused afterwards; not established what it counts there.

Edge cases

Case Why this change makes it a risk How run Result
SNAP ON, then NO at CREATE/REPLACE SLICES? analysis must not start, and no table may be published host test; on the MKII twin 54cab594: NO at REPLACE SLICES? pass: no ALIGNING GRID, slice view unchanged
SNAP OFF and ON replaces on a Static sample with slices the new publication path and the stock question MKII twin: SNAP OFF 16 slices, SNAP ON 4 slices, stopped; the author listened to both pass: OFF applied at once; ON showed ALIGNING GRID, done by 6 s; no crash or stall record; author: boundary pops much reduced with ON
SNAP ON on a sample with no crossing near a boundary, and at the full-sample end the search must keep the beat anchor, not move or drop it not run not run: no host case covers it yet; on the unit with a sample made for it
A read failure or the work limit during analysis a partial table must never be published host test: a failing pair reader, and the read limit pass; on a unit: not run
The source changes (another sample, recording starts) while analysis runs the copied proposal is stale host test (stale owner and source) pass; on a unit: not run
Analysis running while the pattern plays bounded engine work beside playback, chunks that pause on BUSY MKII twin, pattern playing: SNAP ON replace, 16 slices; guard, health pass: done within 3 s, frame interrupt at most 38 % (share 80 %), no frame skipped, loader stalls 0
Stereo channel choice left, right or both which crossings count changes host test: every format with one to three channels pass; on a unit: not run
FUNC+AED with no module action installed the cycle must stay stock MKII twin, Beat Slicer removed: FUNC+AED twice, NO pass: stock chooser both times, NO closes
FUNC+AED through stock SLICE GRID, CREATE BEAT GRID and back the shortcut retires the editor token before passing the key on host test; MKII twin: FUNC+AED three times, NO pass: stock, CREATE BEAT GRID (SNAP setting kept), stock, closed
An ABI-1-sized client on this base the options tail must stay invisible to it host test: Beat Slicer's controller opened with the ABI-1-sized interface pass
Beat Slicer 0.1.68 on a base without the tail it must report NO SNAP, not call past the interface not run not run: no host case checks the NO SNAP reply yet
The trial ends or Undo runs with the popup open or analysis pending the base owns the copied edit after the module is gone MKII twin: trial ended with the popup open pass with the popup open: closed onto the SLICE page, inventory empty. An MCP trial ended by an explicit device_undo: active identity restored, no modules. Not run: rollback during ALIGNING GRID, an Undo after a Keep
The base's own identity on every USB layout the build fix changes how the digest is stored the base build's per-layout browser rebuild and identity check pass

Guides and remaining review

The sample-editor guide lacked the SNAP contract and FUNC+AED cycle, including token retirement: updated sdk/machines/octatrack/SAMPLE_EDITOR.md and the dated changelog. Nothing in the guides says that a base change adding a field to a shared struct breaks every module test that fills it positionally, which forced this module release into the base PR; left for the owner's review here. No firmware or stock image is committed.

The earlier stalled full-set Undo on a measurement base remains unexplained.

Related to #1056.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the enhancement New feature or request label Nov 2, 2026
@repeat98

repeat98 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thanks, I read through it. The API shape is good: the options tail keeps the ABI-1 prefix, 0.1.66 keeps working because it only checks bytes >= sizeof *api, and 0.1.68 falls back when the tail is missing, so the module isn't tied to this base. Making FUNC+AED one cycle that every grid action can join is the right way to do it too.

A few things before it can go in:

  1. Changelog and guide wording. Both call this a "private proposal" that "is not part of the released beta base". Merging this rebuilds the beta base, and that base deploys to every tester when main is pushed. The changelog should say what testers get, and the new SAMPLE_EDITOR.md section should describe the contract rather than a review status.
  2. Document FUNC+AED. The base now handles FUNC+AED from the SLICE GRID through each module action and back to stock. The PR description, the guide and the changelog don't mention it. Please add it to SAMPLE_EDITOR.md: when stock keeps the chord, the order of the cycle, and what an action has to do to join it (retire its token on FUNC/AED before passing the key on).
  3. Question: the published 0.1.66. Testers will run this base with Beat Slicer 0.1.66, which was written before the shortcut existed. Have you tried that pair? I'd like to know what a second FUNC+AED does while 0.1.66's popup is open.
  4. Test the exact base. The SNAP result came from an instrumented measurement base. Before merge, please put the beta base this PR builds on a unit over USB and run a base update, a self-test with your usual set, SNAP OFF and ON once, and an Undo. The earlier full-set Undo that got stuck still has no explanation, and that matters more for a base every tester gets.

#1098 and #1108 also rebuild the base. Whichever merges last regenerates it, so expect to run pr:ready once more after them. Mark it ready for review when the points above are done and I'll take it from there.


Generated by Claude Code

@repeat98

repeat98 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Thanks, this covers my points:

  • The changelog and the guide describe what testers get.
  • FUNC+AED's cycle and the token rule are in SAMPLE_EDITOR.md.
  • 0.1.66 brings up stock CREATE SLICE GRID on a second chord.
  • SNAP OFF and ON ran on the exact base efab14e5…, which is still what this branch builds.

On the rollback: a first needs-recovery that clears on a retry happens on main's bases too. Output Matrix's USB record shows one, and the site retries a rollback from recovery for that reason. So I don't count it against this PR. The Undo that stayed stuck ran on a different measurement base. If it happens again on a shipped base, it gets its own issue.

The only thing left from my list is the base update: these runs RAM-booted the base and nothing was flashed. I'll run that update on my unit myself once I'm back from holiday, before I merge, so please mark it ready for review. #1098 and #1007 also rebuild the base. Whichever of them merges after this one regenerates the base, so pr:ready may need one more run here if one of them goes first.


Generated by Claude Code

@twwwy
twwwy marked this pull request as ready for review November 5, 2026 08:53
@twwwy

twwwy commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

A question for after this merges, not a blocker for it.

Beat Slicer is USB-only because card firmware has no base: manifest.py says it has no card form, and usb-only.ts keeps source packages out of card builds. Members who flash card firmware can't use it at all. Would you want a card form?

A card form could be built the way MIDI generators do it without the base. On card builds only, Beat Slicer would link its own copy of the sample-editor service, including this PR's SNAP addition, and patch the service's five stock sites itself. Over USB it would keep using the base's service. That would need:

  • the card builder to compile or link C runtime code, which it doesn't do today;
  • free-space placement in the card image that passes the pair ledger;
  • a uiClaims entry for the AED SLICE menu, so a later AED SLICE module would clash with it on card builds (over USB they would share the base's menu);
  • separate hardware evidence from a flashed card image.

It reintroduces the per-module patching that SAMPLE_EDITOR.md says the base was meant to avoid, so I'd rather ask first. Which do you prefer?

  1. Keep Beat Slicer USB-only.
  2. A card form carried by the module, as above.
  3. Card builds carrying base services such as the sample editor for any module that needs them.

Whichever you choose, 0.1.68 would ship USB-only, and any card form would come as its own later release.


Generated by Claude Code

@repeat98

repeat98 commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Thanks for asking first. Let's keep Beat Slicer USB-only (1). A card form carried by the module would bring back the per-module patching of the five sample-editor sites, which is exactly what the base's service is there to own, and it would add a card-only uiClaims clash and a second set of hardware evidence. Option 3 is a bigger change to card builds than one module justifies right now, so USB stays the home for modules that use base services.

One thing on this PR: main has regenerated the base since your last merge, so it now conflicts in base-binding.json, octatrack-base.elemod, the base variants and sources, and octatrack-module-packages.json. Please merge main (not a rebase), let npm run pr:ready regenerate them until it says Ready, and push. Then I'll run the base update on my unit with the base it builds, as I said, and merge.

twwwy and others added 2 commits November 8, 2026 04:46
Regenerated the beta base with npm run octatrack:base -- --beta --write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm run octatrack:module-packages -- --base-only --stock OS.bin: only
requiredBase and Recorder Loop Fix's linked bytes moved.

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

twwwy commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged main (not a rebase) and regenerated the beta base: af154d00…. The five base-bound packages are relinked with octatrack:module-packages -- --base-only; only requiredBase and Recorder Loop Fix's linked bytes moved. pr:ready says Ready and all checks are green on 10c84274, so it's ready for your base update on the unit.

Guides: one gap. A local base build needs ELEKLOADER_DSP_ASM pointing at a built dsp_asm, and only a note in OCTATRACK_HARDWARE_TRAPS.md says so.


Generated by Claude Code

twwwy and others added 5 commits November 8, 2026 16:13
…-snap-base-api

# Conflicts:
#	sdk/machines/octatrack/base-binding.json
#	src/engine/assets/octatrack-base-variants.json
#	src/engine/assets/octatrack-base.elemod
#	src/engine/assets/octatrack-module-packages.json
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@twwwy

twwwy commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged main again (not a rebase). It conflicted only in the generated base files, so I took main's and regenerated the beta base on top: the identity is now 8ff4b08a… (was af154d00…). Relinking the base-bound packages with --base-only moved only requiredBase. pr:ready says Ready and all checks are green on e8632720. Please use the new base for your update test on the unit.

Guides: nothing new.

@twwwy

twwwy commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@repeat98 When do you expect to test the base update on your unit? Beat Slicer 0.1.68 (SNAP) waits on this PR: its release has to be built against the merged base, so nothing for 0.1.68 can go out before this one merges.

main has moved 26+ commits since e8632720, and three of them change the generated Octatrack base, so 8ff4b08a is stale again. Rather than rebuilding it each time main moves, I'll merge main, regenerate the base and rerun pr:ready as soon as you say you're ready to test, and post the new base identity here. If you'd rather have it refreshed now, say so and I'll do it today.


🤖 Generated with Claude Code

@twwwy

twwwy commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@repeat98 Friendly reminder on this one: Beat Slicer 0.1.68 (SNAP) is waiting on it, since its release has to be built against the merged base. Could you let me know when you can run the base update test on your unit? As soon as you say, I'll merge main, regenerate the base and rerun pr:ready, so you test a current base rather than the stale 8ff4b08a.

repeat98 and others added 2 commits November 11, 2026 10:41
# Conflicts:
#	public/octatrack-modules/recorder-loop-fix/0.1.0-experimental.mwrm
#	sdk/machines/octatrack/base-binding.json
#	src/engine/assets/octatrack-base-fills.json
#	src/engine/assets/octatrack-base-variants.json
#	src/engine/assets/octatrack-base.elemod
#	src/engine/assets/octatrack-module-packages.json
…ging main

octatrack:base --beta --write, then octatrack:module-packages --base-only.
Only requiredBase and Recorder Loop Fix's linked bytes moved.

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

Copy link
Copy Markdown
Owner

Sorry for the silence on your two questions. I haven't run the base update yet.

Please don't refresh again for now. Zac's DSP hook chains (#1418) also rebuild the base and are level with main, so they go on the unit first. Once that's merged I'll ping you here; then one merge of main, one base rebuild and pr:ready, and I run your base update on that exact base and merge. That way you rebuild once, not after every change to main.

One thing that changed this morning: the card builder and its checks are gone (#1451, #1453). It doesn't touch your files, and it means Beat Slicer being USB-only is now simply how every Octatrack module ships.

twwwy and others added 5 commits November 20, 2026 20:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….1.68 needs 0.7.11

Base 57c92565, rebuilt on the cumulative 0.7.11 (after 0.7.10 shipped in
repeat98#1757) and current main. Beat Slicer 0.1.68 package 195d2b46 unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pment twin of base 0.7.11 with SNAP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on and the unit's own UI captures

Undo through the developer MCP, the popup's draw cost (198 us a UI tick, 0.1.66:
1,058 us) and a 20-press key stress run while playing, on the author's MKII.
The 0.1.66 package goes, as a module update does.

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

twwwy commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Done on the cumulative 0.7.11 branch, since 0.7.10 shipped without SNAP:

  • Base 0.7.11 with SNAP: 57c925651e5e51f43bfba0129bf8f30f740216d8808a72f9296c8623bd286628 (812,188 of 851,712 container bytes, +3,832 since 0.7.10). Tested on the MKII as its development twin 54cab5949013f45d96f23102f3b838932cb663cf0b5332007d608422928aedcb (same source 3055f13f2, with --dev).
  • Beat Slicer 0.1.68: 195d2b46e2620bd15118478aa02d626d6d803692e02c40db4f45a67f6927b643, 5,332 bytes.

On my MKII (agent's run, then my own listening, all trials without a Keep): device:test passed; SNAP OFF and ON replaces stopped and while playing (ON done within 3 s playing, frame interrupt at most 38 %, nothing skipped); NO at the question leaves the slices; FUNC+AED cycles stock, CREATE BEAT GRID, stock, and stays stock without the module; an MCP trial ended by an explicit Undo restored the set. By ear, SNAP ON reduces the pops at slice boundaries a lot, and playback stays smooth during the analysis. The popup's draw is down to 198 µs a UI tick from 1,058. module:doctor -- beat-slicer is green. Details, the edge-case table and what was not run are in the description and Beat Slicer's TESTING.md.

Two things for your review:

  • pr:ready is not Ready only because Tape Echo's package rebuild fails on current main (its recipe pins files changed there today; board finding 840ecfa6). Nothing in this PR touches it.
  • A base-builder fix rides along (17f7e5e98): a layout whose identity hash ended in bytes matching stock was stored as a stock reference, which stopped the base build. It now keeps the digest literal, with a test.
  • Open, not Beat Slicer's: the base's CPU budget refusal counter rises by 3 at each slice replace and FUNC+AED, also without the module, with nothing reported refused.

@repeat98

Copy link
Copy Markdown
Owner

The branch now pins SNAP base f3012d80. The MKII result in the thread is for the earlier development twin 54cab594, and Beat Slicer's package is still 195d2b46. Since that run, #1840 and #1899 have both merged. The cumulative branch now carries the shipped 0.7.12, and its Recorder Loop Fix package also conflicts with this head.

Please keep the earlier run as evidence for that build and save the next MKII run for the next cumulative candidate. When combining it, preserve the shipped 0.7.11 and 0.7.12 entries and regenerate the base-bound packages. That lets the SNAP, FUNC+AED and Undo results qualify the build that can land.

twwwy and others added 14 commits November 21, 2026 15:32
…7.13

Generated base files regenerated on main's side, keeping the shipped 0.7.11
and 0.7.12 entries; base-bound packages re-bound (Recorder Loop Fix 43d26b27).
Beat Slicer 0.1.68 (195d2b46) now needs base 0.7.13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its content address

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Show zero direct DSP cycles for verified ColdFire modules

* Publish Octatrack hardware measurements and kilobyte gauges
…-next

# Conflicts:
#	sdk/machines/octatrack/base-binding.json
#	sdk/machines/octatrack/base-sizes.json
#	sdk/machines/octatrack/base-versions.json
#	sdk/machines/octatrack/module-adapters/controller-policies.json
#	src/components/BaseChangelog.tsx
#	src/engine/assets/octatrack-base-fills.json
#	src/engine/assets/octatrack-base-sources.json
#	src/engine/assets/octatrack-base-variants.json
#	src/engine/assets/octatrack-base.elemod
#	src/engine/assets/octatrack-module-packages.json
Generated base files and base-bound packages regenerated.

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

The SNAP base re-binds Recorder Loop Fix 0.1.0 (de28d726 -> 43d26b27, both
1,818 bytes); the DSP program word count at byte 32 is 0 in both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@repeat98
repeat98 merged commit 4b7338a into repeat98:base/octatrack-next Nov 21, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants