Skip to content

Improvement: a shared scale file for the Octatrack SDK, with its host test - #1631

Merged
repeat98 merged 8 commits into
repeat98:mainfrom
timhastie:shared-scale
Nov 17, 2026
Merged

repeat98 merged 8 commits into
repeat98:mainfrom
timhastie:shared-scale

Conversation

@timhastie

Copy link
Copy Markdown
Contributor

This implements the shared scale file from #1145 as an independent SDK change. The base rows, saved bytes and ev_scale_snap will be a separate pull request.

  • What was wrong or hard: Scale Quantizer, FM Synth's bundled copy and VECTOR keep separate scale tables and snap routines. A shared source lets the base, runtime packages and card builds use the same scale definition.
  • What this changes:
    • sdk/machines/octatrack/modwerk_scale.s and include/modwerk_scale.h provide octabam's 52-ID mask table and modwerk_scale_snap(note, id, root). It returns the nearest scale note, choosing the lower note on a tie, with the C calling convention and PC-relative table access without stock addresses.
    • modwerk_scale_from_quantizer[] maps all 24 saved Scale Quantizer IDs to catalogue IDs with identical masks, preserving the saved scale choice.
    • The original scales.s and MIT licence from sambanks/octabam revision 755a02ac are retained under vendor/octabam-scales/, with an import record. The Octatrack SDK guide and changelog describe the interface.
    • All new files are outside sdk/machines/octatrack/elekloader/. Nothing links this routine yet; it adds no base input, event index or module change. The FM Synth/Scale Quantizer card-build conflict remains unchanged.
  • How I checked it:
    • Main 1737f320b334c01a9af88f33f9863d1111c1ae7d is merged without rebasing. Full readiness on the preceding eaae18b9 snapshot passes all 359 Vitest files: 3,052 tests passed and eight skipped. Typecheck, lint, application bundle and generated-file checks pass.
    • The SDK run completes 700 tests in 120 jobs. All nine dedicated shared-scale tests pass without skips: 52 masks, all 24 ID mappings, identical assembly for both CPUs at three addresses, a C caller, out-of-range inputs, and execution against qz_msnap (36,864 cases) and octabam's sc_snap (79,872 cases). Import checking passes for 159 files and five editable guides.
    • Readiness returns 1 for two inherited SDK failures: Analog BD assembles to 1,004 words against an expected 1,009; and dsp_packages.py still names removed modulation/spectrum entries. Jannik confirmed both repairs and is folding them into Octatrack base: DSP hook chains, so several packaged DSP machines share a hook site #1418 with one base update; Fix: refresh stale Octatrack SDK check inputs #1585 was closed for that reason. This SDK PR is independent of that repair.
    • The later 1737f320b merge changes the base status display and patch-version naming, not this SDK routine. Its affected host tests pass (two cases), and its UI/version tests pass (12 cases in three files). A private default-layout base 0.7.1 reproduction matches the committed package, fill, source and binding inputs and browser/native output. This is a scoped default-layout check; the separate full seven-layout reproduction passed on base 0.7. The unchanged full queue was not repeated after this merge.
    • Local checks used native arm64 tools, an owned absolute temporary directory and the agent board disabled. They do not claim CI, live-board or hardware verification. No board claim is needed for these existing IDs. Earlier failed attempts remain recorded.
  • What the guides lacked or got wrong, and where I fixed it: nothing.

Related to #1145

sdk/machines/octatrack/modwerk_scale.s with include/modwerk_scale.h: octabam's
52-ID scale masks and modwerk_scale_snap(note, id, root), Scale Quantizer's
rule (qz_scale_mask's rotation and qz_msnap's search, ties down), stateless and
PC-relative so the base and card builds link the same file. A 25-byte table
maps Scale Quantizer's saved SCALE 0..24 to the catalogue IDs with the same
masks (1..7 equal, 8..24 differ).

The masks are re-vendored from sambanks/octabam modules/scales at 755a02ac:
scales.s and octabam's LICENSE unchanged under vendor/octabam-scales/, pinned
by sdk/imports/octabam-scales-755a02ac.json through sdk:imports:check.

sdk/tests/test_shared_scale.py: the table equals the vendored sc_masks; the
translation maps every one of the 24 to an identical mask; with ColdFire
binutils and Unicorn, the shared snap equals Scale Quantizer's own qz_msnap
(assembled from the module's sources) for 24 x 12 x 128 cases and octabam's
sc_snap for 52 x 12 x 128; the file assembles to the same bytes for
-mcpu=5475 and -mcpu=54455 at three addresses, passes the MCF54455 codegen
check, and a C runtime package calls it through the header.
@repeat98
repeat98 merged commit 5d581f1 into repeat98:main Nov 17, 2026
11 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