diff --git a/public/module-sleeves/loopbox.svg b/public/module-sleeves/loopbox.svg new file mode 100644 index 0000000000..0ede0e9bf3 --- /dev/null +++ b/public/module-sleeves/loopbox.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/octatrack-modules/loopbox/0.1.1-experimental.mwrm b/public/octatrack-modules/loopbox/0.1.1-experimental.mwrm new file mode 100644 index 0000000000..5ff4fe8a65 Binary files /dev/null and b/public/octatrack-modules/loopbox/0.1.1-experimental.mwrm differ diff --git a/scripts/build-module-packages.py b/scripts/build-module-packages.py index 104d034f96..ec5c50bdbc 100644 --- a/scripts/build-module-packages.py +++ b/scripts/build-module-packages.py @@ -8,7 +8,7 @@ import argparse, hashlib, importlib.util, json, os, re, shutil, struct, subprocess, sys, tempfile APP = Path(__file__).resolve().parents[1] -ORDER = ['miniverb', 'tapeecho', 'euclid', 'repitch', 'tapehead', 'airwindows-chorus', 'everb', 'bbd', 'lofi2', 'ring-sc', 'vibrato', 'resonator', 'mackity', 'midiverb', 'ringbank', 'void', 'fuzzbox', 'glitchbox'] +ORDER = ['miniverb', 'tapeecho', 'euclid', 'repitch', 'tapehead', 'airwindows-chorus', 'everb', 'bbd', 'lofi2', 'ring-sc', 'vibrato', 'resonator', 'mackity', 'midiverb', 'ringbank', 'void', 'fuzzbox', 'glitchbox', 'loopbox'] # DSP code that stock code reaches through hooks. Output Matrix has no FX menu entry and is also a requested ColdFire module. HOOKED = ['sidechain-compressor', 'output-matrix'] REQUESTED = ['analog-bassdrum', 'usb-audio-out-tracks-main-cue', 'quantizer', 'synth', 'vector', 'playmodes', 'mute-modes', 'recorder-loop-fix', 'poly8', 'output-matrix', 'quantize-live-rec-toggle', 'apply-scene', 'direct-jump-kyoti', 'dejavu', 'arp-key-locks', 'temp-save', 'tuner', 'scope', 'slow-lfo', 'bar-led', 'stem-rec', 'songbook', 'arr-rows', 'smart-reload', 'defrost', 'bounce'] @@ -635,6 +635,14 @@ def at(base): donorSha256='3b3f9b15f2f6addfea9fc281f5b9fdf054bf305778059b8d43db41d390f0401f', fx2Slot=0x400d6004, slotSha256='79bc740214b4d029e385d06d21e224d04e8f91b53fb26ea08ffa4e5d70964b7a')) + if not any(row['id'] == 'loopbox' for row in descriptor_guards): + # The DARK REV donor and stock NONE at unused FX2 id 0x0a, with the hashes the effects above recorded for + # them (npm run module:list); the build checks both against the private OS 1.40C. Never retain stock bytes. + descriptor_guards.append(dict(id='loopbox', key='LOOPBOX', author='jrs1717', + fxId=0x0a, donorAddress=0x400d58f0, + donorSha256='3b3f9b15f2f6addfea9fc281f5b9fdf054bf305778059b8d43db41d390f0401f', + fx2Slot=0x400d6004, + slotSha256='79bc740214b4d029e385d06d21e224d04e8f91b53fb26ea08ffa4e5d70964b7a')) for old in descriptor_guards: module = byid[old['id']] if module.menu.donor_desc + 0x38 != old['donorAddress'] or module.menu.fx2_id != old['fxId']: diff --git a/sdk/catalog.json b/sdk/catalog.json index 7778894c1d..27523ee0c1 100644 --- a/sdk/catalog.json +++ b/sdk/catalog.json @@ -92,6 +92,11 @@ "version": "0.1.0-experimental", "addedAt": "2026-12-02T05:02:06Z" }, + { + "id": "loopbox", + "version": "0.1.1-experimental", + "addedAt": "2026-12-03T02:58:54Z" + }, { "id": "analog-bassdrum", "version": "0.1.7-experimental", diff --git a/sdk/machines/octatrack/frame-costs.json b/sdk/machines/octatrack/frame-costs.json index 817c02ea75..21c48354e2 100644 --- a/sdk/machines/octatrack/frame-costs.json +++ b/sdk/machines/octatrack/frame-costs.json @@ -12,6 +12,7 @@ "glitchbox": {"first":4.6,"each":4.6,"rest":0,"points":[0.9,-1.8,4.6,-2.4],"measured":"glitchbox 0.1.0-experimental on T1 T3 T6 T7: the bank, pattern and Part the unit was on, transport stopped (test:procedure); base development twin 117eb07f of base ddb56b72, MKII, OS 1.40C; 8 s a reading; 2026-12-05 (evidence/frame-cost.json)"}, "grain": {"first":16.1,"each":8.6,"rest":0.4,"points":[16.1,24.7],"measured":"grain 0.2.0-experimental on T1 T3: A01 at 120 BPM, 16 steps, trigs on steps 1/5/9/13 of T1-T4, T6, T7: T1 and T3 Flex with a loaded 16-bit stereo sample (0.91 MB), T2 and T4 stock samples with time stretch off, T6 and T7 no sample, T5 and T8 empty; picks on empty A02; the author's MKI; package 520215cb; base 4c7eb79b (development base booted in RAM); 8 s a reading; 2026-11-30 (evidence/frame-cost.json)","paused":4.7}, "lofi2": {"first":1,"each":0,"rest":0,"points":[1,-1.5,-0.3,-1.3],"measured":"lofi2 0.1.1-experimental on T1 T3 T6 T7: Dev17 C04 at 126 BPM, trigs on steps 1/5/9/13 of T1-T4, T6, T7 (T2 and T4 play samples), picks on empty C02; owner's MKII; base 0.8 twin 28 053fd054; 8 s a reading; 2026-11-22"}, + "loopbox": {"first":0,"each":0,"rest":2,"points":[-3.7,-1.4,-7.2,-3.7],"measured":"loopbox 0.1.1-experimental on T1 T3 T6 T7: the bank, pattern and Part the unit was on, transport stopped (test:procedure); base development twin 117eb07f of base ddb56b72, MKII, OS 1.40C; 8 s a reading; 2026-12-05 (evidence/frame-cost.json)"}, "mackity": {"first":0.9,"each":0.9,"rest":0,"points":[-1.8,-2.2,0.9,-2.9],"measured":"mackity 0.1.0-experimental on T1 T3 T6 T7: Project on the owner's development unit, bank C, Part 1 reloaded in RAM to its saved copy; picks on the empty C02, readings on C04 (trigs on steps 1/5/9/13 of T1-T4, T6, T7) at the project tempo; transport played by the tool; base development twin 8fd6d456 of base 0.8.1 (eb6679620d0c9ed7), the owner's MKII, OS 1.40C; 8 s a reading; 2026-11-25 (evidence/frame-cost.json)"}, "midiverb": {"first":2,"each":2,"rest":0,"points":[0.9,0.2,2.2,1],"measured":"midiverb 0.2.0-experimental on T1 T3 T6 T7: Dev17 bank C: C04 Part 2 (working = saved), picks on the empty C02, the curve on C04 (trigs on steps 1/5/9/13 of T1-T4, T6, T7), transport stopped; twin ed5474c6 of base 0.8.3 (main 80ea1e584); base development twin ed5474c6 of base 0.8.3 (main 80ea1e584), the owner's MKII, OS 1.40C; 8 s a reading; 2026-11-27 (evidence/frame-cost.json)"}, "miniverb": {"first":1.5,"each":0,"rest":0,"points":[1.5,1.4,1.2,1.2],"measured":"miniverb 0.2.3-experimental on T1 T3 T6 T7: Dev17 C04 at 126 BPM, trigs on steps 1/5/9/13 of T1-T4, T6, T7 (T2 and T4 play samples; stock alone 79.4 %), picks on empty C02; base dce1d30e (0.8 twin); 8 s a reading; 2026-11-22 (npm run device:price -- --curve)"}, diff --git a/sdk/machines/octatrack/module-adapters/standalone-recipes.json b/sdk/machines/octatrack/module-adapters/standalone-recipes.json index b1376ded28..d933d60d38 100644 --- a/sdk/machines/octatrack/module-adapters/standalone-recipes.json +++ b/sdk/machines/octatrack/module-adapters/standalone-recipes.json @@ -233,9 +233,9 @@ "src/engine/coldfire-elf.ts": "319ca0d835d1b0c602c8f4b06990016d0ebfe246cedbfc596cea3cc7adfe3cd2", "src/engine/module-build.ts": "dcd8397b8cecf6fab61debd9aa2f86f612da0ca6ccf363c79d56033bc170b993", "src/catalog/modules.ts": "14304ea8450f8ec7ecaaf3ccf9e764929161288babe7b34cb37ff41e44fe1b43", - "src/engine/assets/dsp-packages.json": "cf91b4e8e376aa7103dd96dd5a1af7d72b4c7e33466d08215016e841ac3d3767", - "src/engine/assets/descriptor-recipes.json": "1cb1864d95aff572b1627a7e3b28856a500626c26ed3240f4838b217ab134890", - "src/engine/assets/menu-recipes.json": "d90270e960e7ceb197e93d1ad58bfd705311c823a6e47df641b9c550a4be5a61", + "src/engine/assets/dsp-packages.json": "14801aef9d70cb37a8f066fcaef761b016ba3e1d97b87319554f0ace9607ab65", + "src/engine/assets/descriptor-recipes.json": "497b86432e61727ff64335e80d5ac5dc2d12ca60a0adb947af813d6f816b7feb", + "src/engine/assets/menu-recipes.json": "59119cf6df843e19b66aa5e3b1c56a8ed821e02e7617c3e056f1d9dac9676f4a", "src/engine/assets/rom-packages.json": "68d9f0e5f388910e20cd00f5b00cbc1eb606258921d90d4a0d87dab934f835cb", "sdk/firmware_builder/__init__.py": "4d179f74220ab956f7e27550d315337c5af053c80a217feeba75f5db91b590ff", "sdk/firmware_builder/codec/__init__.py": "bdcd33ceb83a11ef027d0f6dd64d98c05e7665915d241bb2896e75140d1b49cb", @@ -468,9 +468,9 @@ "src/engine/coldfire-elf.ts": "319ca0d835d1b0c602c8f4b06990016d0ebfe246cedbfc596cea3cc7adfe3cd2", "src/engine/module-build.ts": "dcd8397b8cecf6fab61debd9aa2f86f612da0ca6ccf363c79d56033bc170b993", "src/catalog/modules.ts": "14304ea8450f8ec7ecaaf3ccf9e764929161288babe7b34cb37ff41e44fe1b43", - "src/engine/assets/dsp-packages.json": "cf91b4e8e376aa7103dd96dd5a1af7d72b4c7e33466d08215016e841ac3d3767", - "src/engine/assets/descriptor-recipes.json": "1cb1864d95aff572b1627a7e3b28856a500626c26ed3240f4838b217ab134890", - "src/engine/assets/menu-recipes.json": "d90270e960e7ceb197e93d1ad58bfd705311c823a6e47df641b9c550a4be5a61", + "src/engine/assets/dsp-packages.json": "14801aef9d70cb37a8f066fcaef761b016ba3e1d97b87319554f0ace9607ab65", + "src/engine/assets/descriptor-recipes.json": "497b86432e61727ff64335e80d5ac5dc2d12ca60a0adb947af813d6f816b7feb", + "src/engine/assets/menu-recipes.json": "59119cf6df843e19b66aa5e3b1c56a8ed821e02e7617c3e056f1d9dac9676f4a", "src/engine/assets/rom-packages.json": "68d9f0e5f388910e20cd00f5b00cbc1eb606258921d90d4a0d87dab934f835cb", "sdk/firmware_builder/__init__.py": "4d179f74220ab956f7e27550d315337c5af053c80a217feeba75f5db91b590ff", "sdk/firmware_builder/codec/__init__.py": "bdcd33ceb83a11ef027d0f6dd64d98c05e7665915d241bb2896e75140d1b49cb", diff --git a/sdk/octatrack/modules/loopbox/LICENSE b/sdk/octatrack/modules/loopbox/LICENSE new file mode 100644 index 0000000000..250cae34a6 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/LICENSE @@ -0,0 +1,30 @@ +MIT License + +Copyright (c) 2026 jrs1717 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +This licence covers this module's own source code and documentation only. It +does not extend to any Elektron Music Machines firmware, which is not +distributed here and remains the property of its copyright holder. Nothing in +this module is endorsed by, supported by, or affiliated with Elektron. +Octatrack and Elektron are trademarks of Elektron Music Machines MAV AB, used +only to identify the hardware this module targets. diff --git a/sdk/octatrack/modules/loopbox/README.md b/sdk/octatrack/modules/loopbox/README.md new file mode 100644 index 0000000000..7ab7b924cb --- /dev/null +++ b/sdk/octatrack/modules/loopbox/README.md @@ -0,0 +1,74 @@ +# Loopbox + +Version 0.1.1-experimental · by @jrs1717 · the test procedure passed on the author's MKII (package 5d3bf7c3, steps 1-11, with DUB); the author kept it, played it and power-cycled: "everything survived". + +## Overview + +Loopbox is an automatic micro-looper for an audio track's FX2 slot. It keeps the last third of a second of the track and, on a note grid at the project's tempo, loops what was just played: +- **LAYER** stacks three loops of the same audio at different speeds. +- **DUB** records the live track into the loop as it plays, sound-on-sound: each pass keeps the old layers a little quieter and adds what you play, so the loop builds and smears like a short tape loop with the record head on. It builds within one TIME slice and starts on fresh audio at the next, so how far it builds depends on how many passes fit in a slice: at 120 BPM, TIME 1/16 with RPT 2 gives 2 passes of 62.5 ms (close to a plain repeat), 1/8 gives 4, and 1/2 with RPT 1 gives 8 passes of 125 ms. Longer slices and a low RPT build the most. +- **SLIDE** glides two overlapping loops in pitch. + +Each type has variations A to D. Each read head fades in and out of the loop by its own position, so loops at any speed are click-free. When a new loop comes along, the heads change over to it one by one as they come round, so old and new loops overlap for a moment instead of leaving a gap. MIX sets how far the loops replace the track, and TAIL lets a loop ring on after it ends. + +## Controls + +| Page | Knob | Name | Range | Default | What it does | +|---|---|---|---|---|---| +| Main | A | TIME | 1/64, 1/32, 1/16, 1/8, 1/4, 1/2 | 1/16 | The note grid at the project's tempo. Loops start only on it and last a whole slice. A slice longer than 179 ms plays as 2, 4, 8, 16 or 32 equal chunks, each looping the latest audio. | +| Main | B | ACT | 0-127 | 64 | How often a slice loops: 0 never, 127 about 70 % of slices. | +| Main | C | SHAP | 0-127 | 32 | The loops' fades: short at 0 (1/64 of a loop), rising evenly to a full swell. | +| Main | D | RPT | 1-8 | 2 | How many times the loop cycles in a chunk: 1 plays the whole chunk once, 8 loops an eighth of it eight times. | +| Main | E | MIX | 0-127 | 64 | Up to 96 the track plays dry between loops and ducks under each one; from 96 to 127 the dry fades out, so 127 is the loops alone. | +| Main | F | TAIL | 0-127 | 64 | After a loop, its heads loop on and fade: 0 a short release (about 50 ms), 127 about 3 s. A loop that starts over a tail picks up from there. | +| Setup | A | TYPE | LAYER, DUB, SLIDE | LAYER | Which kind of loop (above). | +| Setup | B | DIRT | 0-127 | 0 | Grit on the loops: sample-rate reduction, harder crush and clipping drive. | +| Setup | C | VAR | A-D | A | LAYER: A octaves up and down, B a fifth up and a fourth down, C reversed and an octave down, D random speeds. DUB: how long the old layers last, each pass keeping A half of the last, B 70 %, C 85 %, D 94 % (the longest-lasting). SLIDE: A both up an octave, B both down, C one up and one down, D both to a random speed; each glide is even in semitones. | +| Setup | D | WIDE | 0-127 | 0 | Stereo: LAYER's and SLIDE's extra loops spread left and right this far; DUB's passes ping-pong. | +| Setup | E | RAND | 0-127 | 0 | Chaos: random loop counts, speeds, glide targets and places. | +| Setup | F | DGRD | 0-127 | 0 | Degrade: a tail grows dirtier as it fades. | + +## Usage + +Select an audio track, hold FUNC and press FX2, turn LEVEL to LOOPBOX at the end of the list and press YES. Press FX2 for the main page (TIME, ACT, SHAP, RPT, MIX, TAIL); hold FUNC and press FX2 for the setup page (TYPE, DIRT, VAR, WIDE, RAND, DGRD). + +## Quick tutorial + +1. Put Loopbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to LOOPBOX at the end of the list and press YES. At the defaults it is LAYER A at 1/16, looping about half the slices. +2. Turn ACT and MIX to 127 to hear only the loops, then hold FUNC and press FX2 and step TYPE through LAYER, DUB and SLIDE, and VAR through A to D. For DUB, set TIME to 1/2 and RPT to 1 so each loop gets eight passes, then play or change the track while a loop runs to hear it layered in. +3. Set TIME to 1/4 and RPT to 1 for longer phrases, raise TAIL to let each loop ring on, and WIDE to spread LAYER's and SLIDE's loops left and right. +4. Turn MIX back to 64 to blend the loops with the track again, or to 0 to hear the track alone. + +## Compatibility and limitations + +- Loopbox or Glitchbox? Loopbox keeps a short loop going under the track: layered at several speeds, overdubbed or gliding. Glitchbox (a separate module) throws parts of the track back on the beat: chopped, stuttered or stepped through pitches, a glitch at a time. Each takes a track's FX2. +- DUB stops recording the track into the ring while a dub loop plays (the loop is recorded into in place); it records again once the loop ends. +- FX2 only: the capture ring needs an FX2 slot's buffer (15,870 words, stopping short of Sidechain Compressor's key window). +- Loops follow the project's tempo but not yet the pattern's steps, track speed or swing, like Glitchbox: free-running tempo slices until the base has a step clock for effects ([issue #2491](https://github.com/repeat98/modwerk/issues/2491)). +- After a second of silent input no loop starts; after four seconds any loop or tail stops, so a stopped track falls silent. The watch listens to the mono sum the ring records. +- It prefers effect id 10, as Fuzzbox, Glitchbox and Midiverb do: over USB the base gives each its own id; in a card set only one of them fits. + +## Tests and measurements + +See [TESTING.md](TESTING.md). + +## Authorship and licences + +Original code by @jrs1717 under the MIT licence in LICENSE. It starts from the author's own Glitchbox engine. Inspired by micro-loop effects in general, with no product's code, tables or names. + +## Screens and audio + +![FX2 SETUP page with an effect list ending in Loopbox, selected; knobs labelled SLIDE, DIRT, VAR, WIDE, RAND and DGRD.](media/ot-location.png) + +Hold FUNC and press FX2: Loopbox is chosen at the end of the effect list, with TYPE (here SLIDE), DIRT and VAR on the top row and WIDE, RAND and DGRD below. + +![FX2 main page titled Loopbox with knobs TIME, ACT, SHAP, RPT, MIX and TAIL.](media/ot-controls.png) + +Press FX2 for the main page: TIME, ACT and SHAP on top, RPT, MIX and TAIL below. + +Captured over USB on the author's Octatrack (OS 1.40C, base ddb56b72); see `media/capture.json`. No audio preview yet. + +## Develop + +- Hear it: `npm run module:dev -- loopbox --cycles 363 --cycles-kind executed --state 123 --buffer 15870 --slots fx2`. +- Check it: `npm run module:doctor -- loopbox`; `python3 -B verify.py` holds the engine to `reference.py` in `dsp_host`, and `python3 -B test_reference.py` tests the model. diff --git a/sdk/octatrack/modules/loopbox/TESTING.md b/sdk/octatrack/modules/loopbox/TESTING.md new file mode 100644 index 0000000000..c275030968 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/TESTING.md @@ -0,0 +1,291 @@ +# Loopbox testing + +Record what you ran, on which build and which unit, and what you saw. "Not tested" is a valid answer; never write a result you did not observe, and keep emulator runs apart from hardware ones. + +## On the unit + +1. 2 December 2026, the author's MKII on development twin 117eb07f of base ddb56b72 (OS 1.40C), RAM trials of 120 s with `npm run module:dev -- loopbox --cycles 331 --state 120 --buffer 15870 --slots fx2`, Loopbox picked on T1 FX2 and checked running, each rolled back with no crash, stall, freeze or skipped track logged. Reported: "Sounds really good!" Asked for improvements; with the author's OK: loops change over head by head (overlap), the chunk envelope replaced by a level with a 5 ms rise and TAIL's fall (TAIL 0 a 50 ms release), SLIDE's glides even in semitones, WIDE spreads LAYER's and SLIDE's extra heads, SHUFL's slices on the grid, and cheaper heads. +2. That build (4ae8946d), two more trials (`--cycles 340 --state 123`), the same verdicts. Reported: "Sounds awesome". + +3. 3 December 2026, the code review's fixes (0.1.1-experimental): a head still past the end after a wrap lands at the window's start (no negative, inverted fade when the window shrinks); each head's gain glides a call toward its target and fades out before a forced changeover; a chunk's last event takes what is left of it (no drift off the grid); a SHUFL slice lasts at least a block; SLIDE's glide step is scaled by the frames in a call; a fade is at most half its window (short loops reach full level). perf.py: worst 362.7, the package declares 363. The price and curve were measured on package 4dc3d0cc with `device:price --write` before the procedure (step 1 of an update checks them). The procedure below ran on that package. + +#### The author's stage (package 4dc3d0cc) + +3 December 2026, the author's MKII on its flashed base ddb56b72 (OS 1.40C) after a power cycle: package 4dc3d0cc kept with `npm run device -- try --accept` in place of 4537ab44 beside the 26 other kept modules (27 before and after, nothing removed; no crash, stall, freeze or skipped track logged). Asked to play it (suggested: RAND with LAYER, TIME 1/64 with RPT 8 and SHUFL B, SLIDE with trigs), save and reload the Part, power-cycle and check it. Reported: "sounds good, everything survived". + +### Test procedure: loopbox (package 5d3bf7c3, DUB in place of SHUFL, the shipped build) 0.1.1-experimental, 2026-12-05 + +Build: revision `a383d6d00ac6`, package `loopbox.mwrm` SHA-256 `5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372`. `npm run test:procedure -- loopbox --package /../loopbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out `, 616 s. Emulator results are not hardware evidence; only what ran on the unit is. + +| # | Step | Layer | Result | Command | Evidence | +|---|---|---|---|---|---| +| 1 | Software checks | host | passed | `npm run module:doctor -- --procedure loopbox` | logs/01-software.log | +| 2 | Beside every other module | contract | passed | `npm run modules:compat -- loopbox` | logs/02-compat.log | +| 3 | Name the build | host | passed | | logs/03-build.log | +| 4 | DSP cost model | contract | passed | `node scripts/cycle-scan.mjs check` | logs/04-cost-model.log | +| 5 | Emulator rehearsal | emulator | not run: no emulator session: left out with --no-emulator | | | +| 6 | Read the unit | unit | passed: Part 1 on A01: working = saved, saved once so that RELOAD works at the end | `node scripts/device.mjs status --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs read --socket /tmp/modwerk-share.sock --out /part-start.json`
`node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock` | logs/06-unit-read.log | +| 7 | Scripted unit pass | unit | passed | `npm run device:test -- --share /tmp/modwerk-share.sock --testing-entry /device-test.md /../loopbox.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: transport stopped, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../loopbox.mwrm --seconds 420 --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-soak.mjs --seconds 120 --programs 0-3 --pc-channel 11 --auto-channel 11 --log /soak.json`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/08-soak.log | +| 9 | Cost on the unit | unit | passed | `npm run device:price -- --share /tmp/modwerk-share.sock --out /price.json --scene 'the bank, pattern and Part the unit was on, transport stopped (test:procedure)' --curve T1,T3,T6,T7 /../loopbox.mwrm` | logs/09-cost-unit.log | +| 10 | Put back | unit | passed: Part 1 on A01: nothing to put back; working = saved | `node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/10-restore.log | +| 11 | Agent by hand | unit | passed: on 5d3bf7c3, Loopbox on T1 and T5 FX2 (both cores) while the pattern played: TYPE stepped LAYER, DUB, SLIDE (screens); DUB with ACT, MIX and TAIL at 127; DUB VAR D; TYPE to LAYER mid-loop and back to DUB. Health after each: 0 stalls, 0 errors, no crash, CPU 706-710. After STOP: stall none recorded, latest entry 73.0 us late (0 in the guard's 80-190 us window). The sound not judged here; the author heard DUB on 5d3bf7c3 in two RAM trials ("sounds great"). STOP, Part reloaded (working = saved), the trial rolled back | `device try`, `pick:T1:FX2:LOOPBOX`, `pick:T5:FX2:LOOPBOX`, `png:`, `health`, `stall`, `late`, `reload` | type-2.png, h-dub.png, h-dub-d.png, h-dub-back.png | +| 12 | Submitter's own stage | unit | passed (reported by the author): kept on the flashed base, played, Part saved and reloaded, power cycle; see below | | | + +#### Edge cases for this change + +Derive them from what the change touches and run each one (docs/TEST_PROCEDURE.md#edge-cases). A start, from the manifest and the changed files: + +- an effect slot: FX1 and FX2, both DSP cores, eight instances at once; one edited while another plays (docs/MODULE_QUALIFICATION.md#essential-persistence-and-instance-checks--8-october-2026) +- memory: the module pool nearly full; a delay buffer next to it; the largest set it can join (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- persistence: saved in a Part, then a Part reload, a project reload and a power cycle; removed while a saved Part still names it (docs/OCTATRACK_MODULE_EDGE_CASES.md#copying-and-saving) +- the loader: install, replace, remove and Undo; a set the base refuses rolls back whole; the pool full; a trial that expires with a page open (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- DSP code: DSP FULL; both cores; the receiver window; pipeline stalls the instruction count hides (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) +- the USB link: USB unplugged mid-transfer; the host silent until the base rolls back; a reconnect (docs/OCTATRACK_HARDWARE_TRAPS.md#usb-and-ep0) +- load and admission: the pick at the 85 % line with the delays quiet and open; the guard counters while playing (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) + +| Case | Why this change makes it a risk | How run | Result | +|---|---|---|---| +| DUB records into the loop | new: head 0 writes the window back as it plays; the writer stops | test_dub_records_the_track_into_the_loop; verify.py: DUB A-D looping at every slice, bit for bit; step 11 on the unit | passed | +| DUB keeps its window through the slice | the next chunk must not take a new window | test_dub_keeps_its_window_through_the_slice (TIME 1/2: one window for DUB, several for LAYER) | passed | +| VAR sets how long layers last | IN 0.5, 0.3, 0.15, 0.06 | test_var_sets_how_long_the_old_layers_last (kept A < B < C < D) | passed | +| LAYER and SLIDE unchanged | the write back is s0 itself with IN 0 | test_other_loops_leave_the_ring_as_it_was; verify.py LAYER and SLIDE bit for bit | passed | +| TYPE changed mid-loop (DUB to LAYER and back) | the writer frozen by DUB must record again; the window rule changes | verify.py's knob sweep (TYPE stepped while looping), bit for bit; step 11 on the unit | passed | +| Both DSP cores, six at once | three heads and a ring write every sample | step 7 (T1-T8); step 11 (T1 and T5) | passed: six placed, CPU 729, core 1 peak 773, core 0 peak 856 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The frame-cost curve, playing | the per-call work on the frame | step 9: `device:price --curve T1,T3,T6,T7` | passed: empty admitted (longest frame 37.2 %), medium admitted (92.4 %), 0 dropped | +| A chunk's events add up to the chunk | the loop keeps the grid | test_a_chunk_lasts_its_grid_while_looping (DUB and LAYER) | passed | +| TIME 1/2 at 30 BPM | the ring's reach | verify.py: 32 chunks, LAYER and DUB, bit for bit | passed in dsp_host; not run on the unit at 30 BPM | +| Silence and the tail | DUB feeds the loop back into itself | verify.py: silence in, silence out at every TYPE's dearest; a burst's tail (DUB) ends in silence; every TYPE falls silent within 6 s after the input stops | passed in dsp_host | +| Persistence | knob bytes saved in the Part | step 12, the author on the flashed base | passed (reported by the author): "everything survived" | + +#### Left for the submitter at their unit + +- how it sounds and plays, and timing by ear +- MIDI, scenes and recording with it +- it beside the other modules installed on their unit +- two instances with different settings, on both FX slots and both DSP cores where it can (docs/MODULE_QUALIFICATION.md) +- Part reload, project save and reload, and a power cycle with it saved: what survives (the Keep and the power cycle are theirs) + +#### For the pull request + +Tested on a unit: package 5d3bf7c3efc0, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on 5d3bf7c3: kept, played, Part reload and power cycle survived. +Edge cases: the table above, one row a case (or "Edge cases: none, because …"). + +#### The author's stage on 5d3bf7c3 (as reported) + +5 December 2026 (UTC), the author's MKII on their flashed base ddb56b72 (OS 1.40C): package 5d3bf7c3 kept in place of 4dc3d0cc beside the card's 20 other modules (`npm run device -- try loopbox.mwrm --seconds 60 --accept`: no crash, stall, freeze or skipped track; the kept set otherwise unchanged). The author played Loopbox (DUB among the types) on a track's FX2, saved the Part, reloaded it and power-cycled: "everything survived". Before the procedure they heard DUB on the same package in two RAM trials: "sounds great". + +### Test procedure: loopbox 0.1.1-experimental (package 4dc3d0cc, the code review's fixes), 2026-12-03 + +Build: revision `00bc3507a670`, package `loopbox.mwrm` SHA-256 `4dc3d0ccfef94b8c2ed2c4604065a7ed4ca1d9387b606e4725637a164766f2ad`. `npm run test:procedure -- loopbox --package /../loopbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run`, 585 s. Emulator results are not hardware evidence; only what ran on the unit is. + +| # | Step | Layer | Result | Command | Evidence | +|---|---|---|---|---|---| +| 1 | Software checks | host | passed | `npm run module:doctor -- --procedure loopbox` | logs/01-software.log | +| 2 | Beside every other module | contract | passed | `npm run modules:compat -- loopbox` | logs/02-compat.log | +| 3 | Name the build | host | passed | | logs/03-build.log | +| 4 | DSP cost model | contract | passed | `node scripts/cycle-scan.mjs check` | logs/04-cost-model.log | +| 5 | Emulator rehearsal | emulator | not run: no emulator session: left out with --no-emulator | | | +| 6 | Read the unit | unit | passed: Part 1 on A01: working = saved, saved once so that RELOAD works at the end | `node scripts/device.mjs status --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs read --socket /tmp/modwerk-share.sock --out /part-start.json`
`node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock` | logs/06-unit-read.log | +| 7 | Scripted unit pass | unit | passed | `npm run device:test -- --share /tmp/modwerk-share.sock --testing-entry /device-test.md /../loopbox.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: transport stopped, back on A01 from A04, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../loopbox.mwrm --seconds 420 --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-soak.mjs --seconds 120 --programs 0-3 --pc-channel 11 --auto-channel 11 --log /soak.json`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/08-soak.log | +| 9 | Cost on the unit | unit | passed | `npm run device:price -- --share /tmp/modwerk-share.sock --out /price.json --scene 'the bank, pattern and Part the unit was on, transport stopped (test:procedure)' --curve T1,T3,T6,T7 /../loopbox.mwrm` | logs/09-cost-unit.log | +| 10 | Put back | unit | passed: Part 1 on A01: nothing to put back; working = saved | `node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/10-restore.log | +| 11 | Agent by hand | unit | passed: on 4dc3d0cc, the pattern played 8 s at TIME 1/2, RPT 1, TAIL 127, WIDE 127 (the heads' changeover between chunks with the gain glides, the stereo side and the tail; freeze-set.png), frame interrupt peak 92.1 %, latest entry 7.2 us late while playing (0 in the guard's 80-190 us window), no skipped frame, stall or crash; STOP, Part reloaded, the trial rolled back. MAIN and CUE not recorded over USB: the recorder is not built on this computer | `device try`, `pick:T1:FX2:LOOPBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | freeze-set.png | +| 12 | Submitter's own stage | unit | done on 4dc3d0cc: see the author's stage below | | | + +#### Edge cases for this change + +Derive them from what the change touches and run each one (docs/TEST_PROCEDURE.md#edge-cases). A start, from the manifest and the changed files: + +- an effect slot: FX1 and FX2, both DSP cores, eight instances at once; one edited while another plays (docs/MODULE_QUALIFICATION.md#essential-persistence-and-instance-checks--8-october-2026) +- memory: the module pool nearly full; a delay buffer next to it; the largest set it can join (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- persistence: saved in a Part, then a Part reload, a project reload and a power cycle; removed while a saved Part still names it (docs/OCTATRACK_MODULE_EDGE_CASES.md#copying-and-saving) +- the loader: install, replace, remove and Undo; a set the base refuses rolls back whole; the pool full; a trial that expires with a page open (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- DSP code: DSP FULL; both cores; the receiver window; pipeline stalls the instruction count hides (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) +- the USB link: USB unplugged mid-transfer; the host silent until the base rolls back; a reconnect (docs/OCTATRACK_HARDWARE_TRAPS.md#usb-and-ep0) +- load and admission: the pick at the 85 % line with the delays quiet and open; the guard counters while playing (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) + +| Case | Why this change makes it a risk | How run | Result | +|---|---|---|---| +| Both DSP cores | the ring is read and written every sample, by three heads | step 7 (alone on T1, then T5); step 9 on T1 FX2 | passed: T1 peak 532 per mille of a frame, admitted in 117 ms; T5 peak 608 per mille, admitted in 119 ms; step 9 in use: DSP T1-T4 +13.4, frame +0 | +| Eight instances at once | each instance its own ring and 123 state words | step 7: picked on T1-T8 FX2, playing | passed: CPU 735, T1-4 peak 778, T5-8 peak 851 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The instance curve | the price of each instance on a busy pattern | step 9: `device:price --curve T1,T3,T6,T7` | noisy on this scene: adds -6.9, -0.3, -6.2, -6.5 points (every reading with it lower than without), recorded as rest 0, first 0, each 0; empty and medium admitted (longest frame 36.4 % and 90.9 %), 0 dropped, 0 stalls; empty and medium admitted, 0 dropped, 0 stalls | +| Heads changing over between chunks (TIME 1/2) | a head takes the newest window at its wrap; the writer must never reach a window still sounding | step 11 by hand; verify.py bit for bit at TIME 1/4 and 1/2 and at 30 BPM; test_reference.py: heads change over one by one | passed on the unit (no fault) and in dsp_host | +| A loop due while a tail froze the ring | it must not replay audio from before the freeze | verify.py and test_reference.py | passed in dsp_host | +| WIDE's stereo spread | the side signal bypasses the mono path | step 11 at WIDE 127; test_reference.py: L and R differ only with WIDE | passed | +| TIME 1/2 at 30 BPM | the ring's reach | verify.py, 32 chunks, LAYER and SHUFL | passed in dsp_host; not run on the unit at 30 BPM | +| STOP while looping (the silence watch) | loops follow the tempo, not the transport | verify.py: every TYPE and VAR silent 4.2 s after the input stops | passed in dsp_host | +| A Part change while installed | per-instance state and the ring across Parts | step 7 (Part switches) and step 8 (soak) | passed | +| A trial ending while in use | the loader rolls back a slot that runs it | step 8 | passed | +| Beside Sidechain Compressor | its key window starts right after the ring (+$3DFE) | not run | not run: the ring stops at +$3DFD (`Claims(buffer_words=15870)`) | + + +| A window shrinking under a head (RAND's repeats, RPT or TIME turned) | a head past the new end faded negative: an inverted burst (review) | test_reference.py: it lands at the start, fade never negative; verify.py bit for bit with every knob swept | passed in the model and dsp_host | +| A slow head the writer catches up with | the forced changeover cut it mid-fade (review) | test_reference.py: its gain falls every call inside the zone, then it changes over at its start | passed in the model and dsp_host | +| Loops keeping the TIME grid | each looping chunk ran up to RPT - 1 samples short (review) | test_reference.py: a chunk's events add up to the chunk | passed | +| SHUFL at its shortest | slices under a block fired late (review) | test_reference.py: a slice lasts at least 16 samples | passed | +| SLIDE with trig splits | the glide stepped twice for a split block (review) | test_reference.py: the same glide with and without splits, within 3 % | passed | +| Short windows | a 64-sample minimum fade kept them quiet (review) | test_reference.py: a 21-sample window reaches full level | passed | + +#### Left for the submitter at their unit + +- how it sounds and plays, and timing by ear +- MIDI, scenes and recording with it +- it beside the other modules installed on their unit +- two instances with different settings, on both FX slots and both DSP cores where it can (docs/MODULE_QUALIFICATION.md) +- Part reload, project save and reload, and a power cycle with it saved: what survives (the Keep and the power cycle are theirs) + +#### For the pull request + +Tested on a unit: package 4dc3d0ccfef9, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on 4dc3d0cc: kept, listened, Part and power cycle survived. +Edge cases: the table above, one row a case (or "Edge cases: none, because …"). + +The records below are 0.1.0-experimental's, on package 4537ab44. + +### Test procedure: loopbox 0.1.0-experimental, 2026-12-03 + +Build: revision `6d255caee5b6`, package `loopbox-exp.mwrm` SHA-256 `4537ab44f4d176c345681bdd7d2cf898e611eb9be5413e20a0d2110df4872157`. `npm run test:procedure -- loopbox --package /../loopbox-exp.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run2`, 588 s. Emulator results are not hardware evidence; only what ran on the unit is. + +| # | Step | Layer | Result | Command | Evidence | +|---|---|---|---|---|---| +| 1 | Software checks | host | passed | `npm run module:doctor -- --draft loopbox` | logs/01-software.log | +| 2 | Beside every other module | contract | not run: a draft is judged beside every other module by module:doctor --draft (its compatibility line, step 1) | | | +| 3 | Name the build | host | passed | | logs/03-build.log | +| 4 | DSP cost model | contract | passed | `node scripts/cycle-scan.mjs check` | logs/04-cost-model.log | +| 5 | Emulator rehearsal | emulator | not run: no emulator session: left out with --no-emulator | | | +| 6 | Read the unit | unit | passed: Part 1 on A01: working = saved, saved once so that RELOAD works at the end | `node scripts/device.mjs status --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs read --socket /tmp/modwerk-share.sock --out /part-start.json`
`node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock` | logs/06-unit-read.log | +| 7 | Scripted unit pass | unit | passed | `npm run device:test -- --share /tmp/modwerk-share.sock --testing-entry /device-test.md /../loopbox-exp.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: transport stopped, back on A01 from A03, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../loopbox-exp.mwrm --seconds 420 --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-soak.mjs --seconds 120 --programs 0-3 --pc-channel 11 --auto-channel 11 --log /soak.json`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/08-soak.log | +| 9 | Cost on the unit | unit | passed | `npm run device:price -- --share /tmp/modwerk-share.sock --out /price.json --scene 'the bank, pattern and Part the unit was on, transport stopped (test:procedure)' --curve T1,T3,T6,T7 /../loopbox-exp.mwrm` | logs/09-cost-unit.log | +| 10 | Put back | unit | passed: Part 1 on A01: nothing to put back; working = saved | `node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/10-restore.log | +| 11 | Agent by hand | unit | passed: on 4537ab44, the pattern played 8 s at TIME 1/2, RPT 1, TAIL 127, WIDE 127 (the heads' changeover between chunks, the stereo side and the tail; freeze-set.png), frame interrupt peak 86.8 %, latest entry 10.0 us late while playing (0 in the guard's 80-190 us window), no skipped frame, stall or crash; STOP, Part reloaded, the trial rolled back. MAIN and CUE not recorded over USB: the recorder is not built on this computer | `device try`, `pick:T1:FX2:LOOPBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | freeze-set.png | +| 12 | Submitter's own stage | unit | done on 4537ab44 (the same package): see the author's stage below | | | + +#### Edge cases for this change + +Derive them from what the change touches and run each one (docs/TEST_PROCEDURE.md#edge-cases). A start, from the manifest and the changed files: + +- an effect slot: FX1 and FX2, both DSP cores, eight instances at once; one edited while another plays (docs/MODULE_QUALIFICATION.md#essential-persistence-and-instance-checks--8-october-2026) +- persistence: saved in a Part, then a Part reload, a project reload and a power cycle; removed while a saved Part still names it (docs/OCTATRACK_MODULE_EDGE_CASES.md#copying-and-saving) +- the loader: install, replace, remove and Undo; a set the base refuses rolls back whole; the pool full; a trial that expires with a page open (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- DSP code: DSP FULL; both cores; the receiver window; pipeline stalls the instruction count hides (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) +- the USB link: USB unplugged mid-transfer; the host silent until the base rolls back; a reconnect (docs/OCTATRACK_HARDWARE_TRAPS.md#usb-and-ep0) +- load and admission: the pick at the 85 % line with the delays quiet and open; the guard counters while playing (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) + +| Case | Why this change makes it a risk | How run | Result | +|---|---|---|---| +| Both DSP cores | the ring is read and written every sample, by three heads | step 7 (alone on T1, then T5); step 9 on T1 FX2 | passed: T1 peak 507 per mille of a frame, admitted in 174 ms; T5 peak 593 per mille, admitted in 115 ms; step 9 in use: DSP T1-T4 +11.7, frame +0 | +| Eight instances at once | each instance its own ring and 123 state words | step 7: picked on T1-T8 FX2, playing | passed: CPU 725, T1-4 peak 745, T5-8 peak 818 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The instance curve | the price of each instance on a busy pattern | step 9: `device:price --curve T1,T3,T6,T7` | noisy on this scene: adds -0.6, -7.4, -3.8, -8.0 points (every reading with it lower than without), recorded as rest 6.8, first 0, each 0; empty and medium admitted, 0 dropped, 0 stalls | +| Heads changing over between chunks (TIME 1/2) | a head takes the newest window at its wrap; the writer must never reach a window still sounding | step 11 by hand; verify.py bit for bit at TIME 1/4 and 1/2 and at 30 BPM; test_reference.py: heads change over one by one | passed on the unit (no fault) and in dsp_host | +| A loop due while a tail froze the ring | it must not replay audio from before the freeze | verify.py and test_reference.py | passed in dsp_host | +| WIDE's stereo spread | the side signal bypasses the mono path | step 11 at WIDE 127; test_reference.py: L and R differ only with WIDE | passed | +| TIME 1/2 at 30 BPM | the ring's reach | verify.py, 32 chunks, LAYER and SHUFL | passed in dsp_host; not run on the unit at 30 BPM | +| STOP while looping (the silence watch) | loops follow the tempo, not the transport | verify.py: every TYPE and VAR silent 4.2 s after the input stops | passed in dsp_host | +| A Part change while installed | per-instance state and the ring across Parts | step 7 (Part switches) and step 8 (soak) | passed | +| A trial ending while in use | the loader rolls back a slot that runs it | step 8 | passed | +| Beside Sidechain Compressor | its key window starts right after the ring (+$3DFE) | not run | not run: the ring stops at +$3DFD (`Claims(buffer_words=15870)`) | + + +#### Left for the submitter at their unit + +- how it sounds and plays, and timing by ear +- MIDI, scenes and recording with it +- it beside the other modules installed on their unit +- two instances with different settings, on both FX slots and both DSP cores where it can (docs/MODULE_QUALIFICATION.md) +- Part reload, project save and reload, and a power cycle with it saved: what survives (the Keep and the power cycle are theirs) + +#### For the pull request + +Tested on a unit: package 4537ab44f4d1, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on the same package: kept, listened, Part and power cycle survived. +Edge cases: the table above, one row a case (or "Edge cases: none, because …"). + +After the run, step 9's price was measured again with the same package file named for its id (`npm run device:price -- … --curve T1,T3,T6,T7 loopbox.mwrm`, SHA-256 4537ab44): the run had named it loopbox-exp, which module:qualify could not match. At rest frame +0, CPU -0.4; in use frame +0, CPU -0.2, DSP +11.5; curve adds -0.2, -6.0, +0.3, -5.7 (first 0.3, each 0.3); empty and medium admitted, 0 dropped, 0 stalls. The run's own reading is kept beside it as price-as-loopbox-exp.json. + +The record below is the first run, under the version string 0.1.0 (the same package bytes, 4537ab44): module:qualify binds a record to its version, so the run above repeated it at 0.1.0-experimental. + +### Test procedure: loopbox 0.1.0, 2026-12-03 + +Build: revision `4b6d19e274fe`, package `loopbox.mwrm` SHA-256 `4537ab44f4d176c345681bdd7d2cf898e611eb9be5413e20a0d2110df4872157`. `npm run test:procedure -- loopbox --package /../loopbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run`, 588 s. Emulator results are not hardware evidence; only what ran on the unit is. + +| # | Step | Layer | Result | Command | Evidence | +|---|---|---|---|---|---| +| 1 | Software checks | host | passed | `npm run module:doctor -- --draft loopbox` | logs/01-software.log | +| 2 | Beside every other module | contract | not run: a draft is judged beside every other module by module:doctor --draft (its compatibility line, step 1) | | | +| 3 | Name the build | host | passed | | logs/03-build.log | +| 4 | DSP cost model | contract | passed | `node scripts/cycle-scan.mjs check` | logs/04-cost-model.log | +| 5 | Emulator rehearsal | emulator | not run: no emulator session: left out with --no-emulator | | | +| 6 | Read the unit | unit | passed: Part 1 on A01: working = saved, saved once so that RELOAD works at the end | `node scripts/device.mjs status --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs read --socket /tmp/modwerk-share.sock --out /part-start.json`
`node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock` | logs/06-unit-read.log | +| 7 | Scripted unit pass | unit | passed | `npm run device:test -- --share /tmp/modwerk-share.sock --testing-entry /device-test.md /../loopbox.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: transport stopped, back on A01 from A04, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../loopbox.mwrm --seconds 420 --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-soak.mjs --seconds 120 --programs 0-3 --pc-channel 11 --auto-channel 11 --log /soak.json`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/08-soak.log | +| 9 | Cost on the unit | unit | passed | `npm run device:price -- --share /tmp/modwerk-share.sock --out /price.json --scene 'the bank, pattern and Part the unit was on, transport stopped (test:procedure)' --curve T1,T3,T6,T7 /../loopbox.mwrm` | logs/09-cost-unit.log | +| 10 | Put back | unit | passed: Part 1 on A01: nothing to put back; working = saved | `node scripts/device.mjs do inventory --socket /tmp/modwerk-share.sock`
`node scripts/octatrack-part-state.mjs restore --socket /tmp/modwerk-share.sock --start /part-start.json` | logs/10-restore.log | +| 11 | Agent by hand | unit | passed: on 4537ab44, the pattern played 8 s at TIME 1/2, RPT 1, TAIL 127, WIDE 127 (the heads' changeover between chunks, the stereo side and the tail; freeze-set.png), frame interrupt peak 87.4 %, latest entry 7.4 us late while playing, no skipped frame, stall or crash; STOP, Part reloaded, the trial rolled back. Before PLAY the guard noted one entry 306 us late (0 in its 80-190 us window), most likely at the pick. MAIN and CUE not recorded over USB: the recorder is not built on this computer | `device try`, `pick:T1:FX2:LOOPBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | freeze-set.png | +| 12 | Submitter's own stage | unit | done on 4537ab44: see the author's stage below | | | + +#### Edge cases for this change + +Derive them from what the change touches and run each one (docs/TEST_PROCEDURE.md#edge-cases). A start, from the manifest and the changed files: + +- an effect slot: FX1 and FX2, both DSP cores, eight instances at once; one edited while another plays (docs/MODULE_QUALIFICATION.md#essential-persistence-and-instance-checks--8-october-2026) +- persistence: saved in a Part, then a Part reload, a project reload and a power cycle; removed while a saved Part still names it (docs/OCTATRACK_MODULE_EDGE_CASES.md#copying-and-saving) +- the loader: install, replace, remove and Undo; a set the base refuses rolls back whole; the pool full; a trial that expires with a page open (docs/OCTATRACK_HARDWARE_TRAPS.md#dsp-loader-dynamic-dsp-code) +- DSP code: DSP FULL; both cores; the receiver window; pipeline stalls the instruction count hides (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) +- the USB link: USB unplugged mid-transfer; the host silent until the base rolls back; a reconnect (docs/OCTATRACK_HARDWARE_TRAPS.md#usb-and-ep0) +- load and admission: the pick at the 85 % line with the delays quiet and open; the guard counters while playing (docs/OCTATRACK_HARDWARE_TRAPS.md#coldfire-and-dsp-load) + +| Case | Why this change makes it a risk | How run | Result | +|---|---|---|---| +| Both DSP cores | the ring is read and written every sample, by three heads | step 7 (alone on T1, then T5); step 9 on T1 FX2 | passed: T1 peak 514 per mille of a frame, admitted in 117 ms; T5 peak 584 per mille, admitted in 116 ms; step 9 in use: DSP T1-T4 +10.9, frame +0 | +| Eight instances at once | each instance its own ring and 123 state words | step 7: picked on T1-T8 FX2, playing | passed: CPU 723, T1-4 peak 780 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The instance curve | the price of each instance on a busy pattern | step 9: `device:price --curve T1,T3,T6,T7` | noisy on this scene: adds -5.2, -4.5, -4.4, -6.1 points (every reading with it lower than without), recorded as rest 3.8, first 0, each 0; empty and medium admitted, 0 dropped, 0 stalls | +| Heads changing over between chunks (TIME 1/2) | a head takes the newest window at its wrap; the writer must never reach a window still sounding | step 11 by hand; verify.py bit for bit at TIME 1/4 and 1/2 and at 30 BPM; test_reference.py: heads change over one by one | passed on the unit (no fault) and in dsp_host | +| A loop due while a tail froze the ring | it must not replay audio from before the freeze | verify.py and test_reference.py | passed in dsp_host | +| WIDE's stereo spread | the side signal bypasses the mono path | step 11 at WIDE 127; test_reference.py: L and R differ only with WIDE | passed | +| TIME 1/2 at 30 BPM | the ring's reach | verify.py, 32 chunks, LAYER and SHUFL | passed in dsp_host; not run on the unit at 30 BPM | +| STOP while looping (the silence watch) | loops follow the tempo, not the transport | verify.py: every TYPE and VAR silent 4.2 s after the input stops | passed in dsp_host | +| A Part change while installed | per-instance state and the ring across Parts | step 7 (Part switches) and step 8 (soak) | passed | +| A trial ending while in use | the loader rolls back a slot that runs it | step 8 | passed | +| Beside Sidechain Compressor | its key window starts right after the ring (+$3DFE) | not run | not run: the ring stops at +$3DFD (`Claims(buffer_words=15870)`) | + +#### Left for the submitter at their unit + +- how it sounds and plays, and timing by ear +- MIDI, scenes and recording with it +- it beside the other modules installed on their unit +- two instances with different settings, on both FX slots and both DSP cores where it can (docs/MODULE_QUALIFICATION.md) +- Part reload, project save and reload, and a power cycle with it saved: what survives (the Keep and the power cycle are theirs) + +#### For the pull request + +Tested on a unit: package 4537ab44f4d1, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on 4537ab44: kept, listened, Part and power cycle survived. +Edge cases: the table above, one row a case (or "Edge cases: none, because …"). + + +#### The author's stage (package 4537ab44) + +2 December 2026, the author's MKII on its flashed base ddb56b72 (OS 1.40C) after a power cycle: package 4537ab44 kept with `npm run device -- try --accept` beside the 26 kept modules (the card set read 27 modules after, nothing removed; no crash, stall, freeze or skipped track logged). Asked to put Loopbox on a track's FX2 and play it, save and reload the Part (and optionally the project), power-cycle and check it is still there with the same settings and sound. Reported: "everything sounds good and survived". + +## Stock flows + +Not tested. List the stock flows you compared with and without the module (docs/module-guides/README.md, Leave stock flows alone). + +## Sound quality + +Not tested. npm run fx:audit checks aliasing, DC, clipping and idle behaviour (docs/module-guides/effects.md, Sound quality). + +## Performance + +`python3 -B perf.py` in dsp_host (verify.py's synthetic image), then `npm run perf:audit -- check evidence/performance.json --stamp`, 5 December 2026, with DUB in place of SHUFL: + +- Static floor: 332 words in the per-sample loop (straight-line, no branch); DUB's write back adds 10. +- Measured, executed instructions a sample, 80 cases (defaults, the dearest setting for each TYPE, a moving pattern, each unsplit and with a trig split at every position 1-15): unsplit 325.0 (defaults) to 334.4 (dearest SLIDE); worst 360.1, the dearest SLIDE setting with a split of 2 frames. The package declares 363. +- Stress: eight instances, four a core, every parameter word changed every block, trig splits, -guard 0x4000 -guard-shared and -dirty: exit 0, no hang, 0 stray writes, 0 clobbers, per-core peaks 1439.5 and 1355.1. + +| Check | Result | +|---|---| +| record | dsp record for loopbox@0.1.0 | +| cycles | 4 x 332 = 1328 of 3120 per sample per core (43%), measured 360.1 per instance | +| stock benchmark | 360.1 vs SPRING REV 314.19 (1.15x); the dearest stock effect is 330.94; justified in the record | +| stress | 4 per core, eight tracks, 3 LFOs and 12 locked slots, 2 s, no clobber, no hang | diff --git a/sdk/octatrack/modules/loopbox/engine.asm b/sdk/octatrack/modules/loopbox/engine.asm new file mode 100644 index 0000000000..f2d74f06b5 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/engine.asm @@ -0,0 +1,1587 @@ +; LOOPBOX -- an original micro-loop effect for FX2 of any track. +; Copyright (c) 2026 jrs1717, MIT (LICENSE). +; +; The track's mono sum, at a quarter of full scale, goes into a ring of +; 15,870 words in the FX2 slot's own buffer (it stops at +$3DFD, so +; Sidechain Compressor's key window stays free). On an FX1-sized slot +; (allocator base under $4000) the frames pass dry. +; +; A slice is TIME (1/64 to 1/2) at the project's tempo (tempo24 at r6+$13). +; It plays as 1, 2, 4, 8, 16 or 32 chunks of at most 7,900 samples. At each +; slice boundary, judged at the start of a call (a block of 16 frames at most) +; and with a chunk captured, ACT is the chance that the slice loops. Each chunk +; of a loop makes the latest chunk / RPT of the ring the newest window, played +; by three read heads: +; LAYER heads at 1/2, 1/4 and 1/4: the loop at its speed, and A an octave +; up and down, B a fifth up and a fourth down, C reversed and an +; octave down, D two random speeds +; DUB head 0 loops the window and writes it back as it plays: the old +; sample x (1 - IN) + the live track x IN (A 0.5, B 0.3, C 0.15, +; D 0.06), sound-on-sound; the writer stops and the window is kept +; through the whole slice, and records again when the loop ends +; SLIDE heads 1 and 2, half a window apart, gliding over the chunk by +; x (1 + c x frames / 16) a call, even in semitones: A up an octave, B down an +; octave, C one up and one down, D to a random speed +; Every head wraps at the newest window's length and, at a wrap, takes the +; newest window: there its fade, min(p, W - p) x K (K = 2^25 / F, F the +; window x SHAP's share, at least 64 samples, at most half the window, never +; under 5), is nothing, so the heads change over one by one and old and new +; loops overlap without a click; a head still past the end after a wrap (the +; window shrank under it) lands at the start. Each head's gain moves an eighth +; of the way to its target a call: TYPE's, or nothing while the writer nears a +; window it still plays, where it takes the newest window once faded out. +; A chunk's last event takes what is left of it, so loops keep the grid; a +; DUB loop keeps its window for every chunk of its slice. A loop that +; starts from silence sets every head on its window at once. The loop's level +; G rises to whole in about 5 ms when a loop starts and, when it ends, falls at +; TAIL's rate (about 50 ms to -60 dB at 0, 3 s at 127) while the heads loop on, +; steady in pitch; a loop starting over a tail picks up from there. WIDE spreads +; heads 1 and 2 left and right (LAYER, SLIDE) or ping-pongs DUB's passes. +; Should the writer come within 32 samples of a window still sounding during a +; tail, the ring freezes. After a second of silence in no loop starts; after +; four, any loop or tail stops and the ring records again. +; +; Knobs (value<<16): page 1 TIME r6+0 (0-5), ACT r6+1, SHAP r6+2, RPT r6+3 +; (0-7: 1-8 cycles), MIX r6+4, TAIL r6+5; page 2 TYPE slot 6 (r6+$c bits 16-23, +; 0-2), DIRT slot 7, VAR slot 8 (r6+$d bits 16-23, 0-3), WIDE slot 9, RAND +; slot 10, DGRD slot 11. MIX glides per sample and snaps within 64 LSB. Between +; loops the track plays dry (a tail echoes over it at MIX); while a loop plays +; the dry ducks by D x G (D = 4/3 MIX, whole at 96); from 96 to 127 the dry +; fades out everywhere: 127 is the loops alone. +; +; State (X, offsets from r7; init clears $00..$7a): +; $00 ring base (Y) $01 live (an FX2-sized slot) $02 write index +; $03 the write step (1) $04 samples captured $05 LFSR $06 playing +; $07 samples into the slice (after an event: how late it is) $08 a chunk +; $09 events left in the chunk $0a event number $0b head 0's window (Y) +; $0d/$0e head 0 position hi/lo $0f head 0 rate (Q21) +; $10 the newest window (Y) $11 its W, the length less one $13 K, the heads' fade slope +; $14 crush mask (whole) $15 G, the loop's level $16 the loop (chunk / RPT) $17 G's rate +; $18 a tail playing $19 samples to the next event $1a/$1b MIX target/run $1c the dry's gain +; $1d TYPE $1e VAR $1f ACT $20 G's target $21 RPT $22 TIME $23 tempo24 +; $24-$27 the speeds T0 (Q21) $28-$2b |ln T0| / 2 (Q23) $2c seeded $2e/$2f the frame's L/R +; $30 the heads' sum $32 TAIL's decay $33 SHAP's share of a window $34 the chunk now +; $36-$3b LAYER's speeds for A-C $3c/$3d the side's gains (heads 1 and 2) $3f P (1 in a loop) +; $40 chunks in a slice of TIME $41 the chunk's place in it $42 chunks left in the loop +; $43 D, the loop's gain $44 K, the dry's ceiling $45 events in a chunk (RPT) +; $46 the crush mask (DIRT's) $47 DIRT's hold N $48 its countdown $49 the held sample +; $4a/$4b DIRT's drive and level $4c/$4d WIDE's ping-pong gains $4e WIDE $4f RAND $50 DGRD +; $51 DIRT $52 scratch $53 samples of silence in $54 the call's loudest input +; $55-$57 the heads' faded reads (scratch) $58-$5f DIRT's crush masks +; $60-$62 head 1: position hi/lo, rate $63 its glide $64 its gain +; $65-$67 head 2: the same $68 its glide $69 its gain $6b head 0's gain +; $6c 1 $6d the loop $6e the newest window's ring index $12/$35 DUB's write back: -IN and IN +; $3e the input word (a sample) $79 a DUB going on keeps its window +; $77 the side $78 head 1's window (Y) $7a head 2's window (Y) +; Nothing above $7a is touched. Every product is the signed mpy/mac x0,y1 +; form. Labels are gb and two characters, so none is another's prefix. +; CYCLES_FORWARD_BRANCHES +init: + clr a + move r7,r5 + move #>$ffffff,m5 + do #$7b,>gbi0 + move a,x:(r5)+ +gbi0: + nop + move x:>$213,r4 + move #>$ffffff,m4 + nop + move x:(r4),x0 + move x0,x:(r7+$00) + move x0,x:(r7+$0b) + move x0,x:(r7+$78) + move x0,x:(r7+$7a) + move x0,x:(r7+$10) + move x0,a + move #>$4000,x0 + sub x0,a + clr b + move #>$1,x0 + tst a + tpl x0,b + move b,x:(r7+$01) + move #>$1,x0 + move x0,x:(r7+$03) + move #>$123456,x0 + move x0,x:(r7+$05) + move #>$080000,x0 + move x0,x:(r7+$24) + move #>$100000,x0 + move x0,x:(r7+$25) + move #>$400000,x0 + move x0,x:(r7+$26) + move #>$600000,x0 + move x0,x:(r7+$27) + move #>$400000,x0 + move x0,x:(r7+$36) + move #>$100000,x0 + move x0,x:(r7+$37) + move #>$2ff222,x0 + move x0,x:(r7+$38) + move #>$17f911,x0 + move x0,x:(r7+$39) + move #>$e00000,x0 + move x0,x:(r7+$3a) + move #>$100000,x0 + move x0,x:(r7+$3b) + move #>$ffffff,x0 + move x0,x:(r7+$14) + move #>$58b90c,x0 + move x0,x:(r7+$28) + move #>$2c5c86,x0 + move x0,x:(r7+$29) + move #>$2c5c86,x0 + move x0,x:(r7+$2a) + move #>$464faa,x0 + move x0,x:(r7+$2b) + move #>$ffffff,x0 + move x0,x:(r7+$58) + move #>$fff000,x0 + move x0,x:(r7+$59) + move #>$ffc000,x0 + move x0,x:(r7+$5a) + move #>$ff8000,x0 + move x0,x:(r7+$5b) + move #>$ff0000,x0 + move x0,x:(r7+$5c) + move #>$fe0000,x0 + move x0,x:(r7+$5d) + move #>$fc0000,x0 + move x0,x:(r7+$5e) + move #>$f80000,x0 + move x0,x:(r7+$5f) + rts + +proc: + move x:(r7+$01),a + tst a + beq gbzz + move #>$ffffff,m4 + move #>$ffffff,m5 +; TIME: slot 0, at most 5 + move x:(r6+$0),a + and #>$7f0000,a + asr #$10,a,a + move #>$5,x0 + cmp x0,a + tgt x0,a + move a1,x:(r7+$22) +; ACT, tempered: 127 glitches about 70 % of the slices + move x:(r6+$1),a + and #>$7fffff,a + move a1,x0 + move #>$5a0000,y1 + mpy x0,y1,a + move a,x:(r7+$1f) +; SHAP: the fade is 1/64 of a repeat at 0, rising evenly to 1/2: +; Am = 1 / (1 + 31 s), as (2^41 - 2) over 2 x 2^17 (1 + 31 s) + move x:(r6+$2),a + and #>$7fffff,a + move a1,x0 + move #>$3e0000,y1 + mpy x0,y1,b + move b1,x0 + move #>$20000,b + add x0,b + move b1,x0 + move x0,x:(r7+$33) +; RPT: slot 3, 0-7, one more repeat + move x:(r6+$3),a + and #>$7f0000,a + asr #$10,a,a + move #>$7,x0 + cmp x0,a + tgt x0,a + add #>$1,a + move a1,x:(r7+$21) +; TAIL: slot 5; 0 no tail, else the decay a sample, c_min + (c_max - c_min)(1 - t)^3 + move x:(r6+$5),a + and #>$7fffff,a + move a1,x1 + move #>$7fffff,a + sub x1,a + move a,x0 + move x0,y1 + mpy x0,y1,a + move a,y1 + mpy x0,y1,a + move a,x0 + move #>$0064ea,y1 + mpy x0,y1,a + move #>$0001b6,y0 + add y0,a + move a,x:(r7+$32) +; MIX: 127 and above exactly full wet + move x:(r6+$4),a + and #>$7fffff,a + move a1,x0 + move x0,a + move #>$7f0000,y0 + cmp y0,a + move #>$7fffff,y1 + tge y1,a + move a1,x:(r7+$1a) +; TYPE: slot 6, at most 2 + move x:(r6+$c),a + and #>$7f0000,a + asr #$10,a,a + move #>$2,x0 + cmp x0,a + tgt x0,a + move a1,x:(r7+$1d) +; VAR: slot 8, at most 3 + move x:(r6+$d),a + and #>$7f0000,a + asr #$10,a,a + move #>$3,x0 + cmp x0,a + tgt x0,a + move a1,x:(r7+$1e) +; DIRT slot 7 (r6+$c bits 8-15), WIDE slot 9 (r6+$d bits 8-15), RAND slot 10 (r6+$e bits 16-23), +; DGRD slot 11 (r6+$e bits 8-15), each as v<<16. + move x:(r6+$c),a + and #>$00ff00,a + asl #8,a,a + move a1,x:(r7+$51) + move x:(r6+$d),a + and #>$00ff00,a + asl #8,a,a + move a1,x:(r7+$4e) + move x:(r6+$e),a + and #>$7f0000,a + move a1,x:(r7+$4f) + move x:(r6+$e),a + and #>$00ff00,a + asl #8,a,a + move a1,x:(r7+$50) +; tempo24, clean; none or under 30 BPM is 120, over 300 is 300 + move x:(r6+$13),b + asr #$8,b,b + move b1,x0 + move x0,b + move #>$2d0,x0 + cmp x0,b + move #>$b40,x0 + tlt x0,b + move #>$1c20,x0 + cmp x0,b + tgt x0,b + move b1,x:(r7+$23) +; L = TIME's samples: 2 x samples-per-note x tempo24 over 2 tempo24 + move x:(r7+$22),b + move #>$0,a + move #>$791fd0,a0 + move #>$1,x0 + cmp x0,b + blt gbtd + move #>$0,a + move #>$f23fa0,a0 + move #>$2,x0 + cmp x0,b + blt gbtd + move #>$1,a + move #>$e47f40,a0 + move #>$3,x0 + cmp x0,b + blt gbtd + move #>$3,a + move #>$c8fe80,a0 + move #>$4,x0 + cmp x0,b + blt gbtd + move #>$7,a + move #>$91fd00,a0 + move #>$5,x0 + cmp x0,b + blt gbtd + move #>$f,a + move #>$23fa00,a0 +gbtd: + move x:(r7+$23),x0 + bsr gbdi + move x0,b + move #>$1,x1 + move #>7900,x0 + cmp x0,b + ble gbh1 + asr #$1,b,b + move b1,y0 + move y0,b + move x1,a + asl #1,a,a + move a1,x1 +gbh1: + cmp x0,b + ble gbh2 + asr #$1,b,b + move b1,y0 + move y0,b + move x1,a + asl #1,a,a + move a1,x1 +gbh2: + cmp x0,b + ble gbh3 + asr #$1,b,b + move b1,y0 + move y0,b + move x1,a + asl #1,a,a + move a1,x1 +gbh3: + cmp x0,b + ble gbh4 + asr #$1,b,b + move b1,y0 + move y0,b + move x1,a + asl #1,a,a + move a1,x1 +gbh4: + cmp x0,b + ble gbh5 + asr #$1,b,b + move b1,y0 + move y0,b + move x1,a + asl #1,a,a + move a1,x1 +gbh5: + move b1,x:(r7+$08) + move x1,x:(r7+$40) +; The first call after init starts MIX on its target and the clock on L. + move x:(r7+$2c),a + tst a + bne gbsd + move x:(r7+$1a),x0 + move x0,x:(r7+$1b) + move #>$7fffff,x0 + move x0,x:(r7+$1c) + move x:(r7+$08),x0 + move x0,x:(r7+$19) + move #>$1,x0 + move x0,x:(r7+$2c) +gbsd: + move x:(r7+$1a),a + move x:(r7+$1b),x0 + sub x0,a + abs a + move #>64,x0 + cmp x0,a + move x:(r7+$1b),b + move x:(r7+$1a),y0 + tlt y0,b + move b1,x:(r7+$1b) +; The tail: over below -72 dB; the writer kept off every window still sounding (the newest, each head's with a +; gain) by a freeze. + move x:(r7+$18),a + tst a + beq gbt9 + move x:(r7+$15),a + move #>$002000,x0 + cmp x0,a + bge gbt5 + bsr gbqt + bra gbt9 +gbt5: + move x:(r7+$03),a + tst a + beq gbt9 + clr b + move x:(r7+$10),a + bsr gbdd + move #>32,x0 + cmp x0,a + bgt gbf1 + move #>$1,b +gbf1: + move x:(r7+$6b),a + tst a + beq gbf2 + move x:(r7+$0b),a + bsr gbdd + move #>32,x0 + cmp x0,a + bgt gbf2 + move #>$1,b +gbf2: + move x:(r7+$64),a + tst a + beq gbf3 + move x:(r7+$78),a + bsr gbdd + move #>32,x0 + cmp x0,a + bgt gbf3 + move #>$1,b +gbf3: + move x:(r7+$69),a + tst a + beq gbf4 + move x:(r7+$7a),a + bsr gbdd + move #>32,x0 + cmp x0,a + bgt gbf4 + move #>$1,b +gbf4: + tst b + beq gbt9 + clr a + move a,x:(r7+$03) +gbt9: +; Neither a glitch nor a tail, and frozen: record again, from nothing captured. + move x:(r7+$03),a + tst a + bne gbt8 + move x:(r7+$06),a + tst a + bne gbt8 + move x:(r7+$18),a + tst a + bne gbt8 + move #>$1,x0 + move x0,x:(r7+$03) + clr a + move a,x:(r7+$04) +gbt8: +; Four seconds of silence in (the transport stopped): no loop, no tail, and the ring records again. + move x:(r7+$53),a + move #>176400,x0 + cmp x0,a + blt gbz1 + bsr gbqt + clr b + move b,x:(r7+$06) + move b,x:(r7+$04) + move #>$1,x0 + move x0,x:(r7+$03) +gbz1: +; A slice boundary: the next repeat, the end of a glitch, or the decision. + move x:(r7+$07),a + move x:(r7+$19),x0 + cmp x0,a + blt gbnv + bsr gbev +gbnv: +; Each head's gain an eighth of the way to its target a call: TYPE's ($55-$57, gbtg), or nothing while the writer +; nears a window the head still plays; close enough, while a loop plays, the head takes the newest window, faded out. + bsr gbtg + move x:(r7+$0b),x0 + move x:(r7+$10),a + cmp x0,a + beq gba1 + move x0,a + bsr gbdd + move #>1088,x0 + cmp x0,a + bgt gbb1 + clr b + move b,x:(r7+$55) +gbb1: + move x:(r7+$06),b + tst b + beq gba1 + move #>64,x0 + cmp x0,a + bgt gba1 + move x:(r7+$10),x0 + move x0,x:(r7+$0b) + clr b + move b,x:(r7+$0d) + move b,x:(r7+$0e) +gba1: + move x:(r7+$55),a + move x:(r7+$6b),x0 + sub x0,a + asr #3,a,a + add x0,a + move a1,x:(r7+$6b) + move x:(r7+$78),x0 + move x:(r7+$10),a + cmp x0,a + beq gba2 + move x0,a + bsr gbdd + move #>1088,x0 + cmp x0,a + bgt gbb2 + clr b + move b,x:(r7+$56) +gbb2: + move x:(r7+$06),b + tst b + beq gba2 + move #>64,x0 + cmp x0,a + bgt gba2 + move x:(r7+$10),x0 + move x0,x:(r7+$78) + clr b + move b,x:(r7+$60) + move b,x:(r7+$61) +gba2: + move x:(r7+$56),a + move x:(r7+$64),x0 + sub x0,a + asr #3,a,a + add x0,a + move a1,x:(r7+$64) + move x:(r7+$7a),x0 + move x:(r7+$10),a + cmp x0,a + beq gba3 + move x0,a + bsr gbdd + move #>1088,x0 + cmp x0,a + bgt gbb3 + clr b + move b,x:(r7+$57) +gbb3: + move x:(r7+$06),b + tst b + beq gba3 + move #>64,x0 + cmp x0,a + bgt gba3 + move x:(r7+$10),x0 + move x0,x:(r7+$7a) + clr b + move b,x:(r7+$65) + move b,x:(r7+$66) +gba3: + move x:(r7+$57),a + move x:(r7+$69),x0 + sub x0,a + asr #3,a,a + add x0,a + move a1,x:(r7+$69) +; The side's gains: WIDE spreads heads 1 and 2 at their gains now (LAYER, SLIDE); none for DUB. + move x:(r7+$1d),a + move #>$1,x0 + cmp x0,a + bne gbsx + clr a + move a,x:(r7+$3c) + move a,x:(r7+$3d) + bra gbsy +gbsx: + move x:(r7+$4e),y1 + move x:(r7+$64),x0 + mpy x0,y1,a + move a,x:(r7+$3c) + move x:(r7+$69),x0 + mpy x0,y1,a + neg a + move a,x:(r7+$3d) +gbsy: +; SLIDE's glides: each rate x (1 + c x frames / 16) a call, even in semitones whatever the splits. + move n7,a + asl #18,a,a + move a1,y0 + move x:(r7+$63),x0 + move y0,y1 + mpy x0,y1,a + asl #1,a,a + move a,x0 + move x:(r7+$62),y1 + mpy x0,y1,a + move x:(r7+$62),x0 + add x0,a + move a1,x:(r7+$62) + move x:(r7+$68),x0 + move y0,y1 + mpy x0,y1,a + asl #1,a,a + move a,x0 + move x:(r7+$67),y1 + mpy x0,y1,a + move x:(r7+$67),x0 + add x0,a + move a1,x:(r7+$67) +; P: 1 while a glitch plays, else 0 (a tail echoes over the whole track). + move x:(r7+$06),b + move #>$7fffff,x0 + clr a + tst b + tne x0,a + move a1,x:(r7+$3f) +; DUB: while a DUB loop plays, head 0 writes back s0 x (1 - IN) + the input x IN ($12 = -IN, $35 = IN, VAR's +; IN: A 0.5, B 0.3, C 0.15, D 0.06); else nothing. + clr a + move a,x:(r7+$12) + move a,x:(r7+$35) + move x:(r7+$06),a + tst a + beq gbv5 + move x:(r7+$1d),a + move #>$1,x0 + cmp x0,a + bne gbv5 + move x:(r7+$1e),b + move #>$400000,x0 + move #>$1,y0 + cmp y0,b + blt gbv4 + move #>$266666,x0 + move #>$2,y0 + cmp y0,b + blt gbv4 + move #>$133333,x0 + move #>$3,y0 + cmp y0,b + blt gbv4 + move #>$07ae14,x0 +gbv4: + move x0,x:(r7+$35) + move x0,a + neg a + move a,x:(r7+$12) +gbv5: +; d = DIRT, and in a tail DGRD x how far it has faded: the crush (MASKS[d/16] with VAR's), the hold +; (a new sample every 1 + d/8), the drive (x (1/4 + 3/4 d) x 4, clipped, then x (1 - d/2)). + move x:(r7+$51),a + move x:(r7+$18),b + tst b + beq gbd1 + move x:(r7+$15),x0 + move #>$7fffff,b + sub x0,b + move b,x0 + move x:(r7+$50),y1 + mpy x0,y1,b + add b,a +gbd1: + move a,x0 + move x0,a + asr #20,a,a + add #>$58,a + move a1,n1 + move r7,r1 + move #>$ffffff,m1 + nop + move x:(r1+n1),y0 + move x:(r7+$14),a + and y0,a + move a1,x:(r7+$46) + move x0,a + asr #19,a,a + add #>$1,a + move a1,x:(r7+$47) + move #>$600000,y1 + mpy x0,y1,a + add #>$200000,a + move a,x:(r7+$4a) + move x0,a + asr #1,a,a + move a1,y0 + move #>$7fffff,b + sub y0,b + move b,x:(r7+$4b) + move x:(r7+$00),a + move x:(r7+$02),x0 + add x0,a + move a1,r4 + move #>$3dfd,m4 + move x:(r7+$03),n4 + move #>$3dfd,m5 + move #>$1,n0 + do n7,>gbsl +; MIX glides; D = 4/3 MIX (whole at 96), K = 4 (1 - MIX) (the dry's ceiling: whole up to 96, none at 127) + move x:(r7+$1a),a + move x:(r7+$1b),x0 + sub x0,a + asr #6,a,a + add x0,a + move a1,x:(r7+$1b) + move x:(r7+$1b),x0 + move #>$2aaaab,y1 + mpy x0,y1,a + add x0,a + move a,x:(r7+$43) + move #>$7fffff,a + sub x0,a + asl #2,a,a + move a,x:(r7+$44) +; The frame, and the ring at a quarter of the mono sum. + move x:(r0),x1 + move x:(r0+n0),y0 + move x1,x:(r7+$2e) + move y0,x:(r7+$2f) + move x1,a + add y0,a + asr #2,a,a + move a,y:(r4) + move a,x:(r7+$3e) + move (r4)+n4 +; The input's loudest sample this call, for the silence watch (the mono ring word: what a glitch can replay). + move a,x0 + move x0,a + abs a + move x:(r7+$54),b + cmp a,b + tlt a,b + move b1,x:(r7+$54) +; Head 0: position += rate, wrapped into [0, W) (W the newest window's); at a wrap it takes the newest +; window, where its fade is nothing; faded by min(p, W - p) x K; an interpolated read, faded, to $55. + move x:(r7+$0d),a + move x:(r7+$0e),a0 + move x:(r7+$0f),b + asr #21,b,b + add b,a + move x:(r7+$11),x0 + clr b + cmp x0,a + tge x0,b + sub b,a + move b,x1 + clr b + cmp x0,a + tge b,a + tst a + tlt x0,b + add b,a + add x1,b + move x:(r7+$0b),b + move x:(r7+$10),y1 + tne y1,b + move b1,x:(r7+$0b) + move b1,r5 + move a1,x:(r7+$0d) + move a0,x:(r7+$0e) + move a1,n5 + move a0,b + lsr b + move b1,y0 + move x0,b + sub a,b + cmp b,a + tgt b,a + move a1,x0 + move x:(r7+$13),y1 + mpy x0,y1,a + asl #22,a,a + move a,x1 + move (r5)+n5 + move y:(r5)+,a +; DUB's write back: s0 + s0 x -IN + the input x IN (with IN 0, s0 itself: the ring as it was) + move a,x0 + move x:(r7+$12),y1 + tfr a,b + mac x0,y1,b + move x:(r7+$3e),x0 + move x:(r7+$35),y1 + mac x0,y1,b + move (r5)- + move b,y:(r5)+ + move y:(r5),b + sub a,b + move b,x0 + move y0,y1 + mac x0,y1,a + move a1,y1 + move x1,x0 + mpy x0,y1,a + move a,x:(r7+$55) +; Head 1: position += rate, wrapped into [0, W) (W the newest window's); at a wrap it takes the newest +; window, where its fade is nothing; faded by min(p, W - p) x K; an interpolated read, faded, to $56. + move x:(r7+$60),a + move x:(r7+$61),a0 + move x:(r7+$62),b + asr #21,b,b + add b,a + move x:(r7+$11),x0 + clr b + cmp x0,a + tge x0,b + sub b,a + move b,x1 + clr b + cmp x0,a + tge b,a + tst a + tlt x0,b + add b,a + add x1,b + move x:(r7+$78),b + move x:(r7+$10),y1 + tne y1,b + move b1,x:(r7+$78) + move b1,r5 + move a1,x:(r7+$60) + move a0,x:(r7+$61) + move a1,n5 + move a0,b + lsr b + move b1,y0 + move x0,b + sub a,b + cmp b,a + tgt b,a + move a1,x0 + move x:(r7+$13),y1 + mpy x0,y1,a + asl #22,a,a + move a,x1 + move (r5)+n5 + move y:(r5)+,a + move y:(r5),b + sub a,b + move b,x0 + move y0,y1 + mac x0,y1,a + move a1,y1 + move x1,x0 + mpy x0,y1,a + move a,x:(r7+$56) +; Head 2: position += rate, wrapped into [0, W) (W the newest window's); at a wrap it takes the newest +; window, where its fade is nothing; faded by min(p, W - p) x K; an interpolated read, faded, to $57. + move x:(r7+$65),a + move x:(r7+$66),a0 + move x:(r7+$67),b + asr #21,b,b + add b,a + move x:(r7+$11),x0 + clr b + cmp x0,a + tge x0,b + sub b,a + move b,x1 + clr b + cmp x0,a + tge b,a + tst a + tlt x0,b + add b,a + add x1,b + move x:(r7+$7a),b + move x:(r7+$10),y1 + tne y1,b + move b1,x:(r7+$7a) + move b1,r5 + move a1,x:(r7+$65) + move a0,x:(r7+$66) + move a1,n5 + move a0,b + lsr b + move b1,y0 + move x0,b + sub a,b + cmp b,a + tgt b,a + move a1,x0 + move x:(r7+$13),y1 + mpy x0,y1,a + asl #22,a,a + move a,x1 + move (r5)+n5 + move y:(r5)+,a + move y:(r5),b + sub a,b + move b,x0 + move y0,y1 + mac x0,y1,a + move a1,y1 + move x1,x0 + mpy x0,y1,a + move a,x:(r7+$57) +; The heads at their gains, then the crush mask (DIRT's); and the side: heads 1 and 2 apart, at WIDE. + move x:(r7+$55),x0 + move x:(r7+$6b),y1 + mpy x0,y1,a + move x:(r7+$56),x0 + move x:(r7+$64),y1 + mac x0,y1,a + move x:(r7+$57),x0 + move x:(r7+$69),y1 + mac x0,y1,a + move x:(r7+$46),x0 + and x0,a + move a1,x:(r7+$30) + move x:(r7+$56),x0 + move x:(r7+$3c),y1 + mpy x0,y1,a + move x:(r7+$57),x0 + move x:(r7+$3d),y1 + mac x0,y1,a + move a,x:(r7+$77) +; DIRT's hold: a new sample every N. + move x:(r7+$48),a + sub #>$1,a + move x:(r7+$49),b + move x:(r7+$30),x1 + move x:(r7+$47),x0 + tle x1,b + tle x0,a + move a1,x:(r7+$48) + move b,x:(r7+$49) +; The dry ducks under the loop as its level G rises: 1 - D x G x P, at most K, so from MIX 96 to 127 the dry +; fades out everywhere. G stays in y0 to the end of the sample. + move x:(r7+$15),y0 + move y0,y1 + move x:(r7+$3f),x0 + mpy x0,y1,a + move a,x0 + move x:(r7+$43),y1 + mpy x0,y1,a + move a,x0 + move #>$7fffff,a + sub x0,a + move x:(r7+$44),x0 + cmp x0,a + tgt x0,a + move a,x:(r7+$1c) +; The loop: the held sum x 2, half the mono sum, as loud as the dry track for a mono sample; DIRT's drive, +; clipped at full scale, and its level; at G. + move x:(r7+$49),a + asl #1,a,a + move a,x0 + move x:(r7+$4a),y1 + mpy x0,y1,a + asl #2,a,a + move a,x0 + move x:(r7+$4b),y1 + mpy x0,y1,a + move a,x0 + move y0,y1 + mpy x0,y1,a + move a,x0 + move x:(r7+$43),y1 + mpy x0,y1,a + move a,x1 +; The side at G and D, x 2. + move x:(r7+$77),x0 + move y0,y1 + mpy x0,y1,a + move a,x0 + move x:(r7+$43),y1 + mpy x0,y1,a + asl #1,a,a + move a,x:(r7+$77) +; G toward its target at its rate: the 5 ms rise of a loop, or the tail's decay. + move x:(r7+$20),a + sub y0,a + move a,x0 + move x:(r7+$17),y1 + mpy x0,y1,a + add y0,a + move a1,x:(r7+$15) +; Left and right: the loop at D (x1) x WIDE's ping-pong + dry x its gain, plus and minus the side. + move x1,x0 + move x:(r7+$4c),y1 + mpy x0,y1,a + move x:(r7+$2e),x0 + move x:(r7+$1c),y1 + mac x0,y1,a + move x:(r7+$77),x0 + add x0,a + move a,x:(r0)+ + move x1,x0 + move x:(r7+$4d),y1 + mpy x0,y1,a + move x:(r7+$2f),x0 + move x:(r7+$1c),y1 + mac x0,y1,a + move x:(r7+$77),x0 + sub x0,a + move a,x:(r0)+ +gbsl: + nop + move r4,a + move x:(r7+$00),x0 + sub x0,a + move a1,x:(r7+$02) + move n7,x0 + move x:(r7+$07),a + add x0,a + move a1,x:(r7+$07) +; The silence watch: samples since the input last reached 64 LSB (at most $100000). + move x:(r7+$53),b + add x0,b + move #>$100000,x1 + cmp x1,b + tgt x1,b + move x:(r7+$54),a + move #>64,y1 + cmp y1,a + move #>$0,y0 + tge y0,b + move b1,x:(r7+$53) + clr a + move a,x:(r7+$54) + move x:(r7+$03),b + tst b + beq gbzz + move x:(r7+$04),a + add x0,a + move #>15854,y0 + cmp y0,a + tgt y0,a + move a1,x:(r7+$04) +; Back to linear addressing, as the code after us expects: m4 and m5 held the ring's modulus. +gbzz: + move #>$ffffff,m4 + move #>$ffffff,m5 + rts + +; A slice boundary. +gbev: + move x:(r7+$07),a + move x:(r7+$19),x0 + sub x0,a + cmp x0,a + move #>$0,y0 + tge y0,a + move a1,x:(r7+$07) + move x:(r7+$06),a + tst a + beq gbiw + move x:(r7+$09),a + sub #>$1,a + move a1,x:(r7+$09) + tst a + beq gbce + move x:(r7+$0a),a + add #>$1,a + move a1,x:(r7+$0a) + bsr gbsr + rts +; A chunk is over: the glitch goes on through its slice of TIME, or ends. +gbce: + bsr gbgp + move x:(r7+$42),a + sub #>$1,a + move a1,x:(r7+$42) + tst a + bgt gbcs +; The glitch is over. +gbst: + clr a + move a,x:(r7+$06) + move a,x:(r7+$20) + move a,x:(r7+$63) + move a,x:(r7+$68) +; A DUB froze the writer: record again, from nothing captured. + move x:(r7+$03),b + tst b + bne gbv6 + move #>$1,x0 + move x0,x:(r7+$03) + move a,x:(r7+$04) +gbv6: + move #>$1,x0 + move x0,x:(r7+$18) + move x:(r7+$32),x0 + move x0,x:(r7+$17) + bra gbid +; Idle at a chunk's end. +gbiw: + bsr gbgp +gbid: + move x:(r7+$08),x0 + move x0,x:(r7+$19) +; Decided only on TIME's grid, and not after a second of silence in. + move x:(r7+$41),a + tst a + bne gbix + move x:(r7+$53),a + move #>44100,y0 + cmp y0,a + bge gbix + move x:(r7+$04),a + cmp x0,a + blt gbix + bsr gbrn + move x:(r7+$1f),a + cmp x0,a + ble gbix +; A tail froze the ring: end it, record again, and wait for a fresh chunk. + move x:(r7+$03),a + tst a + bne gbfr + bsr gbqt + clr a + move a,x:(r7+$04) + move #>$1,x0 + move x0,x:(r7+$03) + bra gbix +gbfr: + move x:(r7+$40),x0 + move x0,x:(r7+$42) +; A chunk starts. +gbcs: +; RAND: a random number of repeats, 1-8. + move x:(r7+$21),x0 + move x0,x:(r7+$45) + move x:(r7+$4f),a + tst a + beq gbr9 + bsr gbrn + move x:(r7+$4f),a + cmp x0,a + ble gbr9 + bsr gbrn + move #>$8,y1 + mpy x0,y1,a + add #>$1,a + move a1,x:(r7+$45) +gbr9: +; Fresh when nothing sounds (no loop, no tail): then every head takes the newest window at once. $52: scratch. + move x:(r7+$06),a + move x:(r7+$18),x0 + add x0,a + move a1,x:(r7+$52) +; A DUB going on (TYPE DUB, a loop playing) keeps its window ($79); DUB stops the writer. + clr b + move b,x:(r7+$79) + move #>$1,x0 + move x:(r7+$1d),a + cmp x0,a + bne gbv1 + move x:(r7+$06),a + tst a + beq gbv1 + move x0,x:(r7+$79) +gbv1: + move x0,x:(r7+$06) + move x0,x:(r7+$03) + move x:(r7+$1d),a + cmp x0,a + bne gbv2 + move b,x:(r7+$03) +gbv2: + clr a + move a,x:(r7+$0a) + move a,x:(r7+$18) + move #>$7fffff,x0 + move x0,x:(r7+$20) + move #>$009445,x0 + move x0,x:(r7+$17) +; The loop: a chunk / RPT, the latest audio behind the writer: the newest window. + move x:(r7+$08),a + move a1,x:(r7+$34) + asr #23,a,a + move x:(r7+$45),x0 + bsr gbdi + move x0,x:(r7+$16) + move x0,x:(r7+$6d) + move x:(r7+$79),a + tst a + bne gbv3 + move x:(r7+$02),a + sub x0,a + move #>$0,y0 + move #>15870,x1 + tst a + move x1,b + tge y0,b + add b,a + move a1,x:(r7+$6e) + move x:(r7+$00),x1 + add x1,a + move a1,x:(r7+$10) + move x0,a + sub #>$1,a + move a1,x:(r7+$11) +gbv3: + move #>$1,x0 + move x0,x:(r7+$6c) + clr a + move a,x:(r7+$63) + move a,x:(r7+$68) + move #>$200000,x0 + move x0,x:(r7+$0f) + move x0,x:(r7+$62) + move x0,x:(r7+$67) + move x:(r7+$1d),a + tst a + beq gbla + move #>$2,x0 + cmp x0,a + beq gbgl +; DUB: head 0 loops the window, the live track recorded into it as it plays (sound-on-sound). + move x:(r7+$11),x0 + bsr gbfa + bra gbfs +; LAYER: three heads on the loop at different speeds, at 1/2, 1/4 and 1/4. +gbla: + move x:(r7+$1e),a + move #>$3,x0 + cmp x0,a + beq gbl3 + asl #1,a,a + move a1,n1 + move #>$ffffff,m1 + lua (r7+$36),r1 + nop + move x:(r1+n1),x0 + move x0,x:(r7+$62) + lua (r7+$37),r1 + nop + move x:(r1+n1),x0 + move x0,x:(r7+$67) + bra gbl4 +gbl3: + bsr gbt0 + move x0,x:(r7+$62) + bsr gbt0 + move x0,x:(r7+$67) +gbl4: + move x:(r7+$4f),a + tst a + beq gbl5 + bsr gbrn + move x:(r7+$4f),a + cmp x0,a + ble gbl5 + bsr gbt0 + move x0,x:(r7+$62) +gbl5: + move x:(r7+$11),x0 + bsr gbfa + bra gbfs +; SLIDE: heads 1 and 2, half a window apart, gliding over the chunk (A up an octave, B down, C apart, D to a random speed). +gbgl: + move #>$2,x0 + move #>$1,x1 + move x:(r7+$1e),a + tst a + bne gbg2 + move x0,x1 + bra gbg4 +gbg2: + move #>$1,y0 + cmp y0,a + bne gbg3 + move x1,x0 + bra gbg4 +gbg3: + move #>$3,y0 + cmp y0,a + bne gbg4 + bsr gbsp + move x0,x1 +gbg4: + move x0,x:(r7+$55) + move x1,x:(r7+$56) + move x:(r7+$4f),a + tst a + beq gbg5 + bsr gbrn + move x:(r7+$4f),a + cmp x0,a + ble gbg5 + bsr gbsp + move x0,x:(r7+$55) +gbg5: + move x:(r7+$55),x0 + bsr gbgo + move x0,x:(r7+$63) + move x:(r7+$56),x0 + bsr gbgo + move x0,x:(r7+$68) + move x:(r7+$11),x0 + bsr gbfa +; From silence: every head on the newest window now, as far in as the start is late (reversed: from the end). +gbfs: + move x:(r7+$52),a + tst a + bne gbfg + move x:(r7+$10),x0 + move x0,x:(r7+$0b) + clr a + move a,x:(r7+$0e) + move x:(r7+$07),a + move x:(r7+$0f),b + tst b + bpl gbp1 + move x:(r7+$11),a + sub #>$1,a + move x:(r7+$07),x0 + sub x0,a +gbp1: + move a1,x:(r7+$0d) + move x:(r7+$10),x0 + move x0,x:(r7+$78) + clr a + move a,x:(r7+$61) + move x:(r7+$07),a + move x:(r7+$62),b + tst b + bpl gbp2 + move x:(r7+$11),a + sub #>$1,a + move x:(r7+$07),x0 + sub x0,a +gbp2: + move a1,x:(r7+$60) + move x:(r7+$10),x0 + move x0,x:(r7+$7a) + clr a + move a,x:(r7+$66) + move x:(r7+$07),a + move x:(r7+$67),b + tst b + bpl gbp3 + move x:(r7+$11),a + sub #>$1,a + move x:(r7+$07),x0 + sub x0,a +gbp3: + move a1,x:(r7+$65) + move x:(r7+$1d),a + move #>$2,x0 + cmp x0,a + bne gbfg + move x:(r7+$11),a + asr #1,a,a + move x:(r7+$07),x0 + add x0,a + move a1,x:(r7+$65) +; From silence: every gain at TYPE's at once. +gbfg: + move x:(r7+$52),a + tst a + bne gbse + bsr gbtg + move x:(r7+$55),x0 + move x0,x:(r7+$6b) + move x:(r7+$56),x0 + move x0,x:(r7+$64) + move x:(r7+$57),x0 + move x0,x:(r7+$69) +gbse: + move x:(r7+$45),x0 + move x0,x:(r7+$09) + bsr gbsr +gbix: + rts +; The next chunk of TIME's slice. +gbgp: + move x:(r7+$41),a + add #>$1,a + move x:(r7+$40),x0 + cmp x0,a + move #>$0,y0 + tge y0,a + move a1,x:(r7+$41) + rts + +; An event within the chunk: WIDE's spread (LAYER, SLIDE) or ping-pong (DUB). +gbsr: + move x:(r7+$1d),a + move #>$1,x0 + cmp x0,a + beq gbs1 + move x:(r7+$16),x0 + move x0,x:(r7+$19) + bsr gbrm + clr a + move a,x:(r7+$52) + bra gbw2 +; DUB: each pass the loop's length, then WIDE's ping-pong. +gbs1: + move x:(r7+$16),x0 + move x0,x:(r7+$19) + bsr gbrm +gbs9: +; WIDE: the repeat's side, + on even repeats and - on odd; with RAND anywhere within it. + move x:(r7+$4e),a + move x:(r7+$0a),b + and #>$1,b + tst b + beq gbw1 + neg a +gbw1: + move a,x:(r7+$52) + move x:(r7+$4f),b + tst b + beq gbw2 + bsr gbrn + move x:(r7+$4f),a + cmp x0,a + ble gbw2 + bsr gbrn + move x0,a + sub #>$400000,a + asl #1,a,a + move a,x0 + move x:(r7+$4e),y1 + mpy x0,y1,a + move a,x:(r7+$52) +gbw2: + move x:(r7+$52),x0 + move #>$7fffff,y0 + move #>$7fffff,a + sub x0,a + cmp y0,a + tge y0,a + move a,x:(r7+$4d) + move #>$7fffff,b + add x0,b + cmp y0,b + tge y0,b + move b,x:(r7+$4c) + rts + +; The next LFSR word; x0 = a random fraction. +; x0 = a random speed from T0. +gbt0: + bsr gbsp + move x0,n1 + lua (r7+$24),r1 + move #>$ffffff,m1 + nop + move x:(r1+n1),x0 + rts + +; x0 = a random index into T0, 0-3. +gbsp: + bsr gbrn + move #>$4,y1 + mpy x0,y1,a + move a1,x0 + rts + +; x0 = the change a block taking a rate of 1 to T0[x0] over the chunk, evenly in semitones: ln(T) x 16 / chunk +; (Q23), as |ln T| / 2 x 2^6 / (2 x chunk); negative for the slower speeds (indexes 0 and 1). +gbgo: + move x0,n1 + move x0,x1 + lua (r7+$28),r1 + move #>$ffffff,m1 + nop + move x:(r1+n1),a + asr #18,a,a + move x:(r7+$34),x0 + bsr gbdi + move x0,a + move x1,b + move #>$2,y0 + cmp y0,b + bge gbo1 + neg a +gbo1: + move a1,x0 + rts + +; The heads' fade for a window of x0 + 1: F = (x0 + 1) x SHAP's share, at least 64, at most half the window (so a +; short window still reaches full level), never under 5; K = 2^25 / F. +gbfa: + move x0,a + add #>$1,a + move a1,x1 + move a1,x0 + move x:(r7+$33),y1 + mpy x0,y1,a + move a1,x0 + move x0,a + move #>64,y0 + cmp y0,a + tlt y0,a + move x1,b + asr #1,b,b + cmp b,a + tgt b,a + move #>5,y0 + cmp y0,a + tlt y0,a + move a1,x0 + move #>$4,a + move #>$0,a0 + bsr gbdi + move x0,x:(r7+$13) + rts + +; The heads' gains for TYPE into $55-$57: LAYER 1/2, 1/4, 1/4; SLIDE 0, 1/2, 1/2; DUB head 0 whole. +gbtg: + move x:(r7+$1d),a + tst a + bne gbu1 + move #>$400000,x0 + move x0,x:(r7+$55) + move #>$200000,x0 + move x0,x:(r7+$56) + move x0,x:(r7+$57) + rts +gbu1: + move #>$2,x0 + cmp x0,a + bne gbu2 + clr b + move b,x:(r7+$55) + move #>$400000,x0 + move x0,x:(r7+$56) + move x0,x:(r7+$57) + rts +gbu2: + move #>$7fffff,x0 + move x0,x:(r7+$55) + clr b + move b,x:(r7+$56) + move b,x:(r7+$57) + rts + +; The chunk's last event ($09 = 1) takes what is left of it: $19 = chunk - (events - 1) x $19. +gbrm: + move x:(r7+$09),a + move #>$1,x0 + cmp x0,a + bne gbq1 + move x:(r7+$45),a + sub #>$1,a + move a1,x0 + move x:(r7+$19),y1 + mpy x0,y1,a + asr #1,a,a + move a0,x0 + move x:(r7+$34),a + sub x0,a + move a1,x:(r7+$19) +gbq1: + rts + +; Nothing sounding: the level, its target and rate, and the tail's flag at rest. +gbqt: + clr a + move a,x:(r7+$18) + move a,x:(r7+$15) + move a,x:(r7+$20) + move a,x:(r7+$17) + rts + +; a = how far the writer has to go to reach a window starting at a (Y): (a - base) - write, wrapped into [0, R). +gbdd: + move x:(r7+$00),x0 + sub x0,a + move x:(r7+$02),x0 + sub x0,a + move #>15870,x0 + tst a + bge gbdz + add x0,a +gbdz: + rts + +gbrn: + move x:(r7+$05),a + lsr a + bcc gbrc + move #>$e10000,x0 + eor x0,a +gbrc: + move a1,x:(r7+$05) + and #>$7fffff,a + move a1,x0 + rts + +; x0 = floor(a / (2 x0)): a the 48-bit dividend (effects.md, Traps). +gbdi: + andi #$fe,ccr + do #24,>gbdl + div x0,a +gbdl: + move a0,x0 + rts diff --git a/sdk/octatrack/modules/loopbox/evidence/cpu-price.json b/sdk/octatrack/modules/loopbox/evidence/cpu-price.json new file mode 100644 index 0000000000..a167d7fbab --- /dev/null +++ b/sdk/octatrack/modules/loopbox/evidence/cpu-price.json @@ -0,0 +1,146 @@ +{ + "module": "loopbox", + "version": "0.1.1-experimental", + "base": "development twin 117eb07f of base ddb56b72, MKII, OS 1.40C", + "scene": "the bank, pattern and Part the unit was on, transport stopped (test:procedure)", + "inputs": { + "transport": "playing" + }, + "seconds": 8, + "readings": 3, + "measuredAt": "2026-12-05T01:56:26.055Z", + "result": { + "id": "loopbox", + "version": "0.1.1-experimental", + "packageSha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372", + "before": { + "frame": 54.1, + "frameMax": 92.1, + "frames": 67204, + "skipped": 0, + "cpu": 71.6, + "dsp1to4": 40.7, + "dsp5to8": 49.2, + "dsp1to4Peak": 41.5, + "dsp5to8Peak": 50.6, + "readings": 3, + "spread": { + "frame": 0, + "cpu": 0.6, + "dsp1to4": 2.5, + "dsp5to8": 0, + "frameMax": 3.8, + "dsp1to4Peak": 0.1, + "dsp5to8Peak": 0.9 + } + }, + "atRest": { + "frame": 54.1, + "frameMax": 94.1, + "frames": 67174, + "skipped": 0, + "cpu": 71.4, + "dsp1to4": 42.3, + "dsp5to8": 48.9, + "dsp1to4Peak": 41.4, + "dsp5to8Peak": 50.6, + "readings": 3, + "spread": { + "frame": 0, + "cpu": 0.7, + "dsp1to4": 7.7, + "dsp5to8": 0.4, + "frameMax": 7.1, + "dsp1to4Peak": 0.1, + "dsp5to8Peak": 1.2 + } + }, + "atRestAdds": { + "frame": 0, + "cpu": -0.2, + "dsp1to4": 1.6, + "dsp5to8": -0.3, + "dsp1to4Peak": -0.1, + "dsp5to8Peak": 0 + }, + "inUse": { + "frame": 53.1, + "frameMax": 91.8, + "frames": 67178, + "skipped": 0, + "cpu": 70.5, + "dsp1to4": 51.5, + "dsp5to8": 49.2, + "dsp1to4Peak": 54.2, + "dsp5to8Peak": 50.2, + "readings": 3, + "spread": { + "frame": 0.7, + "cpu": 0.4, + "dsp1to4": 0.8, + "dsp5to8": 0, + "frameMax": 6.1, + "dsp1to4Peak": 0.1, + "dsp5to8Peak": 0.5 + } + }, + "inUseAdds": { + "frame": -1, + "cpu": -1.1, + "dsp1to4": 10.8, + "dsp5to8": 0, + "dsp1to4Peak": 12.7, + "dsp5to8Peak": -0.4 + }, + "inUseOn": "T1 FX2", + "curve": { + "tracks": [ + "T1", + "T3", + "T6", + "T7" + ], + "points": [ + 94.1, + 90.4, + 92.7, + 86.9, + 90.4 + ], + "adds": [ + -3.7, + -1.4, + -7.2, + -3.7 + ], + "first": 0, + "each": 0, + "notes": [], + "admission": [ + { + "pattern": "empty", + "number": 2, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 37.2, + "frame": 28, + "dropped": 0, + "stalls": 0 + }, + { + "pattern": "medium", + "number": 1, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 92.4, + "frame": 52.8, + "dropped": 0, + "stalls": 0 + } + ] + }, + "rolledBack": true + } +} diff --git a/sdk/octatrack/modules/loopbox/evidence/frame-cost.json b/sdk/octatrack/modules/loopbox/evidence/frame-cost.json new file mode 100644 index 0000000000..9d0313b3d5 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/evidence/frame-cost.json @@ -0,0 +1,55 @@ +{ + "module": "loopbox", + "version": "0.1.1-experimental", + "base": "development twin 117eb07f of base ddb56b72, MKII, OS 1.40C", + "scene": "the bank, pattern and Part the unit was on, transport stopped (test:procedure)", + "seconds": 8, + "measuredAt": "2026-12-05T01:56:26.055Z", + "tracks": [ + "T1", + "T3", + "T6", + "T7" + ], + "rest": 2, + "first": 0, + "each": 0, + "points": [ + 94.1, + 90.4, + 92.7, + 86.9, + 90.4 + ], + "adds": [ + -3.7, + -1.4, + -7.2, + -3.7 + ], + "admission": [ + { + "pattern": "empty", + "number": 2, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 37.2, + "frame": 28, + "dropped": 0, + "stalls": 0 + }, + { + "pattern": "medium", + "number": 1, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 92.4, + "frame": 52.8, + "dropped": 0, + "stalls": 0 + } + ], + "notes": [] +} diff --git a/sdk/octatrack/modules/loopbox/evidence/performance.json b/sdk/octatrack/modules/loopbox/evidence/performance.json new file mode 100644 index 0000000000..12a3a01e89 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/evidence/performance.json @@ -0,0 +1,34 @@ +{ + "schema": 1, + "module": "loopbox", + "version": "0.1.1-experimental", + "sourceSha256": "d23948254604d36b678eaf2e0698041dce7ef4bef10f9fbafc270c01f49faff8", + "kind": "dsp", + "cycles": { + "unit": "instructions/sample", + "static": 332, + "measured": 360.1, + "instancesPerCore": 4, + "method": "static: perf.py, by the rule tools/build/cycle_count.py prices straight-line code (one cycle a word): the per-sample loop between `do n7,>gbsl` and gbsl, 332 words; it has no branch, bsr, nested do or rep, so every sample runs every word. measured: perf.py in dsp_host on verify.py's synthetic image, executed instructions a sample from dsp_host's meter, 80 cases (the defaults, the dearest setting for each TYPE, a moving pattern, each unsplit and with a trig split at every position 1-15): unsplit 325.0 (defaults) to 334.4 (dearest SLIDE); worst 360.1, the dearest SLIDE setting with a split of 2 frames, where the per-call setup (events, DUB's write-back gains, each head's gain glide and the forced changeover's fade, the side's gains, SLIDE's glides) runs twice a block." + }, + "stock": { + "comparator": "SPRING REV", + "comparatorWorst": 314.19, + "dearestWorst": 330.94, + "baseline": "E-Verb's record (perf.py bench on the original image): SPRING REV, the cost target for new FX, worst 314.19 with trig splits (257.50 unsplit); DJ EQ, the dearest stock effect, 330.94 (293.38 unsplit), through fixed, moving and trig-split-1-15 cases. Not re-run for Glitchbox; its own cases match those (fixed, moving, a split at every position 1-15).", + "stockSha256": "164f31224bf61181e3f50e7dec40df9afcae5b16dbf6e4c0d0cc5e986af0a84e", + "justification": "No stock effect loops a captured ring with several heads; SPRING REV is the cost target for a new FX and, like Loopbox, reads and writes a delay buffer every sample. Loopbox's worst, 360.10, is 1.15x SPRING REV's 314.19 and 1.09x DJ EQ's 330.94; unsplit 334.4 against 257.50 and 293.38. Per sample it writes the mono sum into a 15,870-word ring and runs three read heads, each with its own position, wrap and changeover to the newest window, an interpolated two-word read and a fade by its position; then the heads' sum and side, DIRT's crush, hold and drive, the loop's level, the dry's duck and two outputs. The third head is what puts it over SPRING REV: LAYER needs it for its two layers over the loop. The code review's fixes (a head past a shrunk window landing at its start, heads fading out before a forced changeover, gains gliding a call) added about 17 a sample." + }, + "stress": { + "instancesPerCore": 4, + "tracks": 8, + "lfosPerTrack": 3, + "lockedSlots": 12, + "seconds": 2, + "guard": true, + "dirty": true, + "clobbers": 0, + "hangs": 0, + "method": "perf.py --stress: the load is driven straight into dsp_host on verify.py's synthetic image with both cores: eight Loopbox instances, four a core, each on its own stem (decaying noise bursts, a full-scale square, a 20 Hz-20 kHz sweep, full-scale noise, impulses, full-scale DC steps, silence, a three-note chord) for 2 s plus a 2 s tail; all twelve parameter words given a new value every block through the moving pattern, trig splits of 1, 3, 7, 8, 12 and 15 frames, -guard 0x4000 -guard-shared and -dirty: dsp_host exit 0, 0 stray writes, 0 clobbers, per-core peaks 1439.5 and 1355.1 of 3120. dsp_host hands every instance the same allocator entry, so the eight rings overlap here; on a unit each slot has its own buffer." + } +} diff --git a/sdk/octatrack/modules/loopbox/manifest.py b/sdk/octatrack/modules/loopbox/manifest.py new file mode 100644 index 0000000000..36b66074a8 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/manifest.py @@ -0,0 +1,88 @@ +"""LOOPBOX -- an original micro-loop effect for FX2 of any track. + +The track's mono sum goes into a capture ring in the FX2 slot's buffer. At each slice (TIME at the project's +tempo) ACT decides whether the slice loops; a loop plays the latest audio with three read heads on one window, as +LAYER (heads at different speeds), DUB (sound-on-sound: the live track recorded into the loop as it plays) or SLIDE (two +overlapping heads gliding in pitch), each with four variations (VAR, page 2). SHAP sets the heads' fades, RPT how +many times a loop cycles in a chunk, MIX how far a loop replaces the track (dry between loops up to 96, the loops +alone at 127). Timing follows the tempo word only: slices are free-running at the tempo, not locked to the +pattern's steps or swing. + +verify.py holds engine.asm to reference.py's model bit for bit in dsp_host. The test procedure passed on the author's MKII (TESTING.md). +""" +import importlib.util +import pathlib + +from remix.schema import (Category, Claims, Proof, BusRole, DspSection, Formatter, Gate, Harness, Kind, + MenuEntry, Module, Param, YBase) + +# Under its own name: every module's manifest loads in one process, and another may have a reference.py too. +_spec = importlib.util.spec_from_file_location("loopbox_ref", pathlib.Path(__file__).with_name("reference.py")) +_ref = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(_ref) + +P, S, W = Formatter.PLAIN, Formatter.STEPPED, Formatter.WIDE_STEPPED + +MODULE = Module( + name="loopbox", + key="LOOPBOX", + kind=Kind.DSP_EFFECT, + doc="Micro-loop effect on FX2: LAYER, DUB, SLIDE loops of the track at the tempo.", + category=Category.TRACK, author="jrs1717", author_url="https://github.com/jrs1717", + proof=Proof.RENDER, + proof_note="verify.py bit-exact against reference.py in dsp_host; test procedure steps 1-11 on the author's MKII (TESTING.md)", + + menu=MenuEntry( + fx2_id=0x0a, + donor_desc=0x400d58b8, # DARK REV; every drawn slot is written below + abbr=b"LOOP", + fullname=b"LOOPBOX", + build_tag=False, + ), + + params=( + Param(b"TIME", 2, 6, active=True, formatter=W, labels=_ref.TIME_LABELS, + doc="slice length at the tempo, 1/64 to 1/2; loops start on it and last it, in chunks of 179 ms at most"), + Param(b"ACT", 64, 128, active=True, formatter=P, + doc="the share of slices that loop: 0 none, 127 about 70 %"), + Param(b"SHAP", 32, 128, active=True, formatter=P, + doc="the loops' fades: 1/64 of a loop at 0, rising evenly to a full swell"), + Param(b"RPT", 1, 8, active=True, formatter=W, labels=tuple(str(i) for i in range(1, 9)), + doc="how many times a loop cycles in a chunk: 1 the whole chunk once, 8 an eighth of it eight times"), + Param(b"MIX", 64, 128, active=True, formatter=P, + doc="how far a loop takes over: 96 replaces the track at the loop's peak; 127 the loops alone"), + Param(b"TAIL", 64, 128, active=True, formatter=P, + doc="after a loop its heads loop on and fade: 0 a short release (about 50 ms), 127 about 3 s"), + Param(b"TYPE", 0, 3, active=True, formatter=S, labels=_ref.TYPE_NAMES, + doc="LAYER stacks heads at different speeds, DUB records the track into the loop as it plays, SLIDE glides the pitch"), + Param(b"DIRT", 0, 128, active=True, formatter=P, + doc="grit on the loops: sample-rate reduction, harder crush and clipping drive; 0 clean"), + Param(b"VAR", 0, 4, active=True, formatter=S, labels=_ref.VAR_NAMES, + doc="variation A-D: octaves, fifths, reversed or random layers; 4 or 8 slices, reversed or ratcheted; up, down, apart or random glides"), + Param(b"WIDE", 0, 128, active=True, formatter=P, + doc="ping-pong: loops alternate left and right this far; with RAND anywhere in it"), + Param(b"RAND", 0, 128, active=True, formatter=P, + doc="chaos: random loop counts, speeds, glide targets and places; 0 as set"), + Param(b"DGRD", 0, 128, active=True, formatter=P, + doc="degrade: a tail grows dirtier as it fades; 0 a clean fade"), + ), + mode_slot=6, + + dsp=DspSection( + asm="modules/loopbox/engine.asm", + priority=10, + bus_role=BusRole.NONE, + ybase=YBase.NEVER, + r7_latch_slot=None, + gate_label=None, + ), + # 15,870 words from the FX2 slot's base, ending at +$3DFD: Sidechain Compressor's key window stays free. + claims=Claims(stock_instance_buffer=True, buffer_words=_ref.R), + + harness=Harness(layout_char=None, is_server=False), + + gates=(Gate("modules/loopbox/verify.py", remix_arg=False),), + # the shortest slices, a loop every slice, eight cycles, DUB D (head 0 writing the track back into the loop), full wet + dear={"TIME": 0, "ACT": 127, "SHAP": 127, "RPT": 7, "MIX": 127, "TAIL": 127, "TYPE": 1, "DIRT": 127, "VAR": 3, + "WIDE": 127, "RAND": 127, "DGRD": 127}, +) diff --git a/sdk/octatrack/modules/loopbox/media/LICENSE.md b/sdk/octatrack/modules/loopbox/media/LICENSE.md new file mode 100644 index 0000000000..26139cc695 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/media/LICENSE.md @@ -0,0 +1,12 @@ +# OT UI capture rights and attribution + +These original LCD captures were taken on the module author's own Octatrack on 2 and 3 December 2026, read over USB from the +running Modwerk base (its screen capture request), for Modwerk module documentation. Credit: jrs1717. + +LicenseRef-OT-UI-Documentation covers the original capture/documentation contribution for use in Modwerk module +documentation. Underlying Octatrack interface artwork, labels and other Elektron material retain their owners' rights; +this declaration does not grant a licence to those underlying works or assert that they are MIT/CC licensed. Reviewer +verification of reuse rights is required before publication and is not automatic legal clearance. + +Only rendered PNG screenshots and capture metadata belong in this folder. No firmware, raw LCD/RAM dump, card, +recording or private log is included. diff --git a/sdk/octatrack/modules/loopbox/media/capture.json b/sdk/octatrack/modules/loopbox/media/capture.json new file mode 100644 index 0000000000..617113efb4 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/media/capture.json @@ -0,0 +1,22 @@ +{ + "firmware": "1.40C", + "baseIdentity": "ddb56b72d1ac0b606f5969bc4984b6b22662e87d1b1d56a480ef0da1aac53b49", + "packageSha256": "4dc3d0ccfef94b8c2ed2c4604065a7ed4ca1d9387b606e4725637a164766f2ad", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Loopbox 0.1.1-experimental (package 4dc3d0cc) kept beside 26 modules; the author's project, pattern A01, a track's FX2 on Loopbox with TYPE SLIDE and the other knobs as the author set them; transport stopped. The author pressed the keys; the agent read each frame over USB. imageSha256 is the MAIN image of base 0.8.5 ddb56b72, as recorded for Fuzzbox's and Glitchbox's captures on the same base.", + "method": "python3 -B scripts/device-send.py png:FILE through npm run device -- serve: the base's on-demand screen frame (Screen capability), 256x128, unmodified.", + "screens": [ + { + "path": "media/ot-location.png", + "sha256": "4f9df8c5b6a79dc3320ed5cfa1dcc2d33ee55851caecb7c111c7d50fe95e8199", + "keys": "TRACK, FUNC+FX2", + "shows": "FX2 SETUP: Loopbox selected at the end of the effect list; TYPE (SLIDE), DIRT, VAR, WIDE, RAND and DGRD" + }, + { + "path": "media/ot-controls.png", + "sha256": "287c080a616e8b9f9c8e814ff87afebba2a3ef7f15d17ac751ca5b12a071a076", + "keys": "FX2", + "shows": "FX2 main page: TIME, ACT, SHAP, RPT, MIX, TAIL" + } + ], + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237" +} diff --git a/sdk/octatrack/modules/loopbox/media/ot-controls.png b/sdk/octatrack/modules/loopbox/media/ot-controls.png new file mode 100644 index 0000000000..63999ba663 Binary files /dev/null and b/sdk/octatrack/modules/loopbox/media/ot-controls.png differ diff --git a/sdk/octatrack/modules/loopbox/media/ot-location.png b/sdk/octatrack/modules/loopbox/media/ot-location.png new file mode 100644 index 0000000000..49a4688f81 Binary files /dev/null and b/sdk/octatrack/modules/loopbox/media/ot-location.png differ diff --git a/sdk/octatrack/modules/loopbox/octamod.module.json b/sdk/octatrack/modules/loopbox/octamod.module.json new file mode 100644 index 0000000000..3307b9d67b --- /dev/null +++ b/sdk/octatrack/modules/loopbox/octamod.module.json @@ -0,0 +1,373 @@ +{ + "schemaVersion": 2, + "id": "loopbox", + "key": "LOOPBOX", + "name": "Loopbox", + "version": "0.1.1-experimental", + "category": "effects", + "author": { + "github": "jrs1717", + "credits": [ + "jrs1717" + ] + }, + "nativeManifest": "manifest.py", + "presentation": { + "label": "LOOP", + "family": "Looper", + "summary": "Automatic micro-loops on FX2: overlapping loops at different speeds, slices replayed in a new order, or loops gliding in pitch, all at the project's tempo.", + "overview": "Loopbox keeps the last third of a second of the track. On a note grid at the project's tempo, ACT decides when a slice loops; a loop plays the latest audio with three read heads on one window. LAYER stacks heads at different speeds, DUB records the live track into the loop as it plays, sound-on-sound, SLIDE glides two overlapping loops in pitch. MIX blends it with the track, TAIL lets a loop ring on after it ends.", + "highlights": [ + "Three types, four variations each: LAYER, DUB and SLIDE", + "Loops on a note grid from 1/64 to 1/2 at the project's tempo", + "Each read head fades by its own position, so loops at any speed are click-free", + "DIRT, WIDE ping-pong, RAND and a degrading TAIL on the setup page" + ], + "usage": [ + "Select a track, press FUNC + FX2 and choose LOOPBOX at the end of the list.", + "Start with TYPE LAYER, ACT 64, TIME 1/16 and MIX 64 on a drum loop, then try SLIDE, and DUB at TIME 1/2 and RPT 1, where each loop gets eight passes to build." + ] + }, + "controls": [ + { + "name": "TIME", + "default": 2, + "count": 6, + "doc": "Slice length at the tempo, 1/64 to 1/2; loops start on it and last it, in chunks of 179 ms at most.", + "labels": [ + "1/64", + "1/32", + "1/16", + "1/8", + "1/4", + "1/2" + ] + }, + { + "name": "ACT", + "default": 64, + "count": 128, + "doc": "The share of slices that loop: 0 none, 127 about 70 %.", + "labels": null + }, + { + "name": "SHAP", + "default": 32, + "count": 128, + "doc": "The loops' fades: 1/64 of a loop at 0, rising evenly to a full swell.", + "labels": null + }, + { + "name": "RPT", + "default": 1, + "count": 8, + "doc": "How many times a loop cycles in a chunk: 1 the whole chunk once, 8 an eighth of it eight times.", + "labels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "name": "MIX", + "default": 64, + "count": 128, + "doc": "How far a loop takes over: 96 replaces the track at the loop's peak; 127 the loops alone.", + "labels": null + }, + { + "name": "TAIL", + "default": 64, + "count": 128, + "doc": "After a loop its heads loop on and fade: 0 a short release (about 50 ms), 127 about 3 s; a loop that starts over a tail picks up from there.", + "labels": null + }, + { + "name": "TYPE", + "default": 0, + "count": 3, + "doc": "LAYER stacks heads at different speeds, DUB records the track into the loop as it plays, SLIDE glides the pitch.", + "labels": [ + "LAYER", + "DUB", + "SLIDE" + ] + }, + { + "name": "DIRT", + "default": 0, + "count": 128, + "doc": "Grit on the loops: sample-rate reduction, harder crush and clipping drive; 0 clean.", + "labels": null + }, + { + "name": "VAR", + "default": 0, + "count": 4, + "doc": "Variation A-D: octaves, fifths, reversed or random layers; 4 or 8 slices, reversed or ratcheted; up, down, apart or random glides.", + "labels": [ + "A", + "B", + "C", + "D" + ] + }, + { + "name": "WIDE", + "default": 0, + "count": 128, + "doc": "Ping-pong: loops alternate left and right this far; with RAND anywhere in it.", + "labels": null + }, + { + "name": "RAND", + "default": 0, + "count": 128, + "doc": "Chaos: random loop counts, speeds, glide targets and places; 0 as set.", + "labels": null + }, + { + "name": "DGRD", + "default": 0, + "count": 128, + "doc": "Degrade: a tail grows dirtier as it fades; 0 a clean fade.", + "labels": null + } + ], + "compatibility": { + "firmware": "1.40C", + "location": "FX2", + "conflicts": [], + "uiClaims": [], + "limitations": [ + "FX2 only: the capture ring needs an FX2 slot's buffer (15,870 words). On FX1 it passes the track dry.", + "Mono capture: the loops replay the track's mono sum; WIDE spreads LAYER's and SLIDE's extra loops left and right.", + "Loops follow the project's tempo, not yet the pattern's steps, track speed or swing; the owner agreed on issue #2491 that free-running tempo slices are fine until the base has a step clock for effects.", + "After a second of silent input no loop starts; after four seconds any loop or tail stops. The watch listens to the mono sum the ring records, so a source exactly out of phase between L and R counts as silence.", + "It prefers effect id 10, as Fuzzbox, Glitchbox and Midiverb do: over USB the base gives each its own id; in a card set only one of them fits.", + "Its worst case is 1.15x stock SPRING REV (three read heads, each with its own fade); four a core fit within a core's budget." + ], + "effectId": 10 + }, + "resources": { + "recorded": "2026-12-05", + "storage": { + "label": "DSP program / state", + "display": "1854 words / 123-word state", + "value": null, + "unit": "see display", + "method": "static", + "conditions": "The USB package 5d3bf7c3 (ABI 6): 1,854 program words on each DSP core it runs on; 123 words of state per instance in its own r7 block (init clears them); 15,870 words of the FX2 slot's 16K Y delay buffer per instance, stopping short of Sidechain Compressor's key window; 1,196 bytes of ColdFire code and data (the effect's descriptor and menu), no bss.", + "source": "TESTING.md" + }, + "processing": { + "label": "DSP instruction peak", + "display": "360 instructions/sample per instance", + "value": null, + "unit": "see display", + "method": "emulator", + "conditions": "perf:audit record (perf.py in dsp_host): worst 360.1 executed instructions a sample, the dearest SLIDE setting with a trig split of 2 frames; unsplit 325.0 to 334.4; static loop 332. Against SPRING REV 314.19 (1.15x) and 330.94 for the dearest stock effect. Executed instructions, not chip cycles. On the unit the DSP load of T1-T4 rose 10.8 to 12.7 points with it on T1 FX2.", + "source": "evidence/performance.json" + }, + "cpuPrice": { + "value": 0, + "unit": "percent-of-frame", + "measure": "frame-interrupt", + "tool": "npm run device:price -- --write", + "date": "2026-12-05", + "conditions": "the bank, pattern and Part the unit was on, transport stopped (test:procedure); base development twin 117eb07f of base ddb56b72, MKII, OS 1.40C; 3 readings of 8 s a state. Frame interrupt 54.1 % before, 54.1 % installed and used nowhere, 53.1 % on T1 FX2; CPU meter 71.6 % before, 71.4 % at rest, 70.5 % in use.", + "source": "evidence/cpu-price.json" + }, + "impact": { + "conditions": "One instance at the dearest setting in dsp_host; on the author's MKII (twin 117eb07f of base ddb56b72) the frame-interrupt price on the test bank (Mang112 95 bank A, Part 1, pattern A01), and six instances admitted at once while playing (device:test).", + "cpu": { + "level": "minimal", + "basis": "measured-comparison", + "rationale": "No ColdFire work besides the effect's descriptor: the ColdFire only forwards the knob words, as for any effect. On the unit the frame interrupt rose 0 points with it on T1 FX2 and 0 installed and unused; the instance curve on the test pattern, noisy there, read first 0 and each 0, admitted on the empty and the medium pattern.", + "source": "evidence/cpu-price.json" + }, + "dsp": { + "level": "high", + "basis": "measured-comparison", + "rationale": "360.1 executed instructions a sample worst case (1.15 of SPRING REV's 314.19, 1.09 of DJ EQ's 330.94): a ring write and three read heads (head 0 also writing DUB's loop back), each with its own position, wrap, changeover, interpolated read, fade and gliding gain, then the heads' sum and side, crush, hold and drive, the loop's level, the dry's duck and two outputs, every sample. Four a core is 1,452 of 3,120. On the unit one instance raised its core's load about 11 to 13 points; six were admitted at once.", + "source": "evidence/performance.json" + }, + "memory": { + "level": "low", + "basis": "source-estimate", + "rationale": "Per instance 369 bytes of state and the FX2 slot's own delay buffer (15,870 words, which every stock reverb or delay on that slot would also take); 7,304 bytes shared.", + "source": "TESTING.md" + } + } + }, + "tests": { + "report": "TESTING.md", + "summary": "On the author's MKII (OS 1.40C, twin 117eb07f of base ddb56b72): npm run test:procedure on package 5d3bf7c3 (DUB in place of SHUFL) passed steps 1-11 (beside every other module, both cores, six instances admitted at once, Part switches, a 120 s soak, the price and the curve played; by hand DUB and a TYPE change mid-loop); the author kept 5d3bf7c3 beside 20 modules, played, saved and reloaded the Part and power-cycled: \"everything survived\". verify.py is bit-exact against reference.py in dsp_host for every TYPE and VAR, including DUB's write back; perf:audit worst 360.1 instructions a sample.", + "hardwareStatus": "reported", + "evidenceRevision": "a383d6d00ac6734aae6b07cac3b4bda1bd5f44ca", + "gates": [ + "Worst-case cycles under parameter modulation and maximum load", + "Exact memory region and maximum-instance totals", + "Owner-reviewed real-hardware evidence with actual coverage and limitations" + ], + "qualification": { + "moduleVersion": "0.1.1-experimental", + "sourceSha256": "eacda55bb3aed90f0dade4d5c15fec03fb63adf85a727be81d6a9b43144d80bb", + "cycles": [ + { + "processor": "dsp", + "worstCase": 363, + "maxConfiguration": 1452, + "maxInstances": 8, + "budget": 3120, + "unit": "cycles/sample", + "method": "emulator", + "conditions": { + "parameterExtremes": "363 cycles a sample covers the measured worst case in dsp_host, 360.1 executed instructions at the dearest SLIDE setting with a trig split of 2 frames (the per-call setup runs twice a block), over the defaults, the dearest setting for each TYPE (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND and DGRD at 127, RPT 8, VAR D) and the moving pattern, unsplit and with a split at every position 1-15 (perf.py, 80 cases). The static floor of the loop alone is 332. Executed instructions, not chip cycles.", + "parameterModulation": "Knob words reach the DSP as value<<16 every call; MIX glides per sample, the rest are read once a call, so modulation costs nothing extra. perf.py's stress run changes every parameter word every block (every slot swept, TIME, RPT, TYPE and VAR stepped): 0 clobbers, 0 hangs. verify.py renders a knob word with an LFO's fraction bits and every knob swept while looping bit for bit. The unit's soak sent program changes, transport, scenes, the crossfader and FX knob CCs.", + "modeSwitching": "TYPE and VAR are read once a call and take effect at the next chunk; their cost is inside the measured per-call setup. verify.py sweeps both while looping bit for bit; perf.py's moving case steps them; on the unit Part switches ran their own effects and the soak changed programs while it ran. There is no bypass: MIX 0 leaves the track within 1 LSB.", + "maxLoad": "4 instances a core, 8 on both: 4 x 363 = 1,452 of the 3,120 cycles a core can spend a sample. Stress in dsp_host: 4 a core, per-core peaks 1439.5 and 1355.1. On the unit six were admitted at once while playing; the base refused two to keep each core within budget.", + "inputConditions": "perf.py: stereo noise at 0.7 of full scale; the stress stems are decaying bursts, a full-scale square, a 20 Hz-20 kHz sweep, full-scale noise, impulses, full-scale DC steps, silence and a chord. The sample loop has no data-dependent branch, so the input changes no cost; verify.py checks exact silence out for silence in, a burst's tail ending in silence, and every TYPE and VAR falling silent 4.2 s after the input stops." + }, + "report": "evidence/performance.json" + } + ], + "memory": { + "regions": [ + { + "name": "DSP program, the package's effect on each core it runs on", + "space": "dsp-p", + "words": 1854, + "wordBits": 24, + "bytes": 5562, + "scope": "shared" + }, + { + "name": "DSP state per instance, the package's state words", + "space": "dsp-x", + "words": 123, + "wordBits": 24, + "bytes": 369, + "scope": "instance" + }, + { + "name": "ColdFire code and data of the USB package", + "space": "cpu-ram", + "words": 1196, + "wordBits": 8, + "bytes": 1196, + "scope": "shared" + }, + { + "name": "FX2 slot delay buffer, the stock allocator's 16K Y block reused as the capture ring", + "space": "dsp-y", + "words": 15870, + "wordBits": 24, + "bytes": 47610, + "scope": "instance" + } + ], + "perInstanceBytes": 47979, + "sharedBytes": 6758, + "maxInstances": 8, + "totalBytes": 390590, + "conditions": "From the header of the USB package 5d3bf7c3 (ABI 6), checked against the source: the effect uses its own r7 block X:(r7+$00..$7a) (verify.py's state gate) and the first 15,870 words of the FX2 slot's 16K Y delay buffer, which the stock allocator hands every FX2 instance (modulus $3dfd, stopping short of Sidechain Compressor's key window at +$3DFE; Claims(stock_instance_buffer=True, buffer_words=15870)); on an FX1-sized slot it passes the track dry and writes nothing. No other stock tables or blocks, no absolute addresses; the stack holds only the bsr return of its per-call routines.", + "report": "TESTING.md" + }, + "imageSha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372", + "hardware": { + "kind": "functional", + "status": "reported", + "model": "MKII", + "testedOn": "2026-12-05", + "tester": "jrs1717", + "sourceRevision": "a383d6d00ac6734aae6b07cac3b4bda1bd5f44ca", + "imageSha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372", + "summary": "On the author's Octatrack MKII, OS 1.40C, 5 December 2026 (UTC): npm run test:procedure on package 5d3bf7c3 (0.1.1-experimental with DUB in place of SHUFL), on development twin 117eb07f of base ddb56b72 with the test bank, passed software checks, the check beside every other module, the DSP cost model, reading the unit, the scripted pass (self-test, both DSP cores, six instances at once with two refused for budget, Part switches), a 120 s soak with MIDI programs and AUTO changes, the price (the curve played, admitted on the empty and the medium pattern, longest frame 92.4 %) and putting the Part back; by hand, on T1 and T5 FX2 while playing, TYPE stepped through LAYER, DUB and SLIDE, DUB with ACT, MIX and TAIL at 127, DUB VAR D, and TYPE changed mid-loop, with no stall, error or crash. The author heard DUB on the same package in two RAM trials (\"sounds great\"), then kept it in place of 4dc3d0cc on the flashed base beside 20 modules, played it, saved and reloaded the Part and power-cycled: \"everything survived\".", + "limitations": [ + "Not run: an emulator rehearsal.", + "Not recorded: MAIN and CUE over USB (the recorder is not built on the author's computer); dropouts were checked by frame timing (late entries, skipped frames, stalls) and by the author's ear.", + "Not run on the unit: TIME 1/2 below 42 BPM (the 32-chunk path); verify.py holds it bit for bit at 30 BPM in dsp_host, for LAYER and DUB.", + "Not tested: MIDI, scenes and recording with it, beyond the soak's program changes, scenes and crossfader.", + "Not tested beside Sidechain Compressor on the unit; the ring stops short of its key window by design.", + "The screens were captured on package 4dc3d0cc; the controls and their names are the same, but TYPE's middle value is now DUB (it was SHUFL)." + ], + "report": "TESTING.md" + }, + "documentation": { + "tutorial": { + "title": "Quick tutorial", + "steps": [ + "Put Loopbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to LOOPBOX at the end of the list and press YES. At the defaults it is LAYER A at 1/16, looping about half the slices.", + "Turn ACT and MIX to 127 to hear only the loops, then hold FUNC and press FX2 and step TYPE through LAYER, DUB and SLIDE, and VAR through A to D.", + "Set TIME to 1/4 and RPT to 1 for longer phrases, raise TAIL to let each loop ring on, and WIDE to spread LAYER's and SLIDE's loops left and right.", + "Turn MIX back to 64 to blend the loops with the track again, or to 0 to hear the track alone." + ] + }, + "screenshots": [ + "media/ot-location.png", + "media/ot-controls.png" + ], + "screenshotStyle": "black-and-white" + } + } + }, + "license": { + "spdx": "MIT", + "file": "LICENSE", + "declaration": "Original code by jrs1717 under the MIT licence in LICENSE: an original design inspired by micro-loop effects in general, starting from the author's own Glitchbox engine; no third-party code, tables, samples or names. Never includes Elektron firmware, extracted routines or tables." + }, + "media": [ + { + "path": "media/ot-location.png", + "captureType": "hardware", + "credit": "jrs1717 (USB screen capture on the author's unit)", + "license": "LicenseRef-OT-UI-Documentation", + "source": "original", + "caption": "Hold FUNC and press FX2: Loopbox is chosen at the end of the effect list, with TYPE (here SLIDE), DIRT and VAR on the top row and WIDE, RAND and DGRD below.", + "alt": "FX2 SETUP page with an effect list ending in Loopbox, selected; knobs labelled SLIDE, DIRT, VAR, WIDE, RAND and DGRD.", + "otUi": { + "page": "FX2 SETUP", + "shows": "location", + "firmware": "1.40C", + "moduleVersion": "0.1.1-experimental", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Loopbox 0.1.1-experimental (package 4dc3d0cc) kept beside 26 modules; the author's project, pattern A01, a track's FX2 on Loopbox with TYPE SLIDE and the other knobs as the author set them; transport stopped. The author pressed the keys; the agent read each frame over USB. imageSha256 is the MAIN image of base 0.8.5 ddb56b72, as recorded for Fuzzbox's and Glitchbox's captures on the same base.", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237" + } + }, + { + "path": "media/ot-controls.png", + "captureType": "hardware", + "credit": "jrs1717 (USB screen capture on the author's unit)", + "license": "LicenseRef-OT-UI-Documentation", + "source": "original", + "caption": "Press FX2 for the main page: TIME, ACT and SHAP on top, RPT, MIX and TAIL below.", + "alt": "FX2 main page titled Loopbox with knobs TIME, ACT, SHAP, RPT, MIX and TAIL.", + "otUi": { + "page": "FX2", + "shows": "controls", + "firmware": "1.40C", + "moduleVersion": "0.1.1-experimental", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Loopbox 0.1.1-experimental (package 4dc3d0cc) kept beside 26 modules; the author's project, pattern A01, a track's FX2 on Loopbox with TYPE SLIDE and the other knobs as the author set them; transport stopped. The author pressed the keys; the agent read each frame over USB. imageSha256 is the MAIN image of base 0.8.5 ddb56b72, as recorded for Fuzzbox's and Glitchbox's captures on the same base.", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237" + } + } + ], + "access": { + "location": "FX2 SETUP page of any audio track (the effect list).", + "steps": [ + "Select an audio track with its TRACK key.", + "Hold FUNC and press FX2 to open the effect's SETUP, turn LEVEL to LOOPBOX and press YES.", + "Press FX2 for TIME, ACT, SHAP, RPT, MIX and TAIL; hold FUNC and press FX2 again for TYPE (A), DIRT (B), VAR (C), WIDE (D), RAND (E) and DGRD (F)." + ], + "screenshots": [ + "media/ot-location.png", + "media/ot-controls.png" + ] + } +} diff --git a/sdk/octatrack/modules/loopbox/perf.py b/sdk/octatrack/modules/loopbox/perf.py new file mode 100644 index 0000000000..355f56c0a6 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/perf.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Loopbox's performance measurements for evidence/performance.json, in dsp_host. + + python3 -B perf.py (the tools verify.py finds; several minutes) + python3 -B perf.py --stress (the stress run only) + +static the words of the per-sample loop, from the assembled symbols: everything between `do n7,>gbsl` and gbsl, + priced as sdk/octabam/tools/build/cycle_count.py prices straight-line code, one cycle a word. The loop has + no branch, no bsr, no nested do or rep (verify.py marks it CYCLES_FORWARD_BRANCHES), so every sample runs + every word. +measured executed instructions a sample from dsp_host's meter, one instance on verify.py's synthetic image: + the defaults, the dearest setting for each TYPE (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND and + DGRD at 127, RPT 8, VAR D) and a moving pattern (every slot swept by triangles, TYPE and VAR stepped, + everything jumped every 37 blocks), each unsplit and with a trig split at every position 1-15. +stress eight instances, four a core, each on its own stem (bursts, a full-scale square, a sweep, noise, + impulses, DC steps, silence, a chord), all twelve parameter words given a new value every block, + trig splits of 1, 3, 7, 8, 12 and 15 frames, under -guard 0x4000 -guard-shared and -dirty. dsp_host + hands every instance the same allocator entry, so the eight rings overlap here (on a unit each slot has + its own buffer); dsp_host writes a word a block into the instance at core 1 position 2 + (dsp_gate.HARNESS_WORD). +Then npm run perf:audit -- check evidence/performance.json --stamp (docs/MODULE_PERFORMANCE.md). +""" +import math +import pathlib +import random +import sys + +HERE = pathlib.Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import verify as V # noqa: E402 (finds sdk/octatrack/tools) + +G, R = V.G, V.R +Q = R.Q +BLOCKS = 4096 +SECONDS = 2 + + +def static(asm): + """The per-sample loop's words: from after `do n7,>gbsl` (two words) to gbsl.""" + syms = asm.syms + lines = G.listing(asm) + do = [addr for addr, line in lines.items() if line.mnemonic.lower() == "do" and "n7" in line.operands.lower() + and addr < syms["gbsl"]] + return syms["gbsl"] - (max(do) + 2) + + +def moving(blocks, seed=1): + """Every slot swept by triangles an eighth of a turn apart (TIME 0-5, RPT 0-7, TYPE 0-2, VAR 0-3 by their + steps), everything jumped at random every 37 blocks.""" + rnd = random.Random(seed) + rows = {} + for b in range(blocks): + tri = [min(127, 128 - abs(((b + 32 * k) % 256) - 128)) for k in range(12)] + row = list(tri) + row[0] = (b // 96) % 6 + row[3] = (b // 48) % 8 + row[6] = (b // 128) % 3 + row[8] = (b // 64) % 4 + if b % 37 == 0: + row = [rnd.randrange(128) for _ in range(12)] + row[0], row[3], row[6], row[8] = rnd.randrange(6), rnd.randrange(8), rnd.randrange(3), rnd.randrange(4) + rows[b] = tuple(row) + return rows + + +def dearest(t): + row = list(R.DEAREST) + row[R.TYPE_SLOT] = t + return tuple(row) + + +def stems(n, live): + rnd = random.Random(9) + on = lambda i, v: v if i < live else 0 # noqa: E731 + return [ + [on(i, round(0.9 * Q * (rnd.random() * 2 - 1) * math.exp(-(i % 11025) / 1500))) for i in range(n)], + [on(i, Q - 1 if (i // 110) % 2 else -Q) for i in range(n)], + [on(i, round(0.9 * Q * math.sin(2 * math.pi * (20 * (1000 ** (i / live))) * i / G.FS))) for i in range(n)], + [on(i, round(Q * (rnd.random() * 2 - 1))) for i in range(n)], + [on(i, Q - 1 if i % 4410 == 0 else 0) for i in range(n)], + [on(i, (Q - 1) if (i // 8820) % 2 else -Q) for i in range(n)], + [0] * n, + [on(i, round(0.3 * Q * sum(math.sin(2 * math.pi * f * i / G.FS) for f in (220, 277.2, 329.6)))) + for i in range(n)], + ] + + +def main(): + G.require_tools(HERE) + with G.workdir("loopbox-perf-") as tmp: + work = pathlib.Path(tmp) + asm = G.assemble(V.SOURCE, work) + if "--stress" not in sys.argv: + print(f"static: {static(asm)} cycles/sample (the per-sample loop's words)", flush=True) + sig = G.noise(16 * BLOCKS, 0.7, 5) + cases = {"defaults": dict(knobs=R.DEFAULTS), "moving": dict(rows=moving(BLOCKS))} + for t, name in enumerate(R.TYPE_NAMES): + cases[f"dearest {name}"] = dict(knobs=dearest(t)) + worst = (0.0, "") + for name, knobs in cases.items(): + found = {} + for split in range(16): + found[split] = G.run(asm, [G.Instance(sig, sig, **knobs)], split=split or None, tag="m").meter + if found[split] > worst[0]: + worst = (found[split], f"{name}, split {split}") + print(f"measured {name}: unsplit {found[0]:.2f}, worst with a split {max(found[s] for s in range(1, 16)):.2f}", + flush=True) + print(f"measured worst: {worst[0]:.2f} executed instructions a sample ({worst[1]})", flush=True) + + n = G.FS * SECONDS * 2 + insts = [G.Instance(s, s, rows=moving(n // 16, seed=k + 11), split=split, core=k // 4) + for k, (s, split) in enumerate(zip(stems(n, G.FS * SECONDS), (1, 3, 7, 8, 12, 15, 0, 0)))] + r = G.run(asm, insts, dirty=0x5a, guard="0x4000", extra=("-guard-shared",), check=False, tag="stress", timeout=3600) + print(f"stress: dsp_host exit {r.returncode}; meters {r.meters}; clobbers {sum(r.clobbers)}, stray {sum(r.stray)}") + for k, (core, pos) in enumerate(r.layout): + note = " (dsp_host's own word lands here)" if r.harness_word(k) else "" + print(f" instance {k}: core {core} pos {pos}, {r.per_instance[k]} a sample, {r.nonzero[k]} non-zero samples{note}") + if r.returncode: + print(r.stdout[-2000:]) + + +if __name__ == "__main__": + main() diff --git a/sdk/octatrack/modules/loopbox/presentation/thumbnail.svg b/sdk/octatrack/modules/loopbox/presentation/thumbnail.svg new file mode 100644 index 0000000000..5ca81bff7a --- /dev/null +++ b/sdk/octatrack/modules/loopbox/presentation/thumbnail.svg @@ -0,0 +1,42 @@ + + Loopbox — the latest audio, looped three ways + Original illustration: one short loop of a track and what each type makes of it. LAYER stacks the loop at its speed with one twice as fast and one half as fast; DUB records the live track into the loop on every pass, each pass a little quieter under the new one; SLIDE glides two overlapping loops up in pitch. A conceptual drawing, not a measured render or an Octatrack screenshot. + + + + LOOPBOX + FX2 + TIME · ACT · RPT + MIX · TAIL + LAYER + DUB + SLIDE + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1x2x½ + + diff --git a/sdk/octatrack/modules/loopbox/reference.py b/sdk/octatrack/modules/loopbox/reference.py new file mode 100644 index 0000000000..9385e1ccb3 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/reference.py @@ -0,0 +1,538 @@ +"""Loopbox's reference, imported by verify.py and test_reference.py. + +Model is engine.asm instruction by instruction, on 24-bit words and a 56-bit accumulator, so dsp_host's render +must match it to the bit (verify.py). The design is original: a capture ring in the FX2 slot's buffer, a slice +clock at the project tempo, and at each slice a decision (ACT) to loop the latest audio with three read heads, as +LAYER (heads at different speeds), DUB (sound-on-sound: the live track recorded into the loop as it plays, the +old passes fading) or SLIDE (two overlapping heads gliding evenly in pitch), each with variations A-D. Each head fades by its own position in its +window, and takes the newest window when it wraps, where its fade is nothing: loops overlap and change over without +a click. A smooth level rises when a loop starts and falls into the tail when it ends. No product's code, tables or +names. +""" +import math + +FS = 44100.0 +Q = 1 << 23 + +KNOBS = ("TIME", "ACT", "SHAP", "RPT", "MIX", "TAIL", "TYPE", "DIRT", "VAR", "WIDE", "RAND", "DGRD") +TYPE_SLOT, VAR_SLOT = 6, 8 +DEFAULTS = (2, 64, 32, 1, 64, 64, 0, 0, 0, 0, 0, 0) +DEAREST = (0, 127, 127, 7, 127, 127, 1, 127, 3, 127, 127, 127) +TYPE_NAMES = ("LAYER", "DUB", "SLIDE") +VAR_NAMES = ("A", "B", "C", "D") +TIME_LABELS = ("1/64", "1/32", "1/16", "1/8", "1/4", "1/2") +LAYER, DUB, SLIDE = 0, 1, 2 + +R = 15870 # the ring: words of the FX2 slot's buffer, ending at +$3DFD +FRESH_MAX = R - 16 # captured samples counted up to this +LMAX = 7900 # a chunk: a slice longer than this plays as 2, 4, 8, 16 or 32 chunks that fit (two and a margin in the ring) +# 2 x samples-per-note x tempo24 for each TIME (samples a beat = 63,504,000 / tempo24): (high word, low word) +TIME_DIVIDENDS = ((0, 0x791fd0), (0, 0xf23fa0), (1, 0xe47f40), (3, 0xc8fe80), (7, 0x91fd00), (15, 0x23fa00)) +ONE = 0x200000 # a rate of 1 (Q21) +T0 = (0x080000, 0x100000, 0x400000, 0x600000) # speeds: 0.25, 0.5, 2, 3 (Q21) +LN = (0x58b90c, 0x2c5c86, 0x2c5c86, 0x464faa) # |ln T0| / 2 (Q23), for an even glide +# LAYER's second and third heads for VAR A-C (Q21): an octave up and down; a fifth up and a fourth down; reversed and an octave down +LAYERS = (0x400000, 0x100000, 0x2ff222, 0x17f911, 0xe00000, 0x100000) +REVERSE = 0xe00000 # -1 (Q21) +UP, DOWN = 2, 1 # SLIDE's targets, as T0 indexes: an octave up, an octave down +ACT_SCALE = 0x5a0000 # ACT 127 loops about 70 % of the slices +MASKS = (0xffffff, 0xfff000, 0xffc000, 0xff8000, 0xff0000, 0xfe0000, 0xfc0000, 0xf80000) # DIRT's crush, by DIRT / 16 +DRIVE = 0x600000 # DIRT's drive: x (1 + 3 DIRT), as (1/4 + 3/4 DIRT) x 4, then x (1 - DIRT / 2) +THIRD = 0x2aaaab # 1/3: D = MIX + MIX/3, whole at MIX 96 +TAIL_MIN, TAIL_RANGE = 0x1b6, 0x64ea # the tail's decay a sample: about 3 s to -60 dB at TAIL 127, 50 ms at 0 +TAIL_END = 0x2000 # -72 dB: the tail is over +ATTACK = 0x009445 # the level's rise a sample when a loop starts: a 5 ms time constant +SILENT, SILENT_STOP, SILENT_MAX = 44100, 176400, 0x100000 # the silence watch: no new loop, then nothing +FADE_MIN = 64 # a head's fade is at least 64 samples, or half its window if that is shorter, and never under 5: +FADE_FLOOR = 5 # K = 2^25 / F stays a word; F >= W / 64 keeps min(p, W - p) x K x 2^22 a 56-bit sum +NEAR = 64 # a head whose window the writer comes this close to takes the newest window at once +ZONE = NEAR + 1024 # ... after fading out from here, over 64 blocks +DUB_IN = (0x400000, 0x266666, 0x133333, 0x07ae14) # DUB A-D: the live track's share of each pass (1 - what a pass keeps: +# A 0.5, B 0.7, C 0.85, D 0.94 of the old layers) +HALF, QUARTER = 0x400000, 0x200000 +SEED = 0x123456 +LFSR_TAPS = 0xe10000 + + +def notes(): + """The constants' formulas, for test_reference.py.""" + return { + "dividends": [2 * round(63504000 / d) for d in (16, 8, 4, 2, 1, 0.5)], + "T0": [round(r * (1 << 21)) for r in (0.25, 0.5, 2, 3)], + "LN": [round(abs(math.log(r)) / 2 * Q) for r in (0.25, 0.5, 2, 3)], + "LAYERS": [round(r * (1 << 21)) & 0xffffff for r in (2, 0.5, 2 ** (7 / 12), 2 ** (-5 / 12), -1, 0.5)], + "ATTACK": round((1 - math.exp(-1 / (0.005 * FS))) * Q), + } + + +# ---- the fixed-point model ------------------------------------------------- + +def s24(v): + v &= 0xffffff + return v - (1 << 24) if v & 0x800000 else v + + +def w56(a): + a &= (1 << 56) - 1 + return a - (1 << 56) if a >> 55 else a + + +def lim(a): + return max(-0x800000, min(0x7fffff, a >> 24)) + + +def hi(a): + return s24(a >> 24) + + +def ld(x): + return s24(x) << 24 + + +def mac(a, x, y): + return w56(a + 2 * s24(x) * s24(y)) + + +def mpy(x, y): + return mac(0, x, y) + + +def div(n, d): + """The 24-step div routine: floor(N / 2D), N the 48-bit dividend (effects.md, Traps).""" + return n // (2 * d) + + +def stepped(word, top): + return min((word & 0x7f0000) >> 16, top) + + +# Each head's words: window start (Y), position high and low, rate, gain, and the scratch word its faded read goes +# to. Every head wraps at the newest window's length (PW). +HEADS = ((0x0b, 0x0d, 0x0e, 0x0f, 0x6b, 0x55), + (0x78, 0x60, 0x61, 0x62, 0x64, 0x56), + (0x7a, 0x65, 0x66, 0x67, 0x69, 0x57)) +GLIDES = ((0x62, 0x63), (0x67, 0x68)) # SLIDE's two heads: rate and its change a block +DUB_KEEP = 0x79 # 1 while a DUB loop goes on: its next chunk keeps the window +PS, PW = 0x10, 0x11 # the newest window: start (Y) and W, which every head takes at its next wrap + + +class Model: + """One instance of engine.asm on a buffer at `base`. call(frames, p) runs one proc on [(left, right)] with the + parameter block p (offset -> word) and returns [(left, right)].""" + + def __init__(self, base=0x4000, ring=None): + self.x = [0] * 0x7b + self.ring = ring if ring is not None else [0] * R + x = self.x + x[0x00] = x[0x0b] = x[0x78] = x[0x7a] = x[PS] = base + x[0x01] = 1 if ld(base) - ld(0x4000) >= 0 else 0 + x[0x03] = 1 + x[0x14] = s24(0xffffff) + x[0x05] = SEED + x[0x24:0x28] = list(T0) + x[0x28:0x2c] = list(LN) + x[0x36:0x3c] = [s24(v) for v in LAYERS] + x[0x58:0x60] = [s24(v) for v in MASKS] + + def rand(self): + x = self.x + v = x[0x05] & 0xffffff + carry = v & 1 + v >>= 1 + if carry: + v ^= LFSR_TAPS + x[0x05] = s24(v) + return v & 0x7fffff + + def distance(self, start): + """How far the writer has to go to reach a window starting at start (Y).""" + x = self.x + d = (start - x[0x00]) - x[0x02] + if d < 0: + d += R + return d + + def call(self, frames, p): + x = self.x + if x[0x01] == 0: + return list(frames) + x[0x22] = stepped(p[0x0], 5) + x[0x1f] = lim(mpy(p[0x1] & 0x7fffff, ACT_SCALE)) + x[0x33] = 0x20000 + hi(mpy(p[0x2] & 0x7fffff, 0x3e0000)) # the fade's share of a window: 1/64 to 1/2 + x[0x21] = stepped(p[0x3], 7) + 1 + t5 = p[0x5] & 0x7fffff + s = lim(ld(0x7fffff) - ld(t5)) + x[0x32] = lim(mpy(lim(mpy(s, lim(mpy(s, s)))), TAIL_RANGE) + ld(TAIL_MIN)) + m = p[0x4] & 0x7fffff + x[0x1a] = 0x7fffff if m >= 0x7f0000 else m + x[0x1d] = stepped(p[0xc], 2) + x[0x1e] = stepped(p[0xd], 3) + x[0x51] = (p[0xc] & 0x00ff00) << 8 # DIRT, slot 7 + x[0x4e] = (p[0xd] & 0x00ff00) << 8 # WIDE, slot 9 + x[0x4f] = p[0xe] & 0x7f0000 # RAND, slot 10 + x[0x50] = (p[0xe] & 0x00ff00) << 8 # DGRD, slot 11 + t = s24(p.get(0x13, 0)) >> 8 + t = s24(t) + if t < 0x2d0: + t = 0xb40 + if t > 0x1c20: + t = 0x1c20 + x[0x23] = t + h, l = TIME_DIVIDENDS[x[0x22]] + length = div((h << 24) | l, t) + chunks = 1 + for _ in range(5): # up to 32 chunks: a 1/2 at 30 BPM still fits + if length > LMAX: + length >>= 1 + chunks <<= 1 + x[0x08] = length # a chunk + x[0x40] = chunks # chunks in a slice of TIME + if x[0x2c] == 0: + x[0x1b] = x[0x1a] + x[0x1c] = 0x7fffff + x[0x19] = x[0x08] + x[0x2c] = 1 + if abs(ld(x[0x1a]) - ld(x[0x1b])) < ld(64): + x[0x1b] = x[0x1a] + if x[0x18]: + if x[0x15] < TAIL_END: + self.quiet() + elif x[0x03]: # the writer kept off every window still sounding by a freeze + near = self.distance(x[PS]) <= 32 + for st, _ph, _pl, _rt, gn, _t in HEADS: + if x[gn] != 0 and self.distance(x[st]) <= 32: + near = True + if near: + x[0x03] = 0 + if x[0x03] == 0 and x[0x06] == 0 and x[0x18] == 0: + x[0x03] = 1 + x[0x04] = 0 + if x[0x53] >= SILENT_STOP: # four seconds of silence in: no loop, no tail, record again + self.quiet() + x[0x06] = x[0x04] = 0 + x[0x03] = 1 + if x[0x07] >= x[0x19]: + self.event() + n = len(frames) + for h, (st, ph, pl, _rt, gn, _t) in enumerate(HEADS): + # each head's gain an eighth of the way to its target a call: TYPE's, or nothing while the writer nears a + # window it still plays (then, close enough, it takes the newest window, faded out by then) + tgt = self.target(h) + if x[st] != x[PS]: + d = self.distance(x[st]) + if d <= ZONE: + tgt = 0 + if x[0x06] and d <= NEAR: + x[st], x[ph], x[pl] = x[PS], 0, 0 + x[gn] = hi(ld(x[gn]) + ((ld(tgt) - ld(x[gn])) >> 3)) + if x[0x1d] == DUB: # the side: WIDE spreads heads 1 and 2 (LAYER, SLIDE) at their gains now + x[0x3c] = x[0x3d] = 0 + else: + x[0x3c] = lim(mpy(x[0x64], x[0x4e])) + x[0x3d] = lim(-mpy(x[0x69], x[0x4e])) + for rt, gl in GLIDES: # SLIDE's glides: x (1 + c x frames / 16) a call, even in semitones + c = lim(w56(mpy(x[gl], n << 18) << 1)) + x[rt] = hi(mpy(x[rt], c) + ld(x[rt])) + # P: 1 while a loop plays, else 0 (a tail echoes over the whole track) + x[0x3f] = 0x7fffff if x[0x06] else 0 + # DUB: while a DUB loop plays, head 0 writes back s0 x (1 - IN) + the input x IN ($12 = -IN, $35 = IN); else + # nothing (the write leaves the ring as it was) + x[0x12] = x[0x35] = 0 + if x[0x06] and x[0x1d] == DUB: + x[0x35] = DUB_IN[x[0x1e]] + x[0x12] = s24(-DUB_IN[x[0x1e]]) + # DIRT, and in a tail DGRD x how far it has faded: the crush, the hold, the drive + d = x[0x51] + if x[0x18]: + d = lim(ld(d) + mpy(lim(ld(0x7fffff) - ld(x[0x15])), x[0x50])) + x[0x46] = s24((x[0x14] & 0xffffff) & (x[0x58 + (d >> 20)] & 0xffffff)) + x[0x47] = (d >> 19) + 1 + x[0x4a] = lim(mpy(d, DRIVE) + ld(0x200000)) + x[0x4b] = lim(ld(0x7fffff) - ld(d >> 1)) + out = [self.sample(left, right) for left, right in frames] + x[0x07] += n + x[0x53] = min(x[0x53] + n, SILENT_MAX) + if x[0x54] >= 64: + x[0x53] = 0 + x[0x54] = 0 + if x[0x03]: + x[0x04] = min(x[0x04] + n, FRESH_MAX) + return out + + def quiet(self): + """Nothing sounding: the level, its target and rate, and the tail's flag at rest.""" + x = self.x + x[0x18] = x[0x15] = x[0x20] = x[0x17] = 0 + + def event(self): + x = self.x + x[0x07] -= x[0x19] # what is left is how late this event is + if x[0x07] >= x[0x19]: + x[0x07] = 0 + if x[0x06]: + x[0x09] -= 1 + if x[0x09] != 0: + x[0x0a] += 1 + self.setrep() + return + self.chunk() # a chunk is over + x[0x42] -= 1 + if x[0x42] > 0: # the loop goes on through its slice of TIME + self.start() + return + x[0x06] = 0 # the loop is over: its heads loop on into the tail, steady in pitch + if x[0x03] == 0: # a DUB froze the writer: record again, from nothing captured + x[0x03] = 1 + x[0x04] = 0 + x[0x18] = 1 + x[0x20] = 0 + x[0x17] = x[0x32] + x[0x63] = x[0x68] = 0 + else: + self.chunk() + x[0x19] = x[0x08] + if x[0x41] != 0: # decided only on TIME's grid + return + if x[0x53] >= SILENT: # and not after a second of silence in + return + if x[0x04] < x[0x08]: + return + r = self.rand() + if x[0x1f] - r <= 0: + return + if x[0x03] == 0: # a tail froze the ring: end it, record again, wait for a fresh chunk + self.quiet() + x[0x04] = 0 + x[0x03] = 1 + return + x[0x42] = x[0x40] + self.start() + + def chunk(self): + x = self.x + x[0x41] += 1 + if x[0x41] >= x[0x40]: + x[0x41] = 0 + + def fade(self, w): + """The heads' fade for a window of w + 1: F = (w + 1) x SHAP's share, at least 64, at most half the window (so a + short window still reaches full level), never under 5; K = 2^25 / F.""" + x = self.x + f = hi(mpy(w + 1, x[0x33])) + if f < FADE_MIN: + f = FADE_MIN + h = (w + 1) >> 1 + if f > h: + f = h + if f < FADE_FLOOR: + f = FADE_FLOOR + x[0x13] = div(4 << 24, f) + + def target(self, h): + """Head h's gain for TYPE: LAYER 1/2, 1/4, 1/4; DUB head 0 whole; SLIDE heads 1 and 2 at 1/2.""" + kind = self.x[0x1d] + if kind == LAYER: + return (HALF, QUARTER, QUARTER)[h] + if kind == SLIDE: + return (0, HALF, HALF)[h] + return (0x7fffff, 0, 0)[h] + + def speed(self): + """A random index into T0.""" + return hi(mpy(self.rand(), 4)) + + def glide(self, i): + """The change a block that takes a rate of 1 to T0[i] over the chunk, evenly in semitones: ln(T) x 16 / chunk + (Q23), negative for a slower speed.""" + x = self.x + c = div(x[0x28 + i] << 6, x[0x34]) + return -c if i < 2 else c + + def start(self): + """A chunk of the loop starts: the latest audio becomes the newest window. A loop starting from silence sets + every head on it at once; one starting while heads still sound (the next chunk, or over a tail) leaves each + head to take it at its next wrap.""" + x = self.x + fresh = x[0x06] == 0 and x[0x18] == 0 + late = x[0x07] + x[DUB_KEEP] = 1 if (x[0x1d] == DUB and x[0x06] == 1) else 0 # a DUB going on keeps its window + x[0x06] = x[0x03] = 1 # a loop records: its window lies behind the writer + if x[0x1d] == DUB: # but DUB stops the writer: the loop is recorded into in place + x[0x03] = 0 + x[0x0a] = x[0x18] = 0 + x[0x20] = 0x7fffff + x[0x17] = ATTACK + x[0x45] = x[0x21] # RAND: a random number of loops, 1-8 + if x[0x4f] and x[0x4f] - self.rand() > 0: + x[0x45] = hi(mpy(self.rand(), 8)) + 1 + x[0x34] = x[0x08] + x[0x16] = lev = div(2 * x[0x08], x[0x45]) # the loop: a chunk / RPT + if not x[DUB_KEEP]: + s = x[0x02] - lev + if s < 0: + s += R + x[0x6e] = s + x[PS] = x[0x00] + s + x[PW] = lev - 1 + kind, var = x[0x1d], x[0x1e] + x[0x6c] = 1 + x[0x6d] = lev + x[0x63] = x[0x68] = 0 + x[0x0f] = x[0x62] = x[0x67] = ONE + if kind == LAYER: + if var == 3: + x[0x62] = x[0x24 + self.speed()] + x[0x67] = x[0x24 + self.speed()] + else: + x[0x62] = x[0x36 + 2 * var] + x[0x67] = x[0x37 + 2 * var] + if x[0x4f] and x[0x4f] - self.rand() > 0: # RAND: the second head at a random speed + x[0x62] = x[0x24 + self.speed()] + self.fade(x[PW]) + elif kind == SLIDE: + up, down = UP, DOWN + if var == 0: + down = UP + elif var == 1: + up = DOWN + elif var == 3: + up = down = self.speed() + if x[0x4f] and x[0x4f] - self.rand() > 0: # RAND: a random target + up = self.speed() + x[0x63] = self.glide(up) + x[0x68] = self.glide(down) + self.fade(x[PW]) + else: # DUB: head 0 loops the window, the live track recorded into it + self.fade(x[PW]) + if fresh: # from silence: every gain at TYPE's at once + x[0x6b], x[0x64], x[0x69] = self.target(0), self.target(1), self.target(2) + if fresh: # from silence: every head on the newest window now, on time + for st, ph, pl, rt, _gn, _t in HEADS: + x[st], x[pl] = x[PS], 0 + x[ph] = late + if x[rt] < 0: + x[ph] = x[PW] - 1 - late + if kind == SLIDE: + x[0x65] = (x[PW] >> 1) + late # the second loop half a window on + x[0x09] = x[0x45] + self.setrep() + + def setrep(self): + """An event within the chunk: WIDE's spread (LAYER, SLIDE) or ping-pong (DUB).""" + x = self.x + k = x[0x0a] + per = x[0x16] + if x[0x1d] == DUB: # WIDE: the passes ping-pong; with RAND anywhere in it + p = x[0x4e] if k & 1 == 0 else lim(-ld(x[0x4e])) + if x[0x4f] and x[0x4f] - self.rand() > 0: + r = self.rand() + p = lim(mpy(lim(w56((ld(r) - ld(0x400000)) << 1)), x[0x4e])) + else: # LAYER and SLIDE: no ping-pong (WIDE spreads heads 1 and 2, in the call) + p = 0 + x[0x19] = per + if x[0x09] == 1: # the chunk's last event takes what is left of it: the loop keeps the grid + x[0x19] = x[0x34] - (x[0x45] - 1) * per + x[0x52] = p + a = ld(0x7fffff) - ld(p) + if a - ld(0x7fffff) >= 0: + a = ld(0x7fffff) + b = ld(0x7fffff) + ld(p) + if b - ld(0x7fffff) >= 0: + b = ld(0x7fffff) + x[0x4d], x[0x4c] = lim(a), lim(b) + + def head(self, st, ph, pl, rt, gn, out): + """One read head: its position wraps inside the newest window's length at its rate, and at a wrap it takes the + newest window, where its fade is nothing; faded by how far it is from the window's ends; an interpolated read; + the faded read to its scratch word.""" + x, ring = self.x, self.ring + a = ld(x[ph]) + (x[pl] & 0xffffff) + a = w56(a + (ld(x[rt]) >> 21)) + w = x[PW] + fwd = ld(w) if a - ld(w) >= 0 else 0 + a -= fwd + back = ld(w) if a < 0 else 0 + a += back + if a - ld(w) >= 0: # still past the end (the window shrank under it): its start + a = 0 + if fwd + back != 0: + x[st] = x[PS] + x[ph], x[pl] = hi(a), a & 0xffffff + fh = (a & 0xffffff) >> 1 + b = ld(w) - a # the fade: min(p, W - p) x K + m = b if a - b > 0 else a + e = lim(w56(mpy(hi(m), x[0x13]) << 22)) + i = (x[st] - x[0x00] + hi(a)) % R + s0, s1 = ring[i], ring[(i + 1) % R] + if out == 0x55: # head 0: DUB's write back (s0 itself when not dubbing) + ring[i] = lim(mac(mac(ld(s0), s0, x[0x12]), x[0x3e], x[0x35])) + v = hi(mac(ld(s0), lim(ld(s1) - ld(s0)), fh)) + x[out] = lim(mpy(e, v)) + + def sample(self, left, right): + x, ring = self.x, self.ring + x[0x1b] = hi(((ld(x[0x1a]) - ld(x[0x1b])) >> 6) + ld(x[0x1b])) + m = x[0x1b] + x[0x43] = lim(mpy(m, THIRD) + ld(m)) # D: the loop's gain, whole at MIX 96 + x[0x44] = lim(w56((ld(0x7fffff) - ld(m)) << 2)) # K: the dry's ceiling, none at MIX 127 + x[0x2e], x[0x2f] = left, right + ring[x[0x02]] = v = lim((ld(left) + ld(right)) >> 2) + x[0x3e] = v # the input word, for DUB's write back + x[0x54] = max(x[0x54], abs(v)) # the mono ring word: what a loop can replay + x[0x02] = (x[0x02] + x[0x03]) % R + for h in HEADS: + self.head(*h) + acc = mac(mac(mpy(x[0x55], x[0x6b]), x[0x56], x[0x64]), x[0x57], x[0x69]) + rep = s24((hi(acc) & 0xffffff) & (x[0x46] & 0xffffff)) + x[0x30] = rep + x[0x77] = lim(mac(mpy(x[0x56], x[0x3c]), x[0x57], x[0x3d])) # the side: heads 1 and 2 apart + c = x[0x48] - 1 # DIRT's hold: a new sample every N + if c <= 0: + x[0x49] = rep + c = x[0x47] + x[0x48] = c + rep = x[0x49] + g = x[0x15] # the loop's level + # the dry ducks under the loop as its level rises + a = ld(0x7fffff) - ld(lim(mpy(lim(mpy(x[0x3f], g)), x[0x43]))) + if a - ld(x[0x44]) > 0: + a = ld(x[0x44]) + x[0x1c] = lim(a) + w = lim(w56(ld(rep) << 1)) # x 2: half the mono sum, level with a mono sample + w = lim(w56(mpy(w, x[0x4a]) << 2)) # DIRT's drive, clipped at full scale + w = lim(mpy(w, x[0x4b])) + wet = lim(mpy(w, g)) + x[0x31] = wet + wd = lim(mpy(wet, x[0x43])) + sg = lim(w56(mpy(lim(mpy(x[0x77], g)), x[0x43]) << 1)) + x[0x15] = hi(mpy(lim(ld(x[0x20]) - ld(g)), x[0x17]) + ld(g)) # the level toward its target + return (lim(mac(mpy(wd, x[0x4c]), left, x[0x1c]) + ld(sg)), + lim(mac(mpy(wd, x[0x4d]), right, x[0x1c]) - ld(sg))) + + +def pblock(values, raw=None): + """dsp_host's parameter block for slot values (0-127) and raw words {offset: word} written after.""" + v = list(values) + [0] * (12 - len(values)) + p = {i: (v[i] & 0x7f) << 16 for i in range(6)} + for w in range(3): + p[0xc + w] = ((v[6 + 2 * w] & 0x7f) << 16) | ((v[7 + 2 * w] & 0x7f) << 8) + p.update(raw or {}) + return p + + +def render(left, right, knob_rows, frames=16, split=0, raw=None, base=0x4000): + m = Model(base) + out_l, out_r = [], [] + cur = knob_rows.get(0, DEFAULTS) + for blk in range((len(left) + frames - 1) // frames): + cur = knob_rows.get(blk, cur) + p = pblock(cur, raw) + lo = blk * frames + fr = list(zip(left[lo:lo + frames], right[lo:lo + frames])) + for part in ([fr[:split], fr[split:]] if split else [fr]): + if not part: + continue + for l, r in m.call(part, p): + out_l.append(l) + out_r.append(r) + return out_l, out_r, m diff --git a/sdk/octatrack/modules/loopbox/test_reference.py b/sdk/octatrack/modules/loopbox/test_reference.py new file mode 100644 index 0000000000..78db326abc --- /dev/null +++ b/sdk/octatrack/modules/loopbox/test_reference.py @@ -0,0 +1,375 @@ +#!/usr/bin/env python3 +"""Loopbox's host test: no DSP tools, no firmware. reference.py's constants against their formulas, and the +model's behaviour: loops happen as often as ACT asks, every TYPE and VAR changes the sound, the heads loop without +a click, silence stays silent, ACT 0 and MIX 0 leave the track alone. verify.py holds engine.asm to the same model +in dsp_host. + + python3 -B test_reference.py +""" +import math +import pathlib +import random +import re +import sys +import unittest + +HERE = pathlib.Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import reference as R # noqa: E402 + +N = 16 * 2500 +FS = 44100 + + +def noise(seed, n=N, amp=0.5): + rnd = random.Random(seed) + return [round(amp * (rnd.random() * 2 - 1) * (R.Q - 1)) for _ in range(n)] + + +def knobs(**kw): + row = list(R.DEFAULTS) + names = {"time": 0, "act": 1, "shap": 2, "rpt": 3, "mix": 4, "tail": 5, "type": 6, "dirt": 7, "var": 8, + "wide": 9, "rand": 10, "dgrd": 11} + for name, value in kw.items(): + row[names[name]] = value + return tuple(row) + + +def tempo(bpm): + return {0x13: (bpm * 24) << 8} + + +class Constants(unittest.TestCase): + def test_constants_round_their_formulas(self): + n = R.notes() + self.assertEqual([(h << 24) | l for h, l in R.TIME_DIVIDENDS], n["dividends"]) + self.assertEqual(list(R.T0), n["T0"]) + self.assertEqual(list(R.LAYERS), n["LAYERS"]) + self.assertEqual(list(R.LN), n["LN"]) + self.assertEqual(R.ATTACK, n["ATTACK"]) + + def test_engine_carries_the_same_hex(self): + text = (HERE / "engine.asm").read_text().lower() + for w in [l for _, l in R.TIME_DIVIDENDS] + list(R.T0) + list(R.LAYERS) + list(R.MASKS) + list(R.LN) + [ + R.REVERSE, R.ATTACK, R.SEED, R.LFSR_TAPS, R.ACT_SCALE, R.TAIL_MIN, + R.TAIL_RANGE, R.TAIL_END, R.THIRD, R.DRIVE]: + self.assertIn(f"#>${w:06x}", text) + + def test_the_loop_and_a_chunk_fit_the_ring(self): + self.assertLessEqual(2 * R.LMAX, R.FRESH_MAX) + + def test_labels(self): + labels = [l.lower() for l in re.findall(r"^([A-Za-z_][A-Za-z0-9_]*):", (HERE / "engine.asm").read_text(), re.M)] + self.assertFalse([(a, b) for a in labels for b in labels if a != b and b.startswith(a)]) + self.assertEqual(len(labels), len(set(labels))) + + +class Behaviour(unittest.TestCase): + def test_slice_lengths_follow_the_tempo(self): + for bpm, time, want in ((120, 2, 5512), (120, 0, 1378), (90, 2, 7350), (60, 3, 5512)): + m = R.Model() + m.call([(0, 0)], R.pblock(knobs(time=time), tempo(bpm))) + self.assertEqual(m.x[0x08], want, (bpm, time)) + + def test_the_slowest_half_note_fits_the_ring(self): + m = R.Model() + m.call([(0, 0)], R.pblock(knobs(time=5), tempo(30))) + self.assertLessEqual(m.x[0x08], R.LMAX) + self.assertEqual(m.x[0x40], 32) + + def test_mix_zero_and_act_zero_leave_the_track(self): + x = noise(1) + for row in (knobs(act=0), knobs(act=127, mix=0, tail=0)): + out = R.render(x, x, {0: row})[0] + self.assertLessEqual(max(abs(a - b) for a, b in zip(x, out)), 1, row) + + def test_act_sets_how_often(self): + def starts(act): + m, n = R.Model(), [0] + start = m.start + m.start = lambda: (n.__setitem__(0, n[0] + 1), start()) + x = noise(2) + row = R.pblock(knobs(act=act, time=1)) + for b in range(0, N, 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + return n[0] + self.assertEqual(starts(0), 0) + self.assertGreater(starts(127), starts(40)) + + def test_every_type_and_variation_sounds_different(self): + x = noise(3) + outs = {} + for t in range(3): + for v in range(4): + outs[(t, v)] = R.render(x, x, {0: knobs(act=127, time=1, mix=127, type=t, var=v)})[0] + keys = list(outs) + for i, a in enumerate(keys): + for b in keys[i + 1:]: + self.assertNotEqual(outs[a], outs[b], (a, b)) + + def test_layer_heads_play_at_their_speeds(self): + for v, (r1, r2) in enumerate(zip(R.LAYERS[0::2], R.LAYERS[1::2])): + m = R.Model() + x = noise(4, 16 * 600) + row = R.pblock(knobs(act=127, time=1, type=R.LAYER, var=v)) + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + if m.x[0x06]: + break + self.assertEqual((m.x[0x0f], m.x[0x62], m.x[0x67]), (R.ONE, R.s24(r1), R.s24(r2)), v) + self.assertEqual((m.x[0x6b], m.x[0x64], m.x[0x69]), (R.HALF, R.QUARTER, R.QUARTER)) + + def test_dub_records_the_track_into_the_loop(self): + # A DUB loop stops the writer and records the live track into its window as head 0 plays it: after a few + # passes the window holds the new input too. When the loop ends the writer records again, from nothing. + m = R.Model() + x = noise(5, 16 * 2000) + tone = [round(0.5 * (R.Q - 1) * math.sin(2 * math.pi * 300 * i / R.FS)) for i in range(16 * 2000)] + row = R.pblock(knobs(act=127, time=2, rpt=0, type=R.DUB, var=0)) + b = 0 + while not m.x[0x06]: + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + b += 16 + self.assertEqual(m.x[0x03], 0) + s, w = m.x[R.PS] - m.x[0x00], m.x[R.PW] + 1 + before = [m.ring[(s + i) % R.R] for i in range(w)] + for _ in range(3 * w // 16): + m.call([(tone[b + i], tone[b + i]) for i in range(16)], row) + b += 16 + if not m.x[0x06]: + break + after = [m.ring[(s + i) % R.R] for i in range(w)] + self.assertNotEqual(before, after) + drift = sum(abs(a_ - b_) for a_, b_ in zip(before, after)) / w + self.assertGreater(drift, 0x10000) + quiet = R.pblock(knobs(act=0, time=2, rpt=0, type=R.DUB, var=0)) + for _ in range(4000): + m.call([(0, 0)] * 16, quiet) + if not m.x[0x06]: + break + self.assertEqual(m.x[0x03], 1) + + def test_dub_keeps_its_window_through_the_slice(self): + # TIME 1/2 at 120 BPM is several chunks: a DUB loop keeps one window for all of them (a LAYER loop takes the + # newest at each chunk). + def windows(kind): + m = R.Model() + x = noise(7, 16 * 9000) + row = R.pblock(knobs(act=127, time=5, rpt=0, type=kind, tail=0), tempo(120)) + seen = set() + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + if m.x[0x06]: + seen.add(m.x[R.PS]) + elif seen: + break + return seen + self.assertEqual(len(windows(R.DUB)), 1) + self.assertGreater(len(windows(R.LAYER)), 1) + + def test_var_sets_how_long_the_old_layers_last(self): + # Fed silence after the loop starts, each pass keeps 1 - IN of the last: A fades fastest, D slowest. + def left(var): + m = R.Model() + x = noise(8, 16 * 2000) + row = R.pblock(knobs(act=127, time=3, rpt=0, type=R.DUB, var=var, tail=127), tempo(60)) + b = 0 + while not m.x[0x06]: + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + b += 16 + s, w = m.x[R.PS] - m.x[0x00], m.x[R.PW] + 1 + e0 = sum(abs(m.ring[(s + i) % R.R]) for i in range(w)) + for _ in range(4 * w // 16): + m.call([(0, 0)] * 16, row) + return sum(abs(m.ring[(s + i) % R.R]) for i in range(w)) / e0 + kept = [left(v) for v in range(4)] + self.assertEqual(kept, sorted(kept)) + self.assertLess(kept[0], 0.2) + self.assertGreater(kept[3], 0.6) + + def test_other_loops_leave_the_ring_as_it_was(self): + # Head 0's write back is s0 itself unless a DUB loop plays: a LAYER loop reads the ring and never changes it. + m = R.Model() + x = noise(9, 16 * 1500) + row = R.pblock(knobs(act=127, time=2, type=R.LAYER)) + for b in range(0, len(x), 16): + before = list(m.ring) + w0 = m.x[0x02] + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + written = {(w0 + i) % R.R for i in range(17)} + self.assertTrue(all(before[i] == m.ring[i] for i in range(R.R) if i not in written)) + + def test_slide_glides_its_heads_evenly(self): + # A both up an octave, B both down, C one up and one down: the change a block is x (1 + c), c = ln(T) x 16 / chunk. + want = {0: (1, 1), 1: (-1, -1), 2: (1, -1)} + for v, (up, down) in want.items(): + m = R.Model() + x = noise(6, 16 * 600) + row = R.pblock(knobs(act=127, time=2, type=R.SLIDE, var=v)) + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + if m.x[0x06]: + break + sign = lambda w: (w > 0) - (w < 0) # noqa: E731 + self.assertEqual((sign(m.x[0x63]), sign(m.x[0x68])), (up, down), v) + self.assertEqual(m.x[0x6b], 0) # head 0 rests in SLIDE + # the second loop starts half a window on, plus how late the start was (under a block), then a block played + self.assertTrue(12 <= m.x[0x65] - (m.x[0x11] >> 1) <= 34, m.x[0x65] - (m.x[0x11] >> 1)) + # over a chunk an octave up lands near a rate of 2, evenly: half way it is near the square root of 2 + m = R.Model() + m.x[0x34] = 4096 + c = m.glide(R.UP) + rate, rates = R.ONE, [] + for _ in range(4096 // 16): + rate = R.hi(R.mpy(rate, c) + R.ld(rate)) + rates.append(rate) + self.assertAlmostEqual(rates[-1] / R.ONE, 2.0, delta=0.02) + self.assertAlmostEqual(rates[len(rates) // 2 - 1] / R.ONE, 2 ** 0.5, delta=0.02) + + def test_a_head_is_silent_at_the_window_ends(self): + # The fade by position: at either end of the window a head gives almost nothing, so a wrap is silent. + m = R.Model() + m.x[0x11] = 1000 + m.x[0x33] = 0x100000 + m.fade(1000) + m.ring[:] = [0x200000] * R.R + for pos, most in ((0, 0), (999, 0x40000), (500, 0x7fffff)): + m.x[0x0d], m.x[0x0e], m.x[0x0f] = pos, 0, 0 + m.head(*R.HEADS[0]) + self.assertLessEqual(abs(m.x[0x55]), most, pos) + self.assertGreater(m.x[0x55], 0x100000) # in the middle it is whole + + def test_heads_take_the_newest_window_at_their_own_wraps(self): + # LAYER over a slice of several chunks: each head changes over to the next chunk's window as it wraps, not + # all at once, so for a while old and new loops sound together. + m = R.Model() + x = noise(10, 16 * 3000) + row = R.pblock(knobs(act=127, time=4, rpt=1, type=R.LAYER, var=0), tempo(120)) + mixed = False + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + starts = {m.x[st] for st, *_ in R.HEADS} + if m.x[0x06] and len(starts) > 1: + mixed = True + self.assertTrue(mixed) + + def test_layer_spreads_its_heads_with_wide(self): + x = noise(11) + l0, r0, _ = R.render(x, x, {0: knobs(act=127, time=1, mix=127, type=R.LAYER)}) + l1, r1, _ = R.render(x, x, {0: knobs(act=127, time=1, mix=127, type=R.LAYER, wide=127)}) + self.assertEqual(l0, r0) + self.assertNotEqual(l1, r1) + + def test_a_head_past_a_shrunk_window_lands_on_its_start(self): + # The newest window shrank under a head (RAND's repeat count, RPT or TIME turned): after the wrap it is still + # past the end, so it lands at the start, where the fade is nothing; never a negative, inverted fade. + m = R.Model() + m.x[R.PW] = 986 + m.x[0x33] = 0x100000 + m.fade(986) + m.ring[:] = [0x200000] * R.R + m.x[0x0d], m.x[0x0e], m.x[0x0f] = 5000, 0, R.ONE + m.head(*R.HEADS[0]) + self.assertEqual(m.x[0x0d], 0) + self.assertGreaterEqual(m.x[0x55], 0) + + def test_short_windows_reach_full_level(self): + # A window shorter than two minimum fades fades over half of itself, so its middle is whole. + m = R.Model() + m.x[R.PW] = 20 + m.x[0x33] = 0x020000 + m.fade(20) + m.ring[:] = [0x200000] * R.R + m.x[0x0d], m.x[0x0e], m.x[0x0f] = 9, 0, 0 + m.head(*R.HEADS[0]) + self.assertGreater(m.x[0x55], 0x1c0000) + + def test_a_chunk_lasts_its_grid_while_looping(self): + # The chunk's last event takes what is left, so a loop's events add up to the chunk exactly (no drift). + for kind, var in ((R.DUB, 1), (R.LAYER, 0)): + m = R.Model() + x = noise(13, 16 * 400) + lengths, setrep = [], m.setrep + def watched(): + setrep() + lengths.append((m.x[0x09], m.x[0x19], m.x[0x34])) + m.setrep = watched + row = R.pblock(knobs(act=127, time=0, rpt=7, type=kind, var=var)) + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + if lengths and lengths[-1][0] == 1: + break + self.assertEqual(sum(l for _, l, _c in lengths), lengths[0][2], kind) + + def test_slide_glides_the_same_with_trig_splits(self): + def rate(split): + x = noise(15, 16 * 900) + return R.render(x, x, {0: knobs(act=127, time=3, rpt=0, type=R.SLIDE, var=0)}, split=split)[2].x[0x62] + self.assertAlmostEqual(rate(5) / rate(0), 1.0, delta=0.03) + + def test_a_head_fades_out_before_a_forced_changeover(self): + # A slow head the writer is about to reach: its gain falls toward nothing inside the zone, and at the last + # moment it takes the newest window at its start. + m = R.Model() + m.x[0x1d] = R.LAYER + m.x[0x06] = 1 # a loop playing, with no event due during the test + m.x[0x19], m.x[0x2c] = 0x100000, 1 + m.x[0x64] = R.QUARTER + m.x[0x02] = 1000 + m.x[0x78] = m.x[0x00] + 1000 + 500 # 500 samples ahead of the writer: inside the zone + m.x[R.PS] = m.x[0x00] + 100 + m.x[0x60] = 300 + p = R.pblock(knobs(act=0, type=R.LAYER)) + gains = [] + for _ in range(28): + m.call([(0, 0)] * 16, p) + gains.append(m.x[0x64]) + self.assertTrue(all(b <= a for a, b in zip(gains, gains[1:]))) + self.assertLess(gains[-1], R.QUARTER // 20) + m.call([(0, 0)] * 16, p) # within NEAR of the writer now + self.assertEqual((m.x[0x78], m.x[0x60]), (m.x[R.PS], 0)) + + def test_tail_rings_on_after_a_loop(self): + # Loops, then none from block 680: the last loop ends within a slice; TAIL 0 is a short release (gone a few + # blocks on), and longer TAILs ring on for longer. + x = noise(7) + def ringing(tail, frm): + rows = {0: knobs(act=127, time=1, mix=96, tail=tail), 680: knobs(act=0, time=1, mix=96, tail=tail)} + out = R.render(x, x, rows)[0] + return sum(1 for a, b in zip(x[16 * frm:], out[16 * frm:]) if abs(a - b) > 2) + self.assertEqual(ringing(0, 900), 0) + self.assertGreater(ringing(40, 900), 0) + self.assertGreater(ringing(127, 900), ringing(40, 900)) + + def test_it_falls_silent_after_the_input_stops(self): + x = noise(8, FS * 7) + x = [v if i < FS else 0 for i, v in enumerate(x)] + for t in range(3): + out = R.render(x, x, {0: knobs(act=127, tail=127, type=t, mix=127, time=2)})[0] + self.assertFalse(any(out[FS * 6:]), t) + + def test_a_loop_never_starts_on_a_frozen_ring(self): + x = noise(9, 16 * (FS * 6 // 16)) + m, seen = R.Model(), [] + start = m.start + def watched(): + seen.append(m.x[0x03] == 1) + start() + m.start = watched + froze = False + row = R.pblock(knobs(act=40, tail=127, time=4, rpt=0, type=R.LAYER), tempo(95)) + for b in range(0, len(x), 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + froze = froze or (m.x[0x03] == 0) + self.assertTrue(froze) + self.assertTrue(seen and all(seen)) + + def test_silence_stays_silent(self): + z = [0] * N + for t in range(3): + out = R.render(z, z, {0: R.DEAREST[:6] + (t,) + R.DEAREST[7:]}) + self.assertFalse(any(out[0]) or any(out[1]), t) + + +if __name__ == "__main__": + unittest.main() diff --git a/sdk/octatrack/modules/loopbox/verify.py b/sdk/octatrack/modules/loopbox/verify.py new file mode 100644 index 0000000000..5fa57206a1 --- /dev/null +++ b/sdk/octatrack/modules/loopbox/verify.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python3 +"""Loopbox's render gate: engine.asm assembled and run in dsp_host, held to reference.py's model. + + python3 -B verify.py (needs the DSP tools; a few minutes) + python3 -B verify.py --fx-audit PLAN RENDERS [--type N --var N] + +No firmware is read: the harness is sdk/octatrack/tools/dsp_gate.py, a synthetic image and dsp_host, whose +allocator hands the instance Y:$4000 (an FX2-sized slot). Knobs arrive as value << 16; TYPE is slot 6 and VAR +slot 8 (bits 16-23 of r6+$c and r6+$d); the tempo word, tempo24 << 8, is r6+$13. What this cannot see: the +composed image, the real dispatcher and allocator, the panel and the sound on a unit. + +Gates: + 1. Every instruction decodes as written (signed mpy/mac x0,y1, no rep, no mpysu/macsu), no label is a + prefix of another (case-blind), the state stays inside X:(r7+$00..$7a), and proc returns with every + modifier register it set to a modulus linear again. + 2. Bit for bit the model: every TYPE and VAR looping at every slice, the defaults at three tempos, TIME 1/4 + and 1/2 through every chunk, every + knob swept, a tempo change while playing, a 5-frame trig split every block, a knob word carrying an LFO's + fraction bits, garbage state before init, state from two seeds, and an FX1-sized slot (dry). + 3. Silence in is exact silence out; a burst's tail ends in exact silence; after the input stops, every type falls + silent within 6 s at TAIL 127, and every TYPE and VAR at TIME 1/4 within 4.2 s (the silence watch). + 4. The cycle meter, printed for TESTING.md: every TYPE and VAR, the dearest setting, TAIL's ring-freeze path. +""" +import pathlib +import re +import sys + +HERE = pathlib.Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) + + +def _library(): + for base in HERE.parents: + if (base / "sdk/octatrack/tools/dsp_gate.py").is_file(): + return base / "sdk/octatrack/tools" + sys.exit("[FAIL] sdk/octatrack/tools/dsp_gate.py not found: run this inside a Modwerk checkout") + + +sys.path.insert(0, str(_library())) +import dsp_gate as G # noqa: E402 +import reference as R # noqa: E402 + +SOURCE = HERE / "engine.asm" +STATE_LAST = 0x7a + + +def knobs(base=R.DEFAULTS, **kw): + row = list(base) + [0] * (12 - len(base)) + names = {"time": 0, "act": 1, "shap": 2, "rpt": 3, "mix": 4, "tail": 5, "type": R.TYPE_SLOT, "dirt": 7, + "var": R.VAR_SLOT, "wide": 9, "rand": 10, "dgrd": 11} + for name, value in kw.items(): + row[names[name]] = value + return tuple(row) + + +def tempo(bpm): + return (bpm * 24) << 8 + + +def main(): + G.require_tools(HERE) + gate = G.Gates("loopbox") + with G.workdir("loopbox-verify-") as tmp: + work = pathlib.Path(tmp) + asm = G.assemble(SOURCE, work) + if "--fx-audit" in sys.argv: + plan, renders = sys.argv[sys.argv.index("--fx-audit") + 1:][:2] + t = int(sys.argv[sys.argv.index("--type") + 1]) if "--type" in sys.argv else 0 + v = int(sys.argv[sys.argv.index("--var") + 1]) if "--var" in sys.argv else 3 + for path in G.render_fx_audit(asm, plan, renders, knobs(R.DEAREST, type=t, var=v)): + print(path.name, flush=True) + return + + # 1. decodes as written + problems = G.trap_problems(asm, forms=("x0,y1",)) + gate("1 decodes as written: signed mpy/mac x0,y1, no rep, no mpysu/macsu", not problems, "; ".join(problems[:4])) + labels = [l.lower() for l in re.findall(r"^([A-Za-z_][A-Za-z0-9_]*):", SOURCE.read_text(), re.M)] + clashes = [(a, b) for a in labels for b in labels if a != b and b.startswith(a)] + [l for l in set(labels) if labels.count(l) > 1] + gate("1 no label is a prefix of another, case-blind (dsp_asm resolves labels by prefix)", not clashes, str(clashes)) + # Every modifier register proc sets to a modulus is linear again where proc returns (gbzz): the code that + # runs after an effect addresses with them (every published effect resets them; dsp_host cannot hear it). + text = SOURCE.read_text() + bent = sorted(set(re.findall(r"move\s+#>?\$(?!ffffff)[0-9a-fA-F]+,(m[0-7])", text))) + tail = text[text.index("\ngbzz:"):] + tail = tail[:tail.index("rts")] + unreset = [m for m in bent if not re.search(r"move\s+#>?\$ffffff," + m + r"\b", tail)] + gate("1 proc leaves every modifier register it bends linear again (" + ", ".join(bent) + ")", bool(bent) and not unreset, str(unreset)) + # lua (Rn+aa) takes a 7-bit signed offset: dsp_asm wraps a larger one without a word (DIRT's table at $58 + # read 40 words below r7 before this gate). + far = [l.strip() for l in text.splitlines() if re.search(r"\blua\s+\(r[0-7]\+\$([0-9a-fA-F]+)\)", l) + and int(re.search(r"\(r[0-7]\+\$([0-9a-fA-F]+)\)", l).group(1), 16) > 0x3f] + gate("1 every lua (Rn+aa) offset is within its 7 bits (at most $3f)", not far, "; ".join(far)) + offsets = G.state_offsets(SOURCE.read_text()) + gate("1 state inside X:(r7+$00..$7a)", bool(offsets) and offsets[-1] <= STATE_LAST, f"(highest ${offsets[-1]:02x})") + + # 2. bit for bit the model + n = 16 * 3000 + nl, nr = G.noise(n, 0.6, 1), G.noise(n, 0.6, 2) + tl = [a + b for a, b in zip(G.tone(220, 0.4, n), G.noise(n, 0.1, 3))] + + def same(name, inst, raw=None, **kw): + r = G.run(asm, [inst], split=kw.get("split"), pwords=kw.get("pwords"), dirty=kw.get("dirty"), + image=kw.get("image")) + rows = inst.rows or {0: inst.knobs} + want = R.render(inst.left, inst.right, rows, split=kw.get("split") or 0, raw=raw, base=kw.get("base", 0x4000)) + gate.same(name, r.outputs[0], want[:2]) + return r + + def tempo_words(bpm): + return dict(pwords=[(0, 0x13, tempo(bpm))], raw={0x13: tempo(bpm)}) + + meters = {} + for t, tname in enumerate(R.TYPE_NAMES): + for v, vname in enumerate(R.VAR_NAMES): + row = knobs(time=0, act=127, rpt=3, shap=64, type=t, var=v) + meters[tname + vname] = same(f"2 {tname} {vname} looping at every slice", G.Instance(tl, nl, knobs=row)).meter + for bpm in (90, 120, 174): + same(f"2 the defaults at {bpm} BPM", G.Instance(nl, nr, knobs=R.DEFAULTS), **tempo_words(bpm)) + rows, block = {0: knobs(time=1, act=110)}, 40 + for slot, values in (("time", (0, 5, 4, 1)), ("act", (0, 127, 100)), ("shap", (0, 127, 40)), ("rpt", (0, 7, 2)), + ("mix", (0, 127, 100)), ("type", (1, 2, 0)), ("var", (1, 2, 3, 0)), + ("dirt", (127, 40)), ("wide", (127, 60)), ("rand", (127, 30)), ("dgrd", (127, 0))): + for value in values: + rows[block] = knobs(rows[max(rows)], **{slot: value}) + block += 120 + same("2 every knob swept while glitching", G.Instance(nl, nr, rows=rows)) + long_n = 16 * 14000 + ll, lr = G.noise(long_n, 0.6, 5), G.noise(long_n, 0.6, 6) + for time, label in ((4, "1/4"), (5, "1/2")): + same(f"2 TIME {label} at 120 BPM: glitches on its grid, through every chunk of the slice", + G.Instance(ll, lr, knobs=knobs(time=time, act=64)), **tempo_words(120)) + for t, tname in ((1, "DUB"), (0, "LAYER")): + same(f"2 {tname}, TIME 1/2 at 30 BPM: 32 chunks, each within the ring's reach", + G.Instance(ll, lr, knobs=knobs(time=5, act=127, rpt=1, type=t, var=1)), **tempo_words(30)) + frz2 = list(knobs(time=4, rpt=0, act=40, type=1)) + frz2[5] = 127 + same("2 TAIL 127, TIME 1/4, RPT 1: a glitch due while the tail froze the ring ends it and records again", + G.Instance(ll, lr, knobs=tuple(frz2)), **tempo_words(95)) + for t, tname in enumerate(R.TYPE_NAMES): + rows2 = {0: knobs(R.DEAREST, type=t, time=1, act=110), 400: knobs(R.DEAREST, type=t, time=1, act=0)} + same(f"2 {tname}: DIRT, WIDE, RAND and DGRD at full, glitches then a degrading tail", G.Instance(tl, nl, rows=rows2)) + same("2 a tempo change while playing (raw word every call)", G.Instance(nl, nr, knobs=knobs(time=0, act=127)), + pwords=[(0, 0x13, tempo(140))], raw={0x13: tempo(140)}) + same("2 a trig split every block", G.Instance(nl, nr, rows=rows), split=5) + word = (127 << 16) | 0xb700 + same("2 a knob word with an LFO's fraction bits", G.Instance(nl, nr, knobs=knobs(act=127, time=0)), + pwords=[(0, 1, word)], raw={1: word}) + same("2 garbage state before init", G.Instance(nl, nr, rows=rows), dirty=0x5a5a5a) + gate.two_seeds("2 the same output from state filled with two seeds: nothing read before it is written", + asm, [G.Instance(nl, nr, rows=rows)]) + same("2 an FX1-sized slot passes the track dry", G.Instance(nl, nr, knobs=knobs(act=127, time=0)), + image=asm.image(x={G.ALLOC_AT: 0x2000}, name="fx1"), base=0x2000) + + # 3. silence + z = [0] * n + for t, tname in enumerate(R.TYPE_NAMES): + (l, r), = G.run(asm, [G.Instance(z, z, knobs=knobs(R.DEAREST, type=t))], tag="zero").outputs + gate(f"3 {tname}: silence in, silence out at the dearest setting", not any(l + r)) + m = G.FS * 3 + x = G.burst(4410, m) + (l, r), = G.run(asm, [G.Instance(x, x, knobs=knobs(R.DEAREST, type=1))], tag="tail").outputs + gate("3 a burst's tail ends in silence", not any(l[-G.FS // 2:] + r[-G.FS // 2:])) + + stop = [v if i < G.FS else 0 for i, v in enumerate(G.noise(G.FS * 8, 0.6, 4))] + for t, tname in enumerate(R.TYPE_NAMES): + frow = list(knobs(R.DEAREST, type=t, time=2, act=40)) + frow[5] = 127 + (l, r), = G.run(asm, [G.Instance(stop, stop, knobs=tuple(frow))], tag="stop").outputs + gate(f"3 {tname}: falls silent within 6 s after the input stops, TAIL 127", not any(l[G.FS * 7:] + r[G.FS * 7:])) + + quiet = [v if i < G.FS * 2 else 0 for i, v in enumerate(G.noise(16 * (G.FS * 7 // 16), 0.6, 7))] + for t, tname in enumerate(R.TYPE_NAMES): + for v, vname in enumerate(R.VAR_NAMES): + q = knobs(time=4, act=64, type=t, var=v) + q = q[:5] + (127,) + q[6:] + r = G.run(asm, [G.Instance(quiet, quiet, knobs=q)], pwords=[(0, 0x13, tempo(95))], tag="quiet") + want = R.render(quiet, quiet, {0: q}, raw={0x13: tempo(95)}) + (l, rr), = r.outputs + ok = (l, rr) == tuple(want[:2]) and not any(l[int(G.FS * 6.2):] + rr[int(G.FS * 6.2):]) + gate(f"3 {tname} {vname}: TIME 1/4, TAIL 127, 95 BPM: bit for bit, and silent 4.2 s after the input stops", ok) + + # 4. cost: also at the dearest setting and on TAIL's ring-freeze path (TIME 1/4, RPT 1, TAIL 127) + for t, tname in enumerate(R.TYPE_NAMES): + meters["dear " + tname] = G.run(asm, [G.Instance(tl, nl, knobs=knobs(R.DEAREST, type=t))], tag="dear").meter + frz = list(knobs(R.DEAREST, type=t, time=4, rpt=0, act=40)) + frz[5] = 127 + meters["freeze " + tname] = G.run(asm, [G.Instance(tl, nl, knobs=tuple(frz))], tag="freeze").meter + print("[INFO] cycle meter, looping at every slice: " + ", ".join(f"{k} {v}" for k, v in meters.items())) + print(f"[INFO] dsp_gate.py {G.provenance(HERE)['dsp_gate.py']}") + gate.finish() + + +if __name__ == "__main__": + main() diff --git a/src/catalog/module-documents.json b/src/catalog/module-documents.json index 2cf34e16b9..0aef71818e 100644 --- a/src/catalog/module-documents.json +++ b/src/catalog/module-documents.json @@ -6241,6 +6241,379 @@ } ] }, + { + "schemaVersion": 2, + "id": "loopbox", + "key": "LOOPBOX", + "name": "Loopbox", + "version": "0.1.1-experimental", + "category": "effects", + "access": { + "location": "FX2 SETUP page of any audio track (the effect list).", + "steps": [ + "Select an audio track with its TRACK key.", + "Hold FUNC and press FX2 to open the effect's SETUP, turn LEVEL to LOOPBOX and press YES.", + "Press FX2 for TIME, ACT, SHAP, RPT, MIX and TAIL; hold FUNC and press FX2 again for TYPE (A), DIRT (B), VAR (C), WIDE (D), RAND (E) and DGRD (F)." + ], + "screenshots": [ + "media/ot-location.png", + "media/ot-controls.png" + ] + }, + "author": { + "github": "jrs1717", + "credits": [ + "jrs1717" + ] + }, + "nativeManifest": "manifest.py", + "presentation": { + "label": "LOOP", + "family": "Looper", + "summary": "Automatic micro-loops on FX2: overlapping loops at different speeds, slices replayed in a new order, or loops gliding in pitch, all at the project's tempo.", + "overview": "Loopbox keeps the last third of a second of the track. On a note grid at the project's tempo, ACT decides when a slice loops; a loop plays the latest audio with three read heads on one window. LAYER stacks heads at different speeds, DUB records the live track into the loop as it plays, sound-on-sound, SLIDE glides two overlapping loops in pitch. MIX blends it with the track, TAIL lets a loop ring on after it ends.", + "highlights": [ + "Three types, four variations each: LAYER, DUB and SLIDE", + "Loops on a note grid from 1/64 to 1/2 at the project's tempo", + "Each read head fades by its own position, so loops at any speed are click-free", + "DIRT, WIDE ping-pong, RAND and a degrading TAIL on the setup page" + ], + "usage": [ + "Select a track, press FUNC + FX2 and choose LOOPBOX at the end of the list.", + "Start with TYPE LAYER, ACT 64, TIME 1/16 and MIX 64 on a drum loop, then try SLIDE, and DUB at TIME 1/2 and RPT 1, where each loop gets eight passes to build." + ] + }, + "controls": [ + { + "name": "TIME", + "default": 2, + "count": 6, + "doc": "Slice length at the tempo, 1/64 to 1/2; loops start on it and last it, in chunks of 179 ms at most.", + "labels": [ + "1/64", + "1/32", + "1/16", + "1/8", + "1/4", + "1/2" + ] + }, + { + "name": "ACT", + "default": 64, + "count": 128, + "doc": "The share of slices that loop: 0 none, 127 about 70 %.", + "labels": null + }, + { + "name": "SHAP", + "default": 32, + "count": 128, + "doc": "The loops' fades: 1/64 of a loop at 0, rising evenly to a full swell.", + "labels": null + }, + { + "name": "RPT", + "default": 1, + "count": 8, + "doc": "How many times a loop cycles in a chunk: 1 the whole chunk once, 8 an eighth of it eight times.", + "labels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "name": "MIX", + "default": 64, + "count": 128, + "doc": "How far a loop takes over: 96 replaces the track at the loop's peak; 127 the loops alone.", + "labels": null + }, + { + "name": "TAIL", + "default": 64, + "count": 128, + "doc": "After a loop its heads loop on and fade: 0 a short release (about 50 ms), 127 about 3 s; a loop that starts over a tail picks up from there.", + "labels": null + }, + { + "name": "TYPE", + "default": 0, + "count": 3, + "doc": "LAYER stacks heads at different speeds, DUB records the track into the loop as it plays, SLIDE glides the pitch.", + "labels": [ + "LAYER", + "DUB", + "SLIDE" + ] + }, + { + "name": "DIRT", + "default": 0, + "count": 128, + "doc": "Grit on the loops: sample-rate reduction, harder crush and clipping drive; 0 clean.", + "labels": null + }, + { + "name": "VAR", + "default": 0, + "count": 4, + "doc": "Variation A-D: octaves, fifths, reversed or random layers; 4 or 8 slices, reversed or ratcheted; up, down, apart or random glides.", + "labels": [ + "A", + "B", + "C", + "D" + ] + }, + { + "name": "WIDE", + "default": 0, + "count": 128, + "doc": "Ping-pong: loops alternate left and right this far; with RAND anywhere in it.", + "labels": null + }, + { + "name": "RAND", + "default": 0, + "count": 128, + "doc": "Chaos: random loop counts, speeds, glide targets and places; 0 as set.", + "labels": null + }, + { + "name": "DGRD", + "default": 0, + "count": 128, + "doc": "Degrade: a tail grows dirtier as it fades; 0 a clean fade.", + "labels": null + } + ], + "compatibility": { + "firmware": "1.40C", + "effectId": 10, + "location": "FX2", + "conflicts": [], + "uiClaims": [], + "limitations": [ + "FX2 only: the capture ring needs an FX2 slot's buffer (15,870 words). On FX1 it passes the track dry.", + "Mono capture: the loops replay the track's mono sum; WIDE spreads LAYER's and SLIDE's extra loops left and right.", + "Loops follow the project's tempo, not yet the pattern's steps, track speed or swing; the owner agreed on issue #2491 that free-running tempo slices are fine until the base has a step clock for effects.", + "After a second of silent input no loop starts; after four seconds any loop or tail stops. The watch listens to the mono sum the ring records, so a source exactly out of phase between L and R counts as silence.", + "It prefers effect id 10, as Fuzzbox, Glitchbox and Midiverb do: over USB the base gives each its own id; in a card set only one of them fits.", + "Its worst case is 1.15x stock SPRING REV (three read heads, each with its own fade); four a core fit within a core's budget." + ] + }, + "resources": { + "recorded": "2026-12-05", + "storage": { + "label": "DSP program / state", + "display": "1854 words / 123-word state", + "value": null, + "unit": "see display", + "method": "static", + "conditions": "The USB package 5d3bf7c3 (ABI 6): 1,854 program words on each DSP core it runs on; 123 words of state per instance in its own r7 block (init clears them); 15,870 words of the FX2 slot's 16K Y delay buffer per instance, stopping short of Sidechain Compressor's key window; 1,196 bytes of ColdFire code and data (the effect's descriptor and menu), no bss.", + "source": "TESTING.md" + }, + "processing": { + "label": "DSP instruction peak", + "display": "360 instructions/sample per instance", + "value": null, + "unit": "see display", + "method": "emulator", + "conditions": "perf:audit record (perf.py in dsp_host): worst 360.1 executed instructions a sample, the dearest SLIDE setting with a trig split of 2 frames; unsplit 325.0 to 334.4; static loop 332. Against SPRING REV 314.19 (1.15x) and 330.94 for the dearest stock effect. Executed instructions, not chip cycles. On the unit the DSP load of T1-T4 rose 10.8 to 12.7 points with it on T1 FX2.", + "source": "evidence/performance.json" + }, + "impact": { + "conditions": "One instance at the dearest setting in dsp_host; on the author's MKII (twin 117eb07f of base ddb56b72) the frame-interrupt price on the test bank (Mang112 95 bank A, Part 1, pattern A01), and six instances admitted at once while playing (device:test).", + "cpu": { + "level": "minimal", + "basis": "measured-comparison", + "rationale": "No ColdFire work besides the effect's descriptor: the ColdFire only forwards the knob words, as for any effect. On the unit the frame interrupt rose 0 points with it on T1 FX2 and 0 installed and unused; the instance curve on the test pattern, noisy there, read first 0 and each 0, admitted on the empty and the medium pattern.", + "source": "evidence/cpu-price.json" + }, + "dsp": { + "level": "high", + "basis": "measured-comparison", + "rationale": "360.1 executed instructions a sample worst case (1.15 of SPRING REV's 314.19, 1.09 of DJ EQ's 330.94): a ring write and three read heads (head 0 also writing DUB's loop back), each with its own position, wrap, changeover, interpolated read, fade and gliding gain, then the heads' sum and side, crush, hold and drive, the loop's level, the dry's duck and two outputs, every sample. Four a core is 1,452 of 3,120. On the unit one instance raised its core's load about 11 to 13 points; six were admitted at once.", + "source": "evidence/performance.json" + }, + "memory": { + "level": "low", + "basis": "source-estimate", + "rationale": "Per instance 369 bytes of state and the FX2 slot's own delay buffer (15,870 words, which every stock reverb or delay on that slot would also take); 7,304 bytes shared.", + "source": "TESTING.md" + } + }, + "cpuPrice": { + "value": 0, + "unit": "percent-of-frame", + "measure": "frame-interrupt", + "tool": "npm run device:price -- --write", + "date": "2026-12-05", + "conditions": "the bank, pattern and Part the unit was on, transport stopped (test:procedure); base development twin 117eb07f of base ddb56b72, MKII, OS 1.40C; 3 readings of 8 s a state. Frame interrupt 54.1 % before, 54.1 % installed and used nowhere, 53.1 % on T1 FX2; CPU meter 71.6 % before, 71.4 % at rest, 70.5 % in use.", + "source": "evidence/cpu-price.json" + } + }, + "tests": { + "report": "TESTING.md", + "summary": "On the author's MKII (OS 1.40C, twin 117eb07f of base ddb56b72): npm run test:procedure on package 5d3bf7c3 (DUB in place of SHUFL) passed steps 1-11 (beside every other module, both cores, six instances admitted at once, Part switches, a 120 s soak, the price and the curve played; by hand DUB and a TYPE change mid-loop); the author kept 5d3bf7c3 beside 20 modules, played, saved and reloaded the Part and power-cycled: \"everything survived\". verify.py is bit-exact against reference.py in dsp_host for every TYPE and VAR, including DUB's write back; perf:audit worst 360.1 instructions a sample.", + "hardwareStatus": "reported", + "evidenceRevision": "a383d6d00ac6734aae6b07cac3b4bda1bd5f44ca", + "gates": [ + "Worst-case cycles under parameter modulation and maximum load", + "Exact memory region and maximum-instance totals", + "Owner-reviewed real-hardware evidence with actual coverage and limitations" + ], + "qualification": { + "documentation": { + "tutorial": { + "title": "Quick tutorial", + "steps": [ + "Put Loopbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to LOOPBOX at the end of the list and press YES. At the defaults it is LAYER A at 1/16, looping about half the slices.", + "Turn ACT and MIX to 127 to hear only the loops, then hold FUNC and press FX2 and step TYPE through LAYER, DUB and SLIDE, and VAR through A to D.", + "Set TIME to 1/4 and RPT to 1 for longer phrases, raise TAIL to let each loop ring on, and WIDE to spread LAYER's and SLIDE's loops left and right.", + "Turn MIX back to 64 to blend the loops with the track again, or to 0 to hear the track alone." + ] + }, + "screenshots": [ + "media/ot-location.png", + "media/ot-controls.png" + ], + "screenshotStyle": "black-and-white" + }, + "moduleVersion": "0.1.1-experimental", + "sourceSha256": "eacda55bb3aed90f0dade4d5c15fec03fb63adf85a727be81d6a9b43144d80bb", + "imageSha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372", + "cycles": [ + { + "processor": "dsp", + "worstCase": 363, + "maxConfiguration": 1452, + "maxInstances": 8, + "budget": 3120, + "unit": "cycles/sample", + "method": "emulator", + "conditions": { + "parameterExtremes": "363 cycles a sample covers the measured worst case in dsp_host, 360.1 executed instructions at the dearest SLIDE setting with a trig split of 2 frames (the per-call setup runs twice a block), over the defaults, the dearest setting for each TYPE (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND and DGRD at 127, RPT 8, VAR D) and the moving pattern, unsplit and with a split at every position 1-15 (perf.py, 80 cases). The static floor of the loop alone is 332. Executed instructions, not chip cycles.", + "parameterModulation": "Knob words reach the DSP as value<<16 every call; MIX glides per sample, the rest are read once a call, so modulation costs nothing extra. perf.py's stress run changes every parameter word every block (every slot swept, TIME, RPT, TYPE and VAR stepped): 0 clobbers, 0 hangs. verify.py renders a knob word with an LFO's fraction bits and every knob swept while looping bit for bit. The unit's soak sent program changes, transport, scenes, the crossfader and FX knob CCs.", + "modeSwitching": "TYPE and VAR are read once a call and take effect at the next chunk; their cost is inside the measured per-call setup. verify.py sweeps both while looping bit for bit; perf.py's moving case steps them; on the unit Part switches ran their own effects and the soak changed programs while it ran. There is no bypass: MIX 0 leaves the track within 1 LSB.", + "maxLoad": "4 instances a core, 8 on both: 4 x 363 = 1,452 of the 3,120 cycles a core can spend a sample. Stress in dsp_host: 4 a core, per-core peaks 1439.5 and 1355.1. On the unit six were admitted at once while playing; the base refused two to keep each core within budget.", + "inputConditions": "perf.py: stereo noise at 0.7 of full scale; the stress stems are decaying bursts, a full-scale square, a 20 Hz-20 kHz sweep, full-scale noise, impulses, full-scale DC steps, silence and a chord. The sample loop has no data-dependent branch, so the input changes no cost; verify.py checks exact silence out for silence in, a burst's tail ending in silence, and every TYPE and VAR falling silent 4.2 s after the input stops." + }, + "report": "evidence/performance.json" + } + ], + "memory": { + "regions": [ + { + "name": "DSP program, the package's effect on each core it runs on", + "space": "dsp-p", + "words": 1854, + "wordBits": 24, + "bytes": 5562, + "scope": "shared" + }, + { + "name": "DSP state per instance, the package's state words", + "space": "dsp-x", + "words": 123, + "wordBits": 24, + "bytes": 369, + "scope": "instance" + }, + { + "name": "ColdFire code and data of the USB package", + "space": "cpu-ram", + "words": 1196, + "wordBits": 8, + "bytes": 1196, + "scope": "shared" + }, + { + "name": "FX2 slot delay buffer, the stock allocator's 16K Y block reused as the capture ring", + "space": "dsp-y", + "words": 15870, + "wordBits": 24, + "bytes": 47610, + "scope": "instance" + } + ], + "perInstanceBytes": 47979, + "sharedBytes": 6758, + "maxInstances": 8, + "totalBytes": 390590, + "conditions": "From the header of the USB package 5d3bf7c3 (ABI 6), checked against the source: the effect uses its own r7 block X:(r7+$00..$7a) (verify.py's state gate) and the first 15,870 words of the FX2 slot's 16K Y delay buffer, which the stock allocator hands every FX2 instance (modulus $3dfd, stopping short of Sidechain Compressor's key window at +$3DFE; Claims(stock_instance_buffer=True, buffer_words=15870)); on an FX1-sized slot it passes the track dry and writes nothing. No other stock tables or blocks, no absolute addresses; the stack holds only the bsr return of its per-call routines.", + "report": "TESTING.md" + }, + "hardware": { + "kind": "functional", + "status": "reported", + "model": "MKII", + "testedOn": "2026-12-05", + "tester": "jrs1717", + "sourceRevision": "a383d6d00ac6734aae6b07cac3b4bda1bd5f44ca", + "imageSha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372", + "summary": "On the author's Octatrack MKII, OS 1.40C, 5 December 2026 (UTC): npm run test:procedure on package 5d3bf7c3 (0.1.1-experimental with DUB in place of SHUFL), on development twin 117eb07f of base ddb56b72 with the test bank, passed software checks, the check beside every other module, the DSP cost model, reading the unit, the scripted pass (self-test, both DSP cores, six instances at once with two refused for budget, Part switches), a 120 s soak with MIDI programs and AUTO changes, the price (the curve played, admitted on the empty and the medium pattern, longest frame 92.4 %) and putting the Part back; by hand, on T1 and T5 FX2 while playing, TYPE stepped through LAYER, DUB and SLIDE, DUB with ACT, MIX and TAIL at 127, DUB VAR D, and TYPE changed mid-loop, with no stall, error or crash. The author heard DUB on the same package in two RAM trials (\"sounds great\"), then kept it in place of 4dc3d0cc on the flashed base beside 20 modules, played it, saved and reloaded the Part and power-cycled: \"everything survived\".", + "limitations": [ + "Not run: an emulator rehearsal.", + "Not recorded: MAIN and CUE over USB (the recorder is not built on the author's computer); dropouts were checked by frame timing (late entries, skipped frames, stalls) and by the author's ear.", + "Not run on the unit: TIME 1/2 below 42 BPM (the 32-chunk path); verify.py holds it bit for bit at 30 BPM in dsp_host, for LAYER and DUB.", + "Not tested: MIDI, scenes and recording with it, beyond the soak's program changes, scenes and crossfader.", + "Not tested beside Sidechain Compressor on the unit; the ring stops short of its key window by design.", + "The screens were captured on package 4dc3d0cc; the controls and their names are the same, but TYPE's middle value is now DUB (it was SHUFL)." + ], + "report": "TESTING.md" + } + } + }, + "license": { + "spdx": "MIT", + "file": "LICENSE", + "declaration": "Original code by jrs1717 under the MIT licence in LICENSE: an original design inspired by micro-loop effects in general, starting from the author's own Glitchbox engine; no third-party code, tables, samples or names. Never includes Elektron firmware, extracted routines or tables." + }, + "media": [ + { + "path": "media/ot-location.png", + "captureType": "hardware", + "caption": "Hold FUNC and press FX2: Loopbox is chosen at the end of the effect list, with TYPE (here SLIDE), DIRT and VAR on the top row and WIDE, RAND and DGRD below.", + "alt": "FX2 SETUP page with an effect list ending in Loopbox, selected; knobs labelled SLIDE, DIRT, VAR, WIDE, RAND and DGRD.", + "credit": "jrs1717 (USB screen capture on the author's unit)", + "license": "LicenseRef-OT-UI-Documentation", + "source": "original", + "otUi": { + "page": "FX2 SETUP", + "shows": "location", + "firmware": "1.40C", + "moduleVersion": "0.1.1-experimental", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Loopbox 0.1.1-experimental (package 4dc3d0cc) kept beside 26 modules; the author's project, pattern A01, a track's FX2 on Loopbox with TYPE SLIDE and the other knobs as the author set them; transport stopped. The author pressed the keys; the agent read each frame over USB. imageSha256 is the MAIN image of base 0.8.5 ddb56b72, as recorded for Fuzzbox's and Glitchbox's captures on the same base." + } + }, + { + "path": "media/ot-controls.png", + "captureType": "hardware", + "caption": "Press FX2 for the main page: TIME, ACT and SHAP on top, RPT, MIX and TAIL below.", + "alt": "FX2 main page titled Loopbox with knobs TIME, ACT, SHAP, RPT, MIX and TAIL.", + "credit": "jrs1717 (USB screen capture on the author's unit)", + "license": "LicenseRef-OT-UI-Documentation", + "source": "original", + "otUi": { + "page": "FX2", + "shows": "controls", + "firmware": "1.40C", + "moduleVersion": "0.1.1-experimental", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Loopbox 0.1.1-experimental (package 4dc3d0cc) kept beside 26 modules; the author's project, pattern A01, a track's FX2 on Loopbox with TYPE SLIDE and the other knobs as the author set them; transport stopped. The author pressed the keys; the agent read each frame over USB. imageSha256 is the MAIN image of base 0.8.5 ddb56b72, as recorded for Fuzzbox's and Glitchbox's captures on the same base." + } + } + ] + }, { "schemaVersion": 2, "id": "analog-bassdrum", diff --git a/src/community/module-changelogs/loopbox.json b/src/community/module-changelogs/loopbox.json new file mode 100644 index 0000000000..c684132128 --- /dev/null +++ b/src/community/module-changelogs/loopbox.json @@ -0,0 +1,13 @@ +[ + { + "version": "0.1.1-experimental", + "date": "2026-12-03", + "changes": [ + "New: Loopbox, an automatic micro-looper for FX2 of any track, at the project tempo.", + "Three types on the setup page: LAYER stacks loops at different speeds, DUB records the track into the loop as it plays (sound-on-sound), SLIDE glides two loops in pitch.", + "TIME sets the grid from 1/64 to 1/2; ACT how often a slice loops; RPT how many times a loop cycles.", + "Loops change over head by head, so old and new overlap without a gap; TAIL lets them ring on.", + "DIRT, WIDE (stereo spread), RAND and DGRD on the setup page add grit, width, chaos and rotting tails." + ] + } +] diff --git a/src/engine/assets/descriptor-recipes.json b/src/engine/assets/descriptor-recipes.json index 012ea09a5b..aa4aa93f1c 100644 --- a/src/engine/assets/descriptor-recipes.json +++ b/src/engine/assets/descriptor-recipes.json @@ -6212,6 +6212,466 @@ "value": "DGRD" } ] + }, + { + "id": "loopbox", + "key": "LOOPBOX", + "author": "jrs1717", + "fxId": 10, + "donorAddress": 1074616560, + "donorSha256": "3b3f9b15f2f6addfea9fc281f5b9fdf054bf305778059b8d43db41d390f0401f", + "fx2Slot": 1074618372, + "slotSha256": "79bc740214b4d029e385d06d21e224d04e8f91b53fb26ea08ffa4e5d70964b7a", + "sourceSha256": "2ca5087d8ccf38eafe15c361f9439102c23aa3017a48a322a95727af03d7c3d4", + "integers": [ + { + "offset": 3, + "width": 1, + "value": 10 + }, + { + "offset": 94, + "width": 1, + "value": 2 + }, + { + "offset": 95, + "width": 1, + "value": 64 + }, + { + "offset": 96, + "width": 1, + "value": 32 + }, + { + "offset": 97, + "width": 1, + "value": 1 + }, + { + "offset": 98, + "width": 1, + "value": 64 + }, + { + "offset": 99, + "width": 1, + "value": 64 + }, + { + "offset": 100, + "width": 1, + "value": 0 + }, + { + "offset": 101, + "width": 1, + "value": 0 + }, + { + "offset": 102, + "width": 1, + "value": 0 + }, + { + "offset": 103, + "width": 1, + "value": 0 + }, + { + "offset": 104, + "width": 1, + "value": 0 + }, + { + "offset": 105, + "width": 1, + "value": 0 + }, + { + "offset": 202, + "width": 4, + "value": 0 + }, + { + "offset": 250, + "width": 4, + "value": 0 + }, + { + "offset": 206, + "width": 4, + "value": 0 + }, + { + "offset": 254, + "width": 4, + "value": 0 + }, + { + "offset": 210, + "width": 4, + "value": 0 + }, + { + "offset": 258, + "width": 4, + "value": 0 + }, + { + "offset": 214, + "width": 4, + "value": 0 + }, + { + "offset": 262, + "width": 4, + "value": 0 + }, + { + "offset": 218, + "width": 4, + "value": 0 + }, + { + "offset": 266, + "width": 4, + "value": 0 + }, + { + "offset": 222, + "width": 4, + "value": 0 + }, + { + "offset": 270, + "width": 4, + "value": 0 + }, + { + "offset": 226, + "width": 4, + "value": 0 + }, + { + "offset": 274, + "width": 4, + "value": 0 + }, + { + "offset": 230, + "width": 4, + "value": 0 + }, + { + "offset": 278, + "width": 4, + "value": 0 + }, + { + "offset": 234, + "width": 4, + "value": 0 + }, + { + "offset": 282, + "width": 4, + "value": 0 + }, + { + "offset": 238, + "width": 4, + "value": 0 + }, + { + "offset": 286, + "width": 4, + "value": 0 + }, + { + "offset": 242, + "width": 4, + "value": 0 + }, + { + "offset": 290, + "width": 4, + "value": 0 + }, + { + "offset": 246, + "width": 4, + "value": 0 + }, + { + "offset": 294, + "width": 4, + "value": 0 + }, + { + "offset": 202, + "width": 4, + "value": 1073989400 + }, + { + "offset": 250, + "width": 4, + "value": 0 + }, + { + "offset": 298, + "width": 4, + "value": 0 + }, + { + "offset": 214, + "width": 4, + "value": 1073989400 + }, + { + "offset": 262, + "width": 4, + "value": 0 + }, + { + "offset": 310, + "width": 4, + "value": 0 + }, + { + "offset": 226, + "width": 4, + "value": 1073989400 + }, + { + "offset": 274, + "width": 4, + "value": 1074033236 + }, + { + "offset": 322, + "width": 4, + "value": 0 + }, + { + "offset": 234, + "width": 4, + "value": 1073989400 + }, + { + "offset": 282, + "width": 4, + "value": 1074033236 + }, + { + "offset": 330, + "width": 4, + "value": 0 + }, + { + "offset": 154, + "width": 4, + "value": 6 + }, + { + "offset": 106, + "width": 4, + "value": 0 + }, + { + "offset": 158, + "width": 4, + "value": 128 + }, + { + "offset": 110, + "width": 4, + "value": 0 + }, + { + "offset": 162, + "width": 4, + "value": 128 + }, + { + "offset": 114, + "width": 4, + "value": 0 + }, + { + "offset": 166, + "width": 4, + "value": 8 + }, + { + "offset": 118, + "width": 4, + "value": 0 + }, + { + "offset": 170, + "width": 4, + "value": 128 + }, + { + "offset": 122, + "width": 4, + "value": 0 + }, + { + "offset": 174, + "width": 4, + "value": 128 + }, + { + "offset": 126, + "width": 4, + "value": 0 + }, + { + "offset": 178, + "width": 4, + "value": 3 + }, + { + "offset": 130, + "width": 4, + "value": 0 + }, + { + "offset": 182, + "width": 4, + "value": 128 + }, + { + "offset": 134, + "width": 4, + "value": 0 + }, + { + "offset": 186, + "width": 4, + "value": 4 + }, + { + "offset": 138, + "width": 4, + "value": 0 + }, + { + "offset": 190, + "width": 4, + "value": 128 + }, + { + "offset": 142, + "width": 4, + "value": 0 + }, + { + "offset": 194, + "width": 4, + "value": 128 + }, + { + "offset": 146, + "width": 4, + "value": 0 + }, + { + "offset": 198, + "width": 4, + "value": 128 + }, + { + "offset": 150, + "width": 4, + "value": 0 + }, + { + "offset": 398, + "width": 4, + "value": 286331153 + }, + { + "offset": 394, + "width": 4, + "value": 4369 + } + ], + "strings": [ + { + "offset": 4, + "width": 5, + "value": "LOOP" + }, + { + "offset": 9, + "width": 13, + "value": "LOOPBOX" + }, + { + "offset": 22, + "width": 6, + "value": "TIME" + }, + { + "offset": 28, + "width": 6, + "value": "ACT" + }, + { + "offset": 34, + "width": 6, + "value": "SHAP" + }, + { + "offset": 40, + "width": 6, + "value": "RPT" + }, + { + "offset": 46, + "width": 6, + "value": "MIX" + }, + { + "offset": 52, + "width": 6, + "value": "TAIL" + }, + { + "offset": 58, + "width": 6, + "value": "TYPE" + }, + { + "offset": 64, + "width": 6, + "value": "DIRT" + }, + { + "offset": 70, + "width": 6, + "value": "VAR" + }, + { + "offset": 76, + "width": 6, + "value": "WIDE" + }, + { + "offset": 82, + "width": 6, + "value": "RAND" + }, + { + "offset": 88, + "width": 6, + "value": "DGRD" + } + ] } ] } diff --git a/src/engine/assets/dsp-packages.json b/src/engine/assets/dsp-packages.json index 3f55ad2da2..1617027eda 100644 --- a/src/engine/assets/dsp-packages.json +++ b/src/engine/assets/dsp-packages.json @@ -320,6 +320,45 @@ } ] }, + { + "id": "loopbox", + "version": "0.1.1-experimental", + "key": "LOOPBOX", + "author": "jrs1717", + "sources": { + "modules/loopbox/engine.asm": "f88df875944ea88dd05804dbe463a9008fd7bb9f3f17744e9a84e79eb9a75f34", + "modules/loopbox/manifest.py": "2ca5087d8ccf38eafe15c361f9439102c23aa3017a48a322a95727af03d7c3d4" + }, + "fxId": 10, + "words": 1854, + "code": "20001322f50005f425ffffff067b80000006565d0000000064f00000021305f424ffffff00000044e400020784022fc40a77840000780a778400007a024784208e0044f40000400020004420001b44f4000000012000030230480207cf44f400000001020fc444f4001234560217c444f40008000002978444f4001000000297c444f400400000029f8444f400600000029fc444f40040000002df8444f40010000002dfc444f4002ff22202e78444f40017f91102e7c444f400e0000002ef8444f40010000002efc444f400ffffff02578444f40058b90c02a78444f4002c5c8602a7c444f4002c5c8602af8444f400464faa02afc444f400ffffff0a778400005844f400fff0000a778400005944f400ffc0000a778400005a44f400ff80000a778400005b44f400ff00000a778400005c44f400fe00000a778400005d44f400fc00000a778400005e44f400f800000a778400005f00000c0207de2000030d104a00041b05f424ffffff05f425ffffff02069e0140c67f00000c1c2044f400000005200045027040028f8c0206de0140c67fffff21840047f4005a00002000c0027fce020e9e0140c67fffff21840047f4003e00002000c821a40057f40002000020004821a40002cfc4020ede0140c67f00000c1c2044f4000000072000450270400140c00000010287cc0216de0140c67fffff21850056f4007fffff20006421c4002087002000c021c7002000c021c40047f4000064ea2000c046f4000001b620005002cf8e02169e0140c67fffff218400208e0046f4007f000020005547f4007fffff021070026f8c02369e0140c67f00000c1c2044f4000000022000450270400277cc0236de0140c67f00000c1c2044f400000003200045027040027f8c02369e0140c600ff000c1d100a778c0000510236de0140c600ff000c1d100a778c00004e023e9e0140c67f00000a778c00004f023e9e0140c600ff000c1d100a778c000050024edf0c1c9121a400208f0044f4000002d020004d44f400000b4002904844f400001c2020004d027048028fcd028f9f56f40000000050f400791fd044f40000000120004d0d104900002a56f40000000050f400f23fa044f40000000220004d0d104900002156f40000000150f400e47f4044f40000000320004d0d104900001856f40000000350f400c8fe8044f40000000420004d0d104900000f56f40000000750f40091fd0044f40000000520004d0d104900000656f40000000f50f40023fa00028fd40d1080000609208f0045f40000000144f400001edc20004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850002278d0a778500004002b79e2000030d104200000c026f94026fc444f4007fffff0277840227940267c444f40000000102b784026f9e026fd420004420002644f400000040200045026fdf026f96029058026fcd02679e2000030d104a00004f0257de44f4000020002000450d10410000060d10800005920d10c0000045020fde2000030d104a00004120001b02479e0d108000058e44f4000000202000450d104700000457f4000000010a77ce00006b2000030d104a00000c022fde0d108000057f44f4000000202000450d104700000457f4000000010a77ce0000642000030d104a00000d0a77ce0000780d108000056f44f4000000202000450d104700000457f4000000010a77ce0000692000030d104a00000d0a77ce00007a0d108000055f44f4000000202000450d104700000457f40000000120000b0d104a000004200013020fce020fde2000030d104200000f021f9e2000030d104200000b02679e2000030d104200000744f400000001020fc420001302178e0a77ce00005344f40002b1102000450d104900000a0d108000053320001b021f8f02178f44f400000001020fc4021fde0267d42000450d10490000040d10800002a00d10800004e9022fd402479e2000450d104a00001b208e000d108000052244f4000004402000450d104700000520001b0a778f000055021f9f20000b0d104a00000c44f4000000402000450d1047000007024794022fc420001b0237cf023f8f0a77ce0000550a77c400006b2000440c1c062000400a778c00006b0a77c400007802479e2000450d104a00001e208e000d10800004fa44f4000004402000450d104700000520001b0a778f000056021f9f20000b0d104a00000f44f4000000402000450d104700000a0247940a778400007820001b0a778f0000600a778f0000610a77ce0000560a77c40000642000440c1c062000400a778c0000640a77c400007a02479e2000450d104a00001e208e000d10800004cf44f4000004402000450d104700000520001b0a778f000057021f9f20000b0d104a00000f44f4000000402000450d104700000a0247940a778400007a20001b0a778f0000650a778f0000660a77ce0000570a77c40000692000440c1c062000400a778c0000690277de44f4000000012000450d104200000720001302f78e02f7ce0d10c000000d0a77c700004e0a77c40000642000c002f78e0a77c40000692000c020003602f7ce23ee000c1d242186000a77c400006320c7002000c00c1d0221c4000a77c70000622000c00a77c40000622000400a778c0000620a77c400006820c7002000c00c1d0221c4000a77c70000672000c00a77c40000672000400a778c000067021f9f44f4007fffff20001320000b02204002ffcc200013024f8e02d7ce021f9e2000030d104a0000240277de44f4000000012000450d104200001e027f9f44f40040000046f40000000120005d0d104900001244f40026666646f40000000220005d0d104900000b44f40013333346f40000000320005d0d104900000444f40007ae1402d7c4208e00200036024f8e0a77ce00005102679f20000b0d104a00000b0257d457f4007fffff20004c21e4000a77c70000502000c820001021c400208e000c1c280140c000005821990022f10005f421ffffff00000046e90002579e2000560a778c000046208e000c1c260140c00000010a778c00004747f4006000002000c00140c02000000a778e00004a208e000c1c0221860057f4007fffff20005c0a778f00004b02079e020f9420004021940005f424003dfd0a77dc00000305f425003dfd70f40000000106df00000467026f9e026fd42000440c1c0c200040026fcc026fd447f4002aaaab2000c02000400a778e00004356f4007fffff2000440c1d040a778e00004445e00046e80002bf8502bfc620ae002000500c1c045e640002ff8e204c0021c400208e002000260a77cf00005420000d0290080a778d0000540237de023f98023fdf0c1cab2000100247d420001b20004502104820001421e50020001b200045021000200003029048200010200068022fdf024797022078022fcd21b5000237cc023f88219d00210f0020002b21a600208f0020001c200005027000218400024fd72000c00c1d2c21c500204d005edd0021c400024f972000092000ca02ff9402d7d72000ca2055005f5d005fe50020001c21e40020c7002000c221870020a4002000c00a778e0000550a77ce0000600a77c80000610a77cf0000620c1cab2000100247d420001b20004502104820001421e50020001b2000450210002000030290482000102000680a77cf0000780247970220780a778d00007821b5000a778c0000600a7788000061219d00210f0020002b21a600208f0020001c200005027000218400024fd72000c00c1d2c21c500204d005edd005fe50020001c21e40020c7002000c221870020a4002000c00a778e0000560a77ce0000650a77c80000660a77cf0000670c1cab2000100247d420001b20004502104820001421e50020001b2000450210002000030290482000102000680a77cf00007a0247970220780a778d00007a21b5000a778c0000650a7788000066219d00210f0020002b21a600208f0020001c200005027000218400024fd72000c00c1d2c21c500204d005edd005fe50020001c21e40020c7002000c221870020a4002000c00a778e0000570a77c40000550a77c700006b2000c00a77c40000560a77c70000642000c20a77c40000570a77c70000692000c20a77c400004620004602c78c0a77c400005602f7972000c00a77c400005702f7d72000c20a778e0000770a77ce0000480140c40000010a77cf00004902c7950a77c400004702f06802f0400a778c0000480a778f0000490257d620c70002ffd42000c021c4000a77c70000432000c021c40056f4007fffff2000440a77c400004420004502704002778e0a77ce0000490c1d0221c4000a77c700004a2000c00c1d0421c4000a77c700004b2000c021c40020c7002000c021c4000a77c70000432000c021c5000a77c400007720c7002000c021c4000a77c70000432000c00c1d020a778e00007702879e20005421c400025fd72000c02000500257cc20a4000a77c700004c2000c002bf940277972000c20a77c400007720004056580020a4000a77c700004d2000c002bfd40277972000c20a77c4000077200044565800000000228e00020794200044020f8c23e400021fde200040021fcc0a77cf00005320004845f40010000020006d0270680a77ce00005447f40000004020007546f4000000000210580a778d0000532000130a778e000054020fdf20000b0d104a00000902179e20004046f400003dee20005502705002178c05f424ffffff05f425ffffff00000c021fde0267d420004420004546f400000000021050021fcc021f9e2000030d104a0000310227de0140c40000010227cc2000030d104a000009022f9e0140c0000001022f8c0d10800001a800000c0d10800001980a77ce0000420140c40000010a778c0000422000030d1047000043200013021f8e02878e0a778e0000630a778e000068020fdf20000b0d104200000644f400000001020fc402178e44f40000000102678402cf94025fc40d10c00000040d10800001770227940267c40a77ce0000412000030d104200016f0a77ce00005346f40000ac442000550d104100016802179e2000450d10490001640d1080000248027fde2000450d104f00015e020fde2000030d104200000b0d108000022d20001302178e44f400000001020fc40d10c00001510a77c40000400a77840000420287d40a77840000450a77ce00004f2000030d104a0000120d10800002290a77ce00004f2000450d104f00000b0d108000022247f4000000082000c00140c00000010a778c000045021f9e0267942000400a778c00005220001b0a778f00007944f4000000010277de2000450d1042000008021f9e2000030d104a0000040a7784000079021f84020fc40277de2000450d1042000003020fcf200013022f8e02678e44f4007fffff02878444f400009445025fc402279e02d78c0c1c2e0a77c40000450d10800001fc025f840a778400006d0a77ce0000792000030d1042000015020f9e20004446f40000000045f400003dfe20000320af000210582000100a778c00006e02079520006002478c208e000140c40000010247cc44f4000000010a778400006c2000130a778e0000630a778e00006844f400200000023fc40a77840000620a77840000670277de2000030d104a00000c44f4000000022000450d104a00003a0247d40d108000014f0d10c0000073027f9e44f4000000032000450d104a0000120c1d0221990005f421ffffff041f6100000044e9000a7784000062041f7100000044e9000a77840000670d10c000000a0d10800001100a77840000620d108000010c0a77840000670a77ce00004f2000030d104a00000d0d10800001920a77ce00004f2000450d104f0000060d10800000fc0a77840000620247d40d108000011c0d10c000004044f40000000245f400000001027f9e2000030d10420000052085000d10c000001246f4000000012000550d104200000520a4000d10c000000a46f4000000032000550d10420000050d10800000e42085000a77840000550a77850000560a77ce00004f2000030d104a00000d0d108000015e0a77ce00004f2000450d104f0000060d10800000d10a77840000550a77c40000550d10800000d20a77840000630a77c40000560d10800000cc0a77840000680247d40d10800000dc0a77ce0000522000030d1042000043024794022fc4200013023f8e021fde023fdf20000b0d10430000070247de0140c4000001021fd42000440237cc0247940a77840000782000130a778e000061021fde0a77cf00006220000b0d10430000070247de0140c4000001021fd42000440a778c0000600247940a778400007a2000130a778e000066021fde0a77cf00006720000b0d10430000070247de0140c4000001021fd42000440a778c0000650277de44f4000000022000450d10420000080247de0c1c02021fd42000400a778c0000650a77ce0000522000030d10420000100d10800000ad0a77c40000550a778400006b0a77c40000560a77840000640a77c40000570a77840000690a77c40000450227c40d108000001000000c0a77ce0000410140c00000010a77c400004020004546f4000000000210500a778c00004100000c0277de44f4000000012000450d104a00000b025f940267c40d10800000ac2000130a778e0000520d10c0000029025f940267c40d10800000a30a77ce00004e022f9f0140ce00000120000b0d104a0000032000360a778e0000520a77cf00004f20000b0d104a0000150d10800000b50a77ce00004f2000450d104f00000e0d10800000ae208e000140c44000000c1d0221c4000a77c700004e2000c00a778e0000520a77c400005246f4007fffff56f4007fffff2000442000550210500a778e00004d57f4007fffff20004820005d0210580a778f00004c00000c0d108000000920990004174105f421ffffff00000044e90000000c0d108000008647f4000000042000c021840000000c20990020850004178105f421ffffff00000056e9000c1c2402d7940d1080000082208e0020af0046f40000000220005d0d104100000320003621840000000c208e000140c000000121850021840002cfd72000c0218400208e0046f40000004020005502905020af000c1c8320000502700046f40000000520005502905021840056f40000000450f4000000000d108000005c024fc400000c0277de2000030d104200000d44f4004000000a778400005544f4002000000a77840000560a778400005700000c44f4000000022000450d104200000c20001b0a778f00005544f4004000000a77840000560a778400005700000c44f4007fffff0a778400005520001b0a778f0000560a778f00005700000c0227de44f4000000012000450d104200000e0a77ce0000450140c40000012184000267d72000c00c1c0221040002d79e2000440267cc00000c20001302678e0257ce02878e025fce00000c020794200044020f9420004444f400003dfe2000030d104100000320004000000c0217de2000230d104000000544f400e100002000430217cc0140c67fffff21840000000c00feb906188000073b01804021040000000c", + "sha256": "32eda7c07574f659f7f5257faf6e20d8355a39f99120ab5e1c358dcc17991b4d", + "relocations": [ + 5, + 795, + 1850 + ], + "init": 0, + "proc": 115, + "proofs": [ + { + "base": 4096, + "sha256": "c18ea7b47587da58634cf4cc00c2285126bfc3745f563198304eb0665dd6dfbf" + }, + { + "base": 5120, + "sha256": "f2925ef972ff8b99ffd55b73ba33c5db3d62b65a22f27ddcf3b30b045a65f2bf" + }, + { + "base": 6145, + "sha256": "1dbf776c1918fb15e62ffde5a1c3ad8c55e68b69184514c845642644fe7053d3" + }, + { + "base": 9223, + "sha256": "ed936b145ec19cb9c752af341f38344eac60239066471aa741d0250aac9f17df" + } + ] + }, { "id": "mackity", "version": "0.1.0-experimental", diff --git a/src/engine/assets/menu-recipes.json b/src/engine/assets/menu-recipes.json index c24eb9aa62..30b7f794e1 100644 --- a/src/engine/assets/menu-recipes.json +++ b/src/engine/assets/menu-recipes.json @@ -1329,6 +1329,129 @@ "sha256": "f5641d626d17265a6e715abe4ace7d36b315ebac3450d163cc34c8ca165702b5" } ] + }, + { + "id": "loopbox", + "key": "LOOPBOX", + "author": "jrs1717", + "slot": 0, + "name": "TIME", + "labels": [ + "1/64", + "1/32", + "1/16", + "1/8", + "1/4", + "1/2" + ], + "renames": {}, + "wideMaximum": 5, + "proofs": [ + { + "namesAddress": 1074621238, + "bytes": 80, + "sha256": "e74bd4dba1bc46e87f9156eb25524f81f13faadbd3166d997d5a4a865cbbd3ef" + }, + { + "namesAddress": 1074623350, + "bytes": 80, + "sha256": "e74bd4dba1bc46e87f9156eb25524f81f13faadbd3166d997d5a4a865cbbd3ef" + } + ] + }, + { + "id": "loopbox", + "key": "LOOPBOX", + "author": "jrs1717", + "slot": 3, + "name": "RPT", + "labels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ], + "renames": {}, + "wideMaximum": 7, + "proofs": [ + { + "namesAddress": 1074621238, + "bytes": 72, + "sha256": "ee7d5bc6b7657acddaea0d08c6bc71333a5382190caa5c35ade66947b1bf78a7" + }, + { + "namesAddress": 1074623350, + "bytes": 72, + "sha256": "ee7d5bc6b7657acddaea0d08c6bc71333a5382190caa5c35ade66947b1bf78a7" + } + ] + }, + { + "id": "loopbox", + "key": "LOOPBOX", + "author": "jrs1717", + "slot": 6, + "name": "TYPE", + "labels": [ + "LAYER", + "DUB", + "SLIDE" + ], + "renames": { + "0": { + "6": "LAYER" + }, + "1": { + "6": "DUB" + }, + "2": { + "6": "SLIDE" + } + }, + "wideMaximum": null, + "proofs": [ + { + "namesAddress": 1074621238, + "bytes": 166, + "sha256": "17dc25ac9ebeb75a16f0534020201013cb8481d7bfefbe09fc935e32f0237b4e" + }, + { + "namesAddress": 1074623350, + "bytes": 166, + "sha256": "25b80ffcbf4d8083b2c80e5c4e2f8880cce5b2963c6ccb94c55d0c644972cbce" + } + ] + }, + { + "id": "loopbox", + "key": "LOOPBOX", + "author": "jrs1717", + "slot": 8, + "name": "VAR", + "labels": [ + "A", + "B", + "C", + "D" + ], + "renames": {}, + "wideMaximum": null, + "proofs": [ + { + "namesAddress": 1074621238, + "bytes": 56, + "sha256": "f5641d626d17265a6e715abe4ace7d36b315ebac3450d163cc34c8ca165702b5" + }, + { + "namesAddress": 1074623350, + "bytes": 56, + "sha256": "f5641d626d17265a6e715abe4ace7d36b315ebac3450d163cc34c8ca165702b5" + } + ] } ], "repitchPatches": [ diff --git a/src/engine/assets/module-build.json b/src/engine/assets/module-build.json index 276a347e09..bb984d897d 100644 --- a/src/engine/assets/module-build.json +++ b/src/engine/assets/module-build.json @@ -1,10 +1,10 @@ { "schemaVersion": 1, "kind": "source-packages", - "sourceCommit": "4d4073fdbad7e4505fdb463f09e717a4c6dbd8bf", + "sourceCommit": "20d65473a19afa20ac4aa55a8265470e4f8556da", "nativeRevision": "b8deefc88b2c3e5f3c6158e364eb741df1924e1d", - "sourceTreeSha256": "28784f6974acdcf070f72ec69760b0c060384904f3f63c1d9866e386ad16df3f", - "compilerSha256": "766ea9cbc6be006bb0c3cd7402571901c01fabe24d3830385a94fbce703a570e", + "sourceTreeSha256": "02c86c031eb0dfb5e90dc869087b1815c31b42e778e4af48fcdeee98d7755949", + "compilerSha256": "76a7882f5a5e076128b6f677fc206d4ed72fc906f9f068b21839e8b95ee88a3c", "moduleVersions": { "miniverb": "0.2.3-experimental", "tapeecho": "0.1.9-experimental", @@ -24,6 +24,7 @@ "void": "0.1.1-experimental", "fuzzbox": "0.2.0-experimental", "glitchbox": "0.1.0-experimental", + "loopbox": "0.1.1-experimental", "analog-bassdrum": "0.1.7-experimental", "usb-audio-out-tracks-main-cue": "0.4.3-experimental", "quantizer": "0.1.5-experimental", @@ -56,8 +57,8 @@ }, "files": { "dsp-packages.json": { - "bytes": 124674, - "sha256": "cf91b4e8e376aa7103dd96dd5a1af7d72b4c7e33466d08215016e841ac3d3767" + "bytes": 136963, + "sha256": "14801aef9d70cb37a8f066fcaef761b016ba3e1d97b87319554f0ace9607ab65" }, "resident-dsp.json": { "bytes": 6981, @@ -76,12 +77,12 @@ "sha256": "f4b17e0eb4e297e6dbfc61781fe5aed41262c1e7263e42579184c7cc15fa843e" }, "menu-recipes.json": { - "bytes": 37502, - "sha256": "d90270e960e7ceb197e93d1ad58bfd705311c823a6e47df641b9c550a4be5a61" + "bytes": 40197, + "sha256": "59119cf6df843e19b66aa5e3b1c56a8ed821e02e7617c3e056f1d9dac9676f4a" }, "descriptor-recipes.json": { - "bytes": 116967, - "sha256": "1cb1864d95aff572b1627a7e3b28856a500626c26ed3240f4838b217ab134890" + "bytes": 125509, + "sha256": "497b86432e61727ff64335e80d5ac5dc2d12ca60a0adb947af813d6f816b7feb" }, "platform-writes.json": { "bytes": 15585, diff --git a/src/engine/assets/octatrack-module-packages.json b/src/engine/assets/octatrack-module-packages.json index b1411bc120..5629526195 100644 --- a/src/engine/assets/octatrack-module-packages.json +++ b/src/engine/assets/octatrack-module-packages.json @@ -953,6 +953,25 @@ "bytes": 6910, "sha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0" }, + { + "id": "loopbox", + "slots": "fx2", + "cycles": 363, + "cyclesKind": "executed", + "state": 123, + "buffer": 15870, + "version": "0.1.1-experimental", + "path": "octatrack-modules/loopbox/0.1.1-experimental.mwrm", + "abi": 6, + "features": 0, + "sites": 0, + "copies": 0, + "fills": 0, + "name": "Loopbox", + "module": "4fd229d0", + "bytes": 8702, + "sha256": "5d3bf7c3efc0fe1b537887f912a46536a80ad89df7caa37d5524b17098b8c372" + }, { "id": "arr-rows", "octabam": true,