diff --git a/public/module-sleeves/glitchbox.svg b/public/module-sleeves/glitchbox.svg new file mode 100644 index 0000000000..266488d366 --- /dev/null +++ b/public/module-sleeves/glitchbox.svg @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/octatrack-modules/glitchbox/0.1.0-experimental.mwrm b/public/octatrack-modules/glitchbox/0.1.0-experimental.mwrm new file mode 100644 index 0000000000..8fd4d0c4fa Binary files /dev/null and b/public/octatrack-modules/glitchbox/0.1.0-experimental.mwrm differ diff --git a/scripts/build-module-packages.py b/scripts/build-module-packages.py index bb6735f26b..104d034f96 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'] +ORDER = ['miniverb', 'tapeecho', 'euclid', 'repitch', 'tapehead', 'airwindows-chorus', 'everb', 'bbd', 'lofi2', 'ring-sc', 'vibrato', 'resonator', 'mackity', 'midiverb', 'ringbank', 'void', 'fuzzbox', 'glitchbox'] # 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'] @@ -627,6 +627,14 @@ def at(base): donorSha256='3b3f9b15f2f6addfea9fc281f5b9fdf054bf305778059b8d43db41d390f0401f', fx2Slot=0x400d6004, slotSha256='79bc740214b4d029e385d06d21e224d04e8f91b53fb26ea08ffa4e5d70964b7a')) + if not any(row['id'] == 'glitchbox' 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='glitchbox', key='GLITCHBOX', 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 976e47d16a..f2b21ae4ad 100644 --- a/sdk/catalog.json +++ b/sdk/catalog.json @@ -87,6 +87,11 @@ "version": "0.1.0-experimental", "addedAt": "2026-12-01T01:27:19Z" }, + { + "id": "glitchbox", + "version": "0.1.0-experimental", + "addedAt": "2026-12-02T05:02:06Z" + }, { "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 a8bef18869..35b4cb30be 100644 --- a/sdk/machines/octatrack/frame-costs.json +++ b/sdk/machines/octatrack/frame-costs.json @@ -9,6 +9,7 @@ "euclid": {"first":3.7,"each":2.5,"rest":2.5,"points":[3.7,3.9,6.4,6.7],"measured":"euclid 0.1.5-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)"}, "everb": {"first":0.7,"each":0.2,"rest":0,"points":[0.7,0.8,1,-0.6],"measured":"everb 0.1.2-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)"}, "fuzzbox": {"first":0.4,"each":0.4,"rest":0,"points":[0.2,-0.1,-0.6,0.4],"measured":"fuzzbox 0.1.0-experimental on T1 T3 T6 T7: Mang112 95 bank A, Part 1 (T1 and T2 FX2 on DELAY), stopped; picks on the empty A02, readings on A05 at the project tempo (trigs on steps 1/5/9/13 of T1-T4, T6, T7; every track a Static machine with its sample); base twin 117eb07f of ddb56b72 (no usb-input, no stream-channel); 8 s a reading; 2026-12-04 (evidence/frame-cost.json)"}, + "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"}, "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)"}, diff --git a/sdk/machines/octatrack/module-adapters/standalone-recipes.json b/sdk/machines/octatrack/module-adapters/standalone-recipes.json index 08b1083ed0..66412666d7 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": "85875515dae3217c17f24eb5a407091ac7eb51cc2828d048236aa3213d6be941", - "src/engine/assets/descriptor-recipes.json": "1229ed48a30d2b606533f81e69d03fd9c32e4758bc215101f798ecabedbbaf87", - "src/engine/assets/menu-recipes.json": "61507b281a85393e0351158328104d09777face828cd9980dd23682625e9e2d8", + "src/engine/assets/dsp-packages.json": "3f9ad5fb5b20ca6dddbaf9207fe55ba48de5b21b4df59c4a2e84140589c9e47d", + "src/engine/assets/descriptor-recipes.json": "661357e141783da67cee8e848c3cb413799a9c7c1ef7325872aee14d1433ef05", + "src/engine/assets/menu-recipes.json": "1b7eee1e48572e40a9329d8b611d24d6f76209346e20cab41f5a401ea92c3ae7", "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": "85875515dae3217c17f24eb5a407091ac7eb51cc2828d048236aa3213d6be941", - "src/engine/assets/descriptor-recipes.json": "1229ed48a30d2b606533f81e69d03fd9c32e4758bc215101f798ecabedbbaf87", - "src/engine/assets/menu-recipes.json": "61507b281a85393e0351158328104d09777face828cd9980dd23682625e9e2d8", + "src/engine/assets/dsp-packages.json": "3f9ad5fb5b20ca6dddbaf9207fe55ba48de5b21b4df59c4a2e84140589c9e47d", + "src/engine/assets/descriptor-recipes.json": "661357e141783da67cee8e848c3cb413799a9c7c1ef7325872aee14d1433ef05", + "src/engine/assets/menu-recipes.json": "1b7eee1e48572e40a9329d8b611d24d6f76209346e20cab41f5a401ea92c3ae7", "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/glitchbox/LICENSE b/sdk/octatrack/modules/glitchbox/LICENSE new file mode 100644 index 0000000000..250cae34a6 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/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/glitchbox/README.md b/sdk/octatrack/modules/glitchbox/README.md new file mode 100644 index 0000000000..4adfdd3df6 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/README.md @@ -0,0 +1,94 @@ +# Glitchbox + +Version 0.1.0-experimental · by @jrs1717 · the test procedure passed on the author's MKII on the shipped package (8d67a364, steps 1-11); the author kept it, listened and power-cycled: "Everything looks good". + +## Overview + +A glitch effect for FX2 of any track. Glitchbox keeps the last third of a second of what the track plays. At every slice, a note value at the project's tempo, ACT decides whether that slice glitches. A glitched slice is filled with RPT repeats taken from what was just played: + +- **CHOP** replays recent pieces in a new order. +- **STUT** ratchets the start of the slice before: each repeat half as long as the last, speeding up into a buzz. +- **ARPG** steps it through pitches: arpeggios or leaps over two octaves. + +Up to MIX 96 the track plays as it is between glitches, and while a glitch plays it ducks under each repeat as it swells and comes back in its fades: at 96 the repeat replaces the track at its peak. From 96 to 127 the track fades out everywhere, so 127 is the glitches alone. A tail echoes over the track. + +## Controls + +Main page (press FX2): + +| Knob | Name | Range | Default | What it does | +|---|---|---|---|---| +| A | TIME | 1/64, 1/32, 1/16, 1/8, 1/4, 1/2 | 1/16 | Slice length at the project's tempo: glitches start only on this grid, and a glitch lasts the whole slice. A slice longer than 179 ms plays as 2, 4, 8, 16 or 32 equal chunks, each with its own RPT repeats. | +| B | ACT | 0-127 | 64 | The share of slices that glitch, rising evenly from none at 0 to about 70 % at 127. | +| C | SHAP | 0-127 | 32 | Each repeat's fade in and out: 1/64 of it at 0, rising evenly to a quarter at 64 and a full swell at 127. | +| D | RPT | 1-8 | 4 | Repeats within a glitched slice (within each chunk of a long one). CHOP and ARPG cut it into equal repeats; STUT halves each repeat, a ratchet that speeds up. | +| E | MIX | 0-127 | 64 | How much a glitch takes over. Up to 96 the track plays dry between glitches and ducks under each repeat as it swells, coming back in its fades: 0 the track alone, 96 the repeat replaces it at its peak. From 96 to 127 the track fades out everywhere: 127 is the glitches alone, silent between them. | +| F | TAIL | 0-127 | 64 | After a glitch its last repeat keeps echoing and fades out: 0 none, about a third of a second at 64, about 3 s at 127. The next glitch cuts it. | + +Setup page (hold FUNC and press FX2): + +| Knob | Name | Values | What it does | +|---|---|---|---| +| A | TYPE | CHOP, STUT, ARPG | The kind of glitch. | +| B | DIRT | 0-127 | 0 | Grit on the glitch only: sample-rate reduction (down to 1/16), a harder bit crush and a clipping drive. 0 clean. | +| C | VAR | A, B, C, D | CHOP: plain, pitched (0.25, 0.5, 2 or 3x), reversed an octave down with fades twice as long, pitched and crushed to 7 bits. STUT: plain, gated to each repeat's first eighth, reversed, five semitones lower each repeat and crushed. ARPG: major arpeggio up, minor arpeggio down, leaps over two octaves, random major steps and crushed. | +| D | WIDE | 0-127 | 0 | Ping-pong: each repeat alternates left and right, as far as WIDE; with RAND, repeats land anywhere in that width. 0 centred. | +| E | RAND | 0-127 | 0 | Chaos: the chance that a glitch takes a random number of repeats, and that each repeat takes a random pitch, a reversal (half as often) and a random place. 0 as set. | +| F | DGRD | 0-127 | 0 | Degrade: a tail grows dirtier as it fades, adding up to this much DIRT by its end. 0 a clean fade. | + +Every knob can be parameter-locked and modulated by an LFO. A change takes effect at the next slice. + +## Usage + +1. Select an audio track with its TRACK key. +2. Hold FUNC and press FX2 to open the effect's SETUP, turn LEVEL to GLITCHBOX and press YES. +3. 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). + +On MKI, FUNC is labelled FUNCTION. + +## Quick tutorial + +1. Put Glitchbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to GLITCHBOX at the end of the list and press YES. At the defaults it is CHOP A at 1/16, glitching about a third of the slices. +2. Raise ACT for more glitched slices, RPT for faster rolls inside them, and change TIME for longer or shorter slices. +3. Hold FUNC and press FX2, set TYPE to STUT or ARPG and VAR to B, C or D, and play the same loop. +4. Turn MIX to about 96 so each glitch replaces the track, to 127 for the glitches alone, or to 0 to hear the track alone again. + +## Compatibility and limitations + +- Glitchbox or Loopbox? Glitchbox throws parts of the track back on the beat: chopped, stuttered or stepped through pitches, a glitch at a time. Loopbox (a separate module) keeps a short loop going under the track: layered at several speeds, overdubbed or gliding. Each takes a track's FX2. +- FX2 only: the capture ring needs an FX2 slot's buffer (15,870 words, stopping short of Sidechain Compressor's key window). +- During a long tail the ring stops recording if its write position would reach the window being echoed. It records again, from nothing, once the tail has faded, or when a glitch is due: that glitch ends the tail and waits for a fresh chunk, so it never replays audio from before the freeze. +- Mono capture: the replay is the track's mono sum on both sides, level with the dry track for a mono sample and about 3 dB under it for wide stereo; loud peaks are limited at full scale. +- A repeat is at most 179 ms, what the FX2 buffer holds: long slices are played as chunks, so a 1/2 glitch is several shorter glitches in a row, not one half-note loop. +- Glitches follow the tempo, not the transport: after STOP they would carry on, so Glitchbox watches its input. After a second of silence no new glitch starts; after four seconds any glitch 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 (a glitch of it would replay silence anyway). +- FX1 is not offered: an FX1 slot's buffer (3,072 words, 70 ms) is too short for these glitches. +- Slices follow the project's tempo but not yet the pattern's steps, track speed or swing. The owner agreed on [issue #2491](https://github.com/repeat98/modwerk/issues/2491) that free-running tempo slices are fine for now, until the base has a step clock for effects. +- Declared incompatible with Analog BD, which currently requires the stock DSP effects, as every custom DSP effect is. +- It prefers effect id 10, as Fuzzbox and Midiverb do. Installed over USB this makes no difference: the base gives each effect its own id. On a card image, stock's 32 effect slots allow only one module an id, so only one of the three can be in the same card set; the card tools refuse a set with more. +- Cost in dsp_host: at most 231.7 executed DSP instructions a sample (the dearest setting with a trig split; 212 unsplit), against stock SPRING REV's 314 (`evidence/performance.json`). On the author's MKII one instance raised a core's DSP load by about 8 points. + +## Tests and measurements + +See [TESTING.md](TESTING.md). + +## Authorship and licences + +Original code by @jrs1717 under the MIT licence in [LICENSE](LICENSE). The design is inspired by glitch effects in general; no product's code, tables, samples or names. Ghost Cut's notes on the FX2 ring (its size and the key window) helped. + +## Screens and audio + +![FX2 SETUP page with an effect list ending in Glitchbox, selected; knobs labelled STUT, DIRT, VAR, WIDE, RAND and DGRD.](media/ot-location.png) + +Hold FUNC and press FX2: Glitchbox is chosen at the end of the effect list, with TYPE (here STUT), DIRT and VAR on the top row and WIDE, RAND and DGRD below. + +![FX2 main page titled Glitchbox 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 + +- Host test, no tools: `python3 -B test_reference.py`. +- Render gate (Octabam's DSP tools): `python3 -B verify.py`. +- Hear it: `npm run module:dev -- glitchbox`; check it: `npm run module:doctor -- glitchbox`. diff --git a/sdk/octatrack/modules/glitchbox/TESTING.md b/sdk/octatrack/modules/glitchbox/TESTING.md new file mode 100644 index 0000000000..d94132ec5e --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/TESTING.md @@ -0,0 +1,318 @@ +# Glitchbox testing + +## 0.1.0-experimental + +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. + +## In dsp_host (no firmware, no unit) + +1 December 2026, macOS, Octabam f7d7290's `dsp_asm` and `dsp_host`, `sdk/octatrack/tools/dsp_gate.py` 4c33a6ac. + +- `python3 -B verify.py`: every gate passed. Every instruction decodes as written (signed `mpy`/`mac x0,y1` only, no `rep`, no `mpysu`); no label is a prefix of another, case-blind; state inside X:(r7+$00..$5f); every lua offset within 7 bits; proc returns with m4 and m5 linear again. Bit for bit against `reference.py`: every TYPE and VAR glitching at every slice, the defaults at 90, 120 and 174 BPM, TIME 1/4 and 1/2 at 120 BPM over 5 s (glitches through every chunk), every knob swept while glitching, a tempo word changing the slices, a 5-frame trig split every block, a knob word with an LFO's fraction bits, garbage state before init, state from two seeds, and an FX1-sized slot (allocator base $2000), which passes dry. Exact silence out for silence in, in every type at the dearest setting; a burst's tail ends in exact silence; after 1 s of noise and then silence, every type at TAIL 127 is silent from 7 s on. +- `python3 -B test_reference.py`: 22 of 22 passed (constants against their formulas, slice lengths at four tempos, MIX 0, and ACT 0 at MIX 95, within 1 LSB of dry (2 LSB at MIX 96 exactly), ACT 0 at MIX 127 silent, the glitch whole from MIX 96, ACT setting how often, all twelve TYPE/VAR combinations sounding different, SHAP's fade rising evenly, the tail ringing on and longer with TAIL, falling silent within 6 s after the input stops at TAIL 127, a glitch level with a mono tone, a glitch starting on TIME's grid and lasting whole slices at 1/4 and 1/2 at 120 BPM, DIRT holding samples and changing the sound, WIDE alternating sides on a mono track, RAND varying repeat counts, DGRD changing only the tail, everything silent within 4.2 s of the input stopping (each TYPE's VAR C at TIME 1/4, STUT C at 1/2) and the watch cleared when it returns, STUT B's gate leaving dips through the duck at MIX 96, the dry filling the fades (no window of 4.5 ms inside a glitch under half the tone's peak; the build before failed it at 38 %), silence). +- Cycle meter, executed instructions a sample, on the head: 200.0 to 204.3 glitching at every slice across the twelve combinations and at the dearest setting (TAIL 127, MIX 127, RPT 8, VAR D, with DIRT, WIDE, RAND and DGRD at 127: CHOP 210.5, STUT 207.7, ARPG 207.4); 207.4 to 210.5 on TAIL's ring-freeze path (TIME 1/4, RPT 1, TAIL 127). Trials since TAIL were built with `--cycles 145`, from the envelope duck on with `--cycles 150`, from the MIX remap on with `--cycles 160`, from STUT B's gate on with `--cycles 175`, from the second page's four knobs on with `--cycles 210`, and from the silence watch on with `--cycles 215`. +- Not run: two instances with their own buffers (dsp_gate hands every instance the same allocator entry). + +## On the unit + +### Test procedure: glitchbox (package 1ae4be59, the grid-drift fix, the shipped build) 0.1.0-experimental, 2026-12-05 + +Build: revision `c7724e2126f1`, package `glitchbox.mwrm` SHA-256 `1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0`. `npm run test:procedure -- glitchbox --package /../glitchbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out `, 623 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 glitchbox` | logs/01-software.log | +| 2 | Beside every other module | contract | passed | `npm run modules:compat -- glitchbox` | 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 /../glitchbox.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 /../glitchbox.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 /../glitchbox.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 1ae4be59 (the grid-drift fix), Glitchbox on T1 and T5 FX2 (both cores) while the pattern played: CHOP with ACT 127 at RPT 4; TYPE changed to ARPG and then STUT mid-glitch (the remainder rule across a TYPE change); the ring-freeze path with RPT 1 and TAIL 127 at TIME 1/8 and at 1/2; CHOP at RPT 2 and ARPG after it. Health after each: 0 stalls, 0 errors, no crash, CPU 649-702. After STOP: stall none recorded; latest entries 279.0 and 7.9 us late, 0 in the guard's 80-190 us window, no skipped frame. TIME 1/4 and RPT 3, 5 and 7 were not set exactly on the unit (the stepped knobs' encoder acceleration overshot); they run bit for bit in dsp_host (verify.py; test_a_chunks_repeats_add_up_to_the_chunk). The timing by ear is the author's. STOP, Part reloaded (working = saved), the trials rolled back | `device try`, `pick:T1:FX2:GLITCHBOX`, `pick:T5:FX2:GLITCHBOX`, `png:`, `health`, `stats`, `stall`, `late`, `reload` | h-chop-rpt2.png, h-arpg.png, h-stut.png, h-freeze.png, h-freeze14.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 | +|---|---|---|---| +| A chunk's repeats add up to the chunk (the fix) | every CHOP and ARPG repeat was chunk // RPT, so a glitched chunk ended up to RPT - 1 samples early and the grid slid ahead | test_a_chunks_repeats_add_up_to_the_chunk: CHOP, STUT and ARPG at RPT 3, 5 and 7 (fails on the old model: CHOP at RPT 5, 5,508 of 5,512); verify.py bit for bit; on the unit CHOP at RPT 2 and 4 | passed | +| TYPE changed mid-glitch | STUT spends what is left of the chunk; CHOP and ARPG must never take more | verify.py's knob sweep (STUT, ARPG, CHOP while glitching) bit for bit; step 11 (ARPG, then STUT, mid-glitch) | passed: a first version of the fix diverged here in dsp_host and was corrected before any package | +| Both DSP cores, six at once | the ring is read and written every sample | step 7 (T1 and T5 alone, then T1-T8); step 11 (T1 and T5) | passed: six placed, CPU 712, core 1 peak 630, core 0 peak 713 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The frame-cost curve, playing | the per-call scheduling runs on the frame | step 9: `device:price --curve T1,T3,T6,T7` | passed: adds +0.9, -1.8, +4.6, -2.4 (first 4.6, each 4.6); empty admitted (longest frame 36.4 %), medium admitted (87 %), 0 dropped | +| TAIL 127 with RPT 1 (the ring-freeze path) | a long tail freezes the ring; a glitch due on it ends the tail | step 11 at TIME 1/8 and 1/2; verify.py at TIME 1/4, 95 BPM | passed on the unit (1/8, 1/2) and in dsp_host (1/4) | +| TIME 1/2 below 42 BPM | up to 32 chunks so a slice stays within the ring's reach down to 30 BPM | verify.py: STUT and CHOP at 30 BPM, bit for bit | passed in dsp_host; not run on the unit at 30 BPM | +| Beside Sidechain Compressor | its key window starts right after the ring (+$3DFE) | not run | not run: the ring stops at +$3DFD, and the base refuses a buffer over the window | +| 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 1ae4be591343, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 6 to 11; the developer's stage on 1ae4be59: 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 Octatrack on its flashed base ddb56b72 (OS 1.40C): RAM trials of 120 s with `npm run module:dev -- glitchbox --cycles-kind executed --state 64 --buffer 15870 --slots fx2`, one instance, on builds of this branch before the head. Every trial installed and rolled back with no crash, stall, freeze or skipped track logged, except where noted. Builds before TAIL were trialled with `--cycles 130`, under the 134.5 to 138.7 later measured for them; from TAIL on, `--cycles 145`. Reports are the author's, as given; the changes follow each. + +1. 1 December 2026. Reported: no clicks or dropouts; MIX kept a lot of the dry track (the glitch side then played the live track between glitches). Changed: the glitch side silent between glitches, MIX default 64. +2. Reported: SHAP had little effect (its fade grew from 1/64 to only 1/33 of a repeat by the knob's middle). Changed: the fade rises evenly, 1/64 at 0, 1/4 at 64, a full swell at 127; CHOP C doubles it. +3. Reported: full MIX seemed lower than the dry track. Changed: +3 dB on the glitch, limited at full scale. +4. Reported: ACT seemed to do nothing (a glitch lasted RPT slices and the ring then recaptured for a slice or two). Changed: a glitch fills one slice with RPT repeats, the ring keeps recording, and ACT is the share of slices that glitch. +5. Asked: temper ACT, more difference between the variations and between the types. Changed: ACT scaled so 127 glitches about 70 % of the time (model: 24, 31, 55 and 72 % at 32, 64, 96, 127); STUT a ratchet (2756, 1378, 689, 344, 172, 173 samples for 1/16 at 120 BPM, RPT 6); CHOP B always pitched, CHOP C reversed; ARPG B a falling minor arpeggio, ARPG C octave leaps; D variations crushed to 9 bits. +6. Asked for longer tails. Changed: a TAIL knob (slot 5): the last repeat keeps looping under a decaying gain, about 50 ms near 0 to about 3 s at 127; the ring freezes if its writer would reach the looped window. +7. The TAIL build (9f2dfe02), four trials. The second trial's rollback was refused by the unit ("Device refused enter: unsafe"); the author was asked to power-cycle, and the later trials rolled back cleanly. Reported: MIX did not seem to work, and the effect kept going after the transport stopped. Found in the model: a glitch starting while a tail had frozen the ring left it frozen, and its own tail kept it so, looping stale audio for good (at TAIL 127 it never fell silent); and a glitch played about 3 dB under a mono track. Changed: a glitch always records again (its window lies behind the writer), so every type falls silent within about 0.6 s after the input stops; the glitch plays at half the mono sum, level with a mono sample. +8. That build (620771d1), one trial. Reported: MIX changed nothing audible. Knob E reaches the engine (published effects on the same donor read it at x:(r6+$4) the same way), so the design was at fault: with the glitch side silent between glitches, MIX mostly set the level. The author chose: the track plays dry between glitches, and MIX sets how far a glitch replaces it. Changed: the dry glides (64-sample time constant) to 1 - MIX while a glitch plays and back to the whole track after it; a tail echoes over the dry at MIX. Where a glitch ends the two overlap briefly, up to 8 % over the dry peak in the model. + +9. That build (1fa75f80), one trial. Reported: glitches at MIX 0, and with ACT 0 too, though knob E read MIX 0 on the screen; nothing else in the Part used the slot, as far as the author knew. In the model MIX 0 and ACT 0 are the dry track within 1 LSB, so the sound came from outside the model. Found in the source: proc returned with m4 and m5 still holding the ring's modulus ($3dfd), where every published DSP effect resets the modifier registers it changes to linear before it returns. Code that runs after an effect and addresses with r4 or r5 would then wrap inside 16K, which could be heard whatever MIX and ACT are (not confirmed on the unit: the flashed base answers no development requests). Every earlier trial ran with this fault, so the reports above may be partly about it. Changed: proc resets m4 and m5 to linear where it returns; a new verify.py gate checks it (it fails on the build before). +10. The head (2a13f743, m4 and m5 reset), first on the flashed base: reported dropouts at MIX 0 and ACT 0 that stopped when FX2 was set to a stock effect. Then, with the author's OK, on the development twin of the same base (117eb07f, RAM boot), project "Mang112 95", Part 1, pattern A01 playing: + - Picking GLITCHBOX on T1 or T2 FX2 in a fresh trial was refused without a message: the chooser showed GLITCHBOX, `ui` showed the slot running NONE, `pick:` timed out after 5 s, and the trial's refusals counter rose by about 260 per pick. After a Part RELOAD in the same trial both picks ran within 116 ms. Seen in three trials; why the pick is refused is not known. A refused pick retried this way is the likeliest source of the dropouts, which would mean Glitchbox was not running in the trials where they were heard. + - With Glitchbox running: T1-4 DSP mean 31 % without it, 43 % with it on T1, 48-50 % on T1 and T2; frame interrupt peak 83-87 %, frame gap 377-383 us and no late entries in all three. Six readings each, `stats`, `gap`, `guard`, `late`. + - With Glitchbox running on T1 and T2 and T1 at ACT 0 and MIX 0, the author heard T1 clean, without dropouts. + - The first RELOAD discarded the Part's unsaved edits (Glitchbox on T1 and T2 FX2 with the author's settings, T1 FX1 NONE); the saved Part has FILTER and DELAY. + +11. That build (a2c2d6ef) on the twin, with Glitchbox checked running on T1 FX2 before the author listened: reported dropouts, unsure whether from Glitchbox or the DSP. Read during that trial: no late entries, no skipped frames, longest frame gap 419 us, no stall, the slot running throughout. So the unit dropped nothing; the likeliest cause is the sound itself: each repeat fades to silence at its ends (SHAP) while the dry is ducked by the whole MIX, which leaves holes (at the defaults four dips of about 8 ms a glitch). The author chose: the dry ducks with the repeat's envelope. Changed: while a glitch plays the dry is 1 - MIX x env, so it fills each fade and at MIX 127 the repeat replaces it at its peak; the dry no longer glides. Cost: 3.6 instructions a sample more (the duck's 11 less the glide's 6 and the block's snap); trials from here are built with `--cycles 150`. + +12. That build (b869b9e2) on the twin, two trials with Glitchbox checked running on T1 FX2 (`--cycles 150`), both with no crash, stall, freeze or skipped track logged. Reported: "Sounds pretty good now". + +13. Asked: more dramatic differences between A-D, 1/2 on TIME, sync to the tempo and play trigs, and FX1. Decided with the author: FX2 only (an FX1 slot's buffer is 3,072 words, 70 ms); TIME on a true note grid; trig sync needs the base's shared step clock (#2491), proposed to the owner. Changed: TIME 1/64 to 1/2; a slice longer than 7,900 samples plays as 2, 4, 8 or 16 chunks, glitches are decided only on TIME's grid and last the whole slice (before, a long slice was halved and decided at every half); CHOP B pitched 0.25, 0.5, 2 or 3x (was 0.5 to 2x); CHOP C reversed an octave down; STUT B gated to each repeat's first eighth (was half); STUT D five semitones a repeat (was three); ARPG C leaps over two octaves; D crushed to 7 bits (was 9). State grows to X:(r7+$00..$47) (72 words); not yet run on the unit. + +14. That build (47a938ab) on the twin, three trials with Glitchbox checked running on T1 FX2 (`--cycles 150 --state 72`), each with no crash, stall, freeze or skipped track logged. Reported: "Sounds good, so far"; the TIME knob did not use its full range (six labelled values on a stepped knob fall back to a plain dial, so they filled only its first steps). Changed: TIME uses the wide-stepped dial, as RPT does; the engine is unchanged. + +15. That build (e1a9356c) on the twin, two trials with Glitchbox checked running on T1 FX2, each with no crash, stall, freeze or skipped track logged. Reported: "Sounding really good"; asked for full MIX to be the glitches alone, with about 75 % where 100 % is now. Changed: D = 4/3 MIX scales the glitch and the duck (whole at MIX 96, where the repeat replaces the track at its peak, as 127 did before), and K = 4 (1 - MIX) caps the dry, so from 96 to 127 the track fades out everywhere and 127 is the glitches alone. Cost: 12 instructions a sample more; trials from here are built with `--cycles 160`. + +16. That build (09389183) on the twin, two trials with Glitchbox checked running on T1 FX2 (`--cycles 160`), each with no crash, stall, freeze or skipped track logged. Reported: MIX "sounds really good"; STUT B did little. Found in the model: its gate silenced each repeat after its first eighth, but the dry's duck followed that gated envelope, so the dry filled every gap (the quietest 4.5 ms window inside a glitch stayed at the tone's full peak at MIX 96). Changed: the duck follows the whole repeat's envelope, and the gate shapes only the glitch, with the same fade slope; a new host test fails the build before. Cost: 13 instructions a sample more; trials from here are built with `--cycles 175`. + +17. That build (761961da) on the twin: reported "sounds much better". Asked for more for glitchy industrial music; the author chose all four proposals. Changed, on the second page, each 0 by default so the sound is unchanged until turned: DIRT (B, slot 7): sample-rate hold of 1 + DIRT/8 samples, a crush mask MASKS[DIRT/16] with VAR's, and a drive x (1 + 3 DIRT) clipped at full scale then x (1 - DIRT/2), on the glitch only; WIDE (D, slot 9): each repeat panned +WIDE or -WIDE, alternating; RAND (E, slot 10): the chance of a random repeat count (1-8) a glitch, and a random pitch (T0), a reversal (at half the chance) and a random place in WIDE a repeat; DGRD (F, slot 11): in a tail, DIRT + DGRD x (1 - the tail's gain). Slot 11 (r6+$e bits 8-15) is read as the model and dsp_host pack it; no published module reads it on a unit yet. State grows to X:(r7+$00..$5f) (96 words). Found while building: `lua (r7+$58)` wrapped silently (its offset is 7 bits), a new verify.py gate refuses any larger offset. Cost: 202.3 instructions a sample at the dearest setting with all four at full; trials from here are built with `--cycles 210 --state 96`. + +18. That build (784451b9) on the twin, several trials with Glitchbox checked running on T1 FX2 (`--cycles 210 --state 96`), each with no crash, stall, freeze or skipped track logged. Reported: "everything sounds awesome", except that at TAIL 127 the sound kept going after STOP; then that STUT C kept going, as the same piece repeating exactly, forever, at any TIME. Not reproduced off the unit: the model and the engine in dsp_host agreed bit for bit and fell silent within 2.7 s for every setting tried (STUT C at TIME 1/16, 1/4 and 1/2, ACT 30 and 64, 95 BPM; 40 random STUT C settings with every knob). Found in the model: after STOP glitches keep firing on TIME's grid (the timing is free-running), and at long TIME each tail freezes the ring about 44 ms in, so each new glitch can bring back audio from before the freeze. The cause on the unit is not known. Changed: a silence watch. After a second with the input under 64 LSB no glitch starts; after four seconds any glitch or tail stops, the glitch side goes silent and the ring records again. Sound coming back clears it at once. New gates: every TYPE and VAR at TIME 1/4, TAIL 127, 95 BPM is bit for bit the model and silent from 4.2 s after the input stops; a host test checks the same at 1/4 and 1/2 and that glitches come back with the input. Found while building: the silence check first loaded x0, which the decision then used as the slice length, so the engine never glitched (dsp_host showed it; the model has no registers). Cost: 210.5 instructions a sample at the dearest setting; trials from here are built with `--cycles 215`. + +19. That build (2e59ecb3, the silence watch) on the twin, two trials with Glitchbox checked running on T1 FX2 (`--cycles 215 --state 96`), each with no crash, stall, freeze or skipped track logged. The author set STUT C, TIME 1/2 and TAIL 127 by hand (remote knob turns made during the author's own playing landed out of order and were stopped). Reported: "Everything seems to be working now". + +20. 2 December 2026, the code review's fixes (0428f8e6): TIME 1/2 plays as up to 32 chunks, so a slice stays within the ring's reach down to 30 BPM (16 left it 11,025 samples long at 30 BPM); a glitch that comes due while a long tail has frozen the ring ends the tail and records again, so it never replays audio from before the freeze. A third finding, that the silence watch hears an exactly out-of-phase source as silence, was left as it is: the ring is mono, so such a source glitches to silence either way. The package was rebuilt (8d67a364) and the procedure below ran again on it. + +#### The author's stage on 1ae4be59 (as reported) + +5 December 2026 (UTC), the author's MKII on their flashed base ddb56b72 (OS 1.40C): package 1ae4be59 kept in place of 8d67a364 beside the card's 20 other modules (`npm run device -- try glitchbox.mwrm --seconds 60 --accept`: no crash, stall, freeze or skipped track; the kept set otherwise unchanged). The author played Glitchbox on a track's FX2, saved the Part, reloaded it and power-cycled: "everything survived". + +### Test procedure: glitchbox (package 8d67a364, the review fixes) 0.1.0-experimental, 2026-12-02 + +Build: revision `f81eb6ce0902`, package `glitchbox.mwrm` SHA-256 `8d67a364e3459c4ad8cff894196791dd96641c5b6fa6076398467bad223af9ce`. `npm run test:procedure -- glitchbox --package /../glitchbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run`, 632 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 glitchbox` | 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 /../glitchbox.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: back on A01 from A04, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../glitchbox.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 /../glitchbox.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 8d67a364, the pattern played 8 s at TIME 1/2, RPT 1, TAIL 127, ACT 64 (the ring-freeze path, where a glitch now comes due on a frozen ring; freeze-set.png), frame interrupt peak 86.6 %, no late entry, skipped frame, stall or crash; STOP, Part reloaded, the trial rolled back. Both pages: the same screens as package 9dec7880 (media/capture.json); no control changed. MAIN and CUE not recorded over USB: the recorder is not built on this computer | `device try`, `pick:T1:FX2:GLITCHBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | freeze-set.png | +| 12 | Submitter's own stage | unit | done on 8d67a364: 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) +- 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 | step 7 (alone on T1, then T5); step 9 on T1 FX2 | passed: T1 peak 473 per mille of a frame, admitted in 117 ms, T5 peak 560 per mille, admitted in 115 ms; step 9 in use: DSP T1-T4 +7.3, frame +0 | +| Eight instances at once | each instance its own ring and 96 state words | step 7: picked on T1-T8 FX2, playing | passed: CPU 728, T1-4 peak 633, T5-8 peak 708 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| The frame-cost curve, playing | the review found the earlier curve's readings noisy, clamped from negative adds | step 9: `device:price --curve T1,T3,T6,T7`, which plays the pattern itself | passed: adds +4.3, -0.5, +3.2, +5.4 points: first 4.3, each 3.2; empty admitted (longest frame 36.6 %), medium admitted (91.3 %), 0 dropped, 0 stalls | +| A glitch due while a tail froze the ring (review fix) | the glitch now ends the tail and records again instead of replaying the frozen ring | step 11 at TIME 1/2, RPT 1, TAIL 127, ACT 64; verify.py and test_reference.py at TIME 1/4, 95 BPM | passed on the unit: no fault; bit for bit in dsp_host; the host test checks every glitch starts recording with a fresh chunk | +| TIME 1/2 below 42 BPM (review fix) | up to 32 chunks now, so a slice stays within the ring's reach down to 30 BPM | verify.py: STUT and CHOP at 30 BPM, bit for bit; test_reference.py: chunk 5,512 samples, 32 chunks | passed in dsp_host; not run on the unit at 30 BPM | +| Two instances, each with its own ring | dsp_host hands every instance the same allocator entry | step 7's six instances; the author's stage on T1 and T5 (9dec7880) | passed as far as observed: they ran together; the author heard each track glitch its own audio | +| 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)`, modulus $3dfd), and the base refuses a buffer over the window | +| STOP while glitching (the silence watch) | glitches follow the tempo, not the transport | the author on 2e59ecb3; verify.py for every TYPE and VAR | passed: silent after STOP as reported; verify.py silent 4.2 s after the input stops | +| 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 | +| A tempo change while glitching | slices follow the tempo word | not run on the unit | not run: verify.py holds a tempo change while playing bit for bit | + +#### 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 8d67a364e345, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on 8d67a364 (kept, listened to, power cycle): "Everything looks good". +Edge cases: the table above, one row a case (or "Edge cases: none, because …"). + +#### The author's stage (package 8d67a364) + +2 December 2026, the author's MKII on its flashed base ddb56b72 (OS 1.40C) after a power cycle: package 8d67a364 kept with `npm run device -- try --accept` in place of 9dec7880 beside the 25 other kept modules (the card set read 26 modules before and after, nothing removed; no crash, stall, freeze or skipped track logged). Asked to set Glitchbox up on a track's FX2, try TAIL 127 with TIME 1/4, RPT 1 and ACT about 40 (each new glitch should cut the tail and replay what the track just played), optionally TIME 1/2 at 40 BPM or below, save the Part, power-cycle and check it is still there and working. Reported: "Everything looks good". + +The record below is the run before the review fixes, on package f0dc08f6. + +### Test procedure: glitchbox (package f0dc08f6, before the review fixes) 0.1.0-experimental, 2026-12-02 + +Build: revision `274f58031242`, package `glitchbox.mwrm` SHA-256 `f0dc08f6f5e6d7c56fec1096ce85616ff73517ca3bb959e2e6198eb1d8cd776b`. `npm run test:procedure -- glitchbox --package /../glitchbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run`, 604 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 glitchbox` | 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 /../glitchbox.mwrm` | logs/07-unit-pass.log | +| 8 | Soak | unit | passed: Part 1 on A01: back on A01 from A04, Part 1 on A01 reloaded; working = saved | `node scripts/device.mjs try /../glitchbox.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 /../glitchbox.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 f0dc08f6, the pattern played 8 s at TIME 1/2, RPT 1, TAIL 127 (the ring-freeze path; freeze-set.png), frame interrupt peak 91.9 %, no late entry, skipped frame, stall or crash; Part reloaded. Both pages were captured on the flashed base with package 9dec7880 (the same screens; media/capture.json). MAIN and CUE not recorded over USB: the recorder is not built on this computer | `device try`, `pick:T1:FX2:GLITCHBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | freeze-set.png | +| 12 | Submitter's own stage | unit | on package 9dec7880 (the same engine, declaring 215 cycles): see the author's stage below; not repeated on f0dc08f6 | | | + +#### 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) +- 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 | step 7 (alone on T1, then T5); step 9 on T1 FX2 | passed: T1 peak 473 per mille of a frame, admitted in 119 ms, T5 peak 550 per mille of a frame, admitted in 118 ms; step 9 in use: T1-T4 +7.6, frame +0 | +| Eight instances at once | each instance its own ring and 96 state words | step 7: picked on T1-T8 FX2 | passed: CPU 732, T1-4 peak 632, T5-8 peak 709 per mille; two refused by the base for budget, no crash, stall or dropped frame | +| Two instances, each with its own ring | dsp_host hands every instance the same allocator entry | step 7's six instances; the author's stage on T1 and T5 (9dec7880) | passed as far as observed: they ran together; the author heard each track glitch its own audio | +| 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)`, modulus $3dfd), and the base refuses a buffer over the window | +| TAIL 127, RPT 1, a long TIME (the ring-freeze path) | the tail freezes the ring about 44 ms in when a chunk is long | step 11 by hand | passed: no late entry, skipped frame, stall or crash | +| STOP while glitching (the silence watch) | glitches follow the tempo, not the transport | the author on 2e59ecb3; verify.py for every TYPE and VAR | passed: silent after STOP as reported; verify.py silent 4.2 s after the input stops | +| A Part change while installed | per-instance state and the ring across Parts | step 7 (12 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 | +| A tempo change while glitching | slices follow the tempo word | not run on the unit | not run: verify.py holds a tempo change while playing bit for bit | +| TYPE or VAR changed mid-glitch | a repeat's rate and gate come from TYPE and VAR | the author's stage (9dec7880) | passed as reported ("sounds great"); verify.py sweeps both bit for bit | +| DGRD (slot 11) on the unit | no published module reads slot 11 | the author's stage (9dec7880) | passed as reported | + +#### 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 f0dc08f6f5e6, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 1 to 11; the developer's stage on package 9dec7880 (the same engine). +Edge cases: the table above, one row a case. + +The record below is the first run, on package 9dec7880 (the same engine, declaring 215 cycles, under the worst case perf.py measured later). + +### Test procedure: glitchbox 0.1.0-experimental, 2026-12-02 + +Build: revision `587c1535ea6b`, package `glitchbox.mwrm` SHA-256 `9dec78808d1dcaec2b275ceb57782c2fcbc358cd566d02f9a67f7fb440de609c`. `npm run test:procedure -- glitchbox --package /../glitchbox.mwrm --share /tmp/modwerk-share.sock --no-emulator --soak-pc-channel 11 --soak-auto-channel 11 --out /../run`, 660 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 glitchbox` | 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 /../glitchbox.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 /../glitchbox.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 /../glitchbox.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: both pages drawn as the README lists them (main: TIME, ACT, SHAP, RPT, MIX, TAIL; setup: TYPE, DIRT, VAR, WIDE, RAND, DGRD); the pattern played 8 s at TAIL 127, RPT 1 (TIME 1/16 at 95 BPM, a 6,963-sample chunk, the length 1/4 plays four times, so the ring-freeze path), frame interrupt peak 87.9 %, no late entry, no skipped frame, no stall, no crash; STOP, Part reloaded (working = saved). MAIN and CUE not recorded over USB: the recorder is not built on this computer | `pick:T1:FX2:GLITCHBOX`, `png:`, `guard`, `late`, `health`, `stall`, `reload` | page1.png, page2.png, freeze-set.png | +| 12 | Submitter's own stage | unit | to do | | | + +#### 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) + +| Case | Why this change makes it a risk | How run | Result | +|---|---|---|---| +| Both DSP cores | the ring is read and written every sample; the owner asked for the cost on each core | step 7: GLITCHBOX alone on T1, then on T5; step 9 on T1 FX2 | passed: T1-4 core 38.6 to 46.3 % on T1 (+7.7), T5-8 core 47.5 to 54.9 % on T5 (+7.4); step 9 in use on T1 FX2: +8.1 on T1-4, frame +0 | +| Eight instances at once | each instance its own ring and 96 state words | step 7: picked on T1-T8 FX2 | passed: six admitted (T4 and T8 refused, the base holding each core within budget), no crash, stall or dropped frame | +| Two instances, each with its own ring | dsp_host hands every instance the same allocator entry, so only the unit can show it | step 7's six instances ran together without fault | partly: they ran together; whether each ring stays its own is left to the submitter's ears (two tracks, different settings) | +| Beside Sidechain Compressor | its key window starts right after the ring (+$3DFE) | not run: needs a set trial with Sidechain Compressor's package on this twin | not run: the ring stops at +$3DFD (`Claims(buffer_words=15870)`, verify.py's modulus $3dfd), and the base refuses a buffer over the window at run time | +| TAIL 127, RPT 1, a long chunk (the ring-freeze path) | the tail freezes the ring about 44 ms in when a chunk is long | step 11: 8 s playing at TAIL 127, RPT 1, 6,963-sample chunks (95 BPM) | passed: no late entry, skipped frame, stall or crash | +| STOP while glitching (the silence watch) | glitches follow the tempo, not the transport | the author, on 2e59ecb3, STUT C, TIME 1/2, TAIL 127 | passed as reported by the author: silent after STOP; verify.py gate for every TYPE and VAR (silent 4.2 s after the input stops) | +| A Part change while installed | per-instance state and the ring across Parts | step 7 (Part 1 to 4 and back, twice) and step 8 (soak) | passed | +| A trial ending while in use | the loader rolls back a slot that runs it | step 8's trial expired with GLITCHBOX on the Part, then the Part reloaded | passed | +| A tempo change while glitching | slices follow the tempo word | not run on the unit | not run: verify.py holds a tempo change while playing bit for bit in dsp_host | +| TYPE or VAR changed mid-glitch | a repeat's rate and gate come from TYPE and VAR | not run on the unit by ear | left to the submitter; verify.py sweeps both while glitching, bit for bit | +| DGRD (slot 11) on the unit | no published module reads slot 11 (r6+$e bits 8-15) | step 11: drawn on the setup page | partly: drawn; whether it changes the tail is left to the submitter's ears | + +#### 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 9dec78808d1d, MKII, OS 1.40C, development twin 117eb07f of base ddb56b72, test:procedure steps 6 to 11; the developer's stage not yet. +Edge cases: the table above, one row a case. + +#### The author's stage (package 9dec7880) + +1 December 2026 (2 December UTC), the author's MKII on its flashed base ddb56b72 (OS 1.40C) after a power cycle, with the 25 kept modules running: three 120 s trials of package 9dec7880 with `npm run device -- try`, each rolled back with no crash, stall, freeze or skipped track logged. The first trial: the author did not find GLITCHBOX in the FX2 list (it is the last entry, after the stock effects and the other module effects); the inventory showed it installed in the next trial. Asked to try it on T1 and T5 with different types, change TYPE and VAR while glitching, and TAIL and DGRD. Reported: "Sounds great". Then, with the author's OK, package 9dec7880 kept with `npm run device -- try --accept` beside the 25 kept modules: the card set read 26 modules saved, 26 live (nothing removed). The author set Glitchbox up on a track, saved the Part, reloaded it, saved and reloaded the project, and power-cycled the unit. Reported: "Everything survived". + +## Stock flows + +Not tested. + +## Sound quality + +Not tested. npm run fx:audit checks aliasing, DC, clipping and idle behaviour. + +## Performance + +`python3 -B perf.py` in dsp_host (verify.py's synthetic image), then `npm run perf:audit -- check evidence/performance.json --stamp`, 4 December 2026, after the grid-drift fix: + +- Static floor: 198 words in the per-sample loop (straight-line, no branch). +- 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 204.7 (defaults) to 212.1 (moving); worst 231.7 at the dearest CHOP setting with a split of 10 frames, where the per-call setup runs twice a block. The package declares 232 (`--cycles 232`); before the drift fix the worst was 230.9 and the package declared 231. +- 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 891.2 and 835.5. + +| Check | Result | +|---|---| +| record | dsp record for glitchbox@0.1.0-experimental | +| cycles | 4 x 198 = 792 of 3120 per sample per core (25%), measured 230.9 per instance | +| stock benchmark | 230.9 vs SPRING REV 314.19 (0.73x); the dearest stock effect is 330.94 | +| stress | 4 per core, eight tracks, 3 LFOs and 12 locked slots, 2 s, no clobber, no hang | + +On the unit see the test procedure above (both cores, six instances at once, the price). diff --git a/sdk/octatrack/modules/glitchbox/engine.asm b/sdk/octatrack/modules/glitchbox/engine.asm new file mode 100644 index 0000000000..0addea6bd8 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/engine.asm @@ -0,0 +1,1225 @@ +; GLITCHBOX -- an original glitch 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 (what the ring +; holds). 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 +; glitches. A glitch fills each chunk of its slice with RPT repeats, each +; 1/RPT of the chunk, read from the ring while it keeps recording: +; CHOP each repeat (1/RPT of the chunk) one of the last 1-4 repeat lengths +; back (A plain, B pitched 0.25/0.5/2/3x, C reversed an octave down +; with fades twice as long, D pitched and crushed to 7 bits) +; STUT a ratchet from the start of the chunk before: each repeat half +; what is left (A plain, B all but each repeat's first eighth silent, +; C reversed, D five semitones lower each repeat, crushed) +; ARPG the start of the chunk before, stepped through pitches (A a major +; arpeggio up, B a minor one down, C leaps over two octaves, D random +; major steps, crushed) +; The window always lies at least a repeat behind the write position and the +; glitch lasts a chunk at a time, so the writer never reaches it. TAIL (slot 5): when a +; glitch ends its last repeat keeps looping, the envelope restarting each +; loop, under a gain that decays a sample at c (about 3 s to -60 dB at 127, +; about 50 ms near 0; 0 no tail) until -72 dB or the next glitch. Should the +; writer come within 32 samples of the looped window, the ring freezes, and +; records again (from nothing captured) once neither a glitch nor a tail plays, +; or at once when the next glitch starts (its window lies behind the writer). +; After a second of silence in no glitch starts; after four, any glitch or tail +; stops and the ring records again, so a stopped track falls silent. +; Per sample: an interpolated read head wrapping inside the window at the +; repeat's rate (Q21), a trapezoid envelope over the repeat (SHAP: the fade +; from 1/64 of it, rising evenly, to half of it each side) and the crush; the glitch is the replay under +; the envelope (+3 dB), silent between glitches, and MIX blends it with the dry track. +; +; Knobs (value<<16): page 1 TIME r6+0 (0-4), ACT r6+1, SHAP r6+2, RPT r6+3 +; (0-7: 1-8 repeats), MIX r6+4, TAIL r6+5; page 2 TYPE slot 6 (r6+$c bits 16-23, 0-2), +; VAR slot 8 (r6+$d bits 16-23, 0-3). MIX glides per sample and snaps +; within 64 LSB. Between glitches the track plays dry (a tail echoes over it at +; MIX); while a glitch plays the dry ducks by D x the repeat's envelope (D = 4/3 +; MIX, whole at 96), so it fills each fade and at 96 the repeat replaces it at its +; peak. From 96 to 127 the dry fades out everywhere: 127 is the glitches alone. +; +; State (X, offsets from r7; init clears $00..$5f): +; $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 $08 L (TIME now) +; $09 repeats left $0a repeat number $0b window start (Y) +; $0c W, the window (its slice less one) $0d/$0e position hi/lo +; $0f rate (Q21) $10 phase u (half: 1/2 is one repeat) $11 its step +; $12 fade slope Am $13 G/2 (1/2, or 1/4 for STUT B) $14 crush mask +; $15 the tail's gain $16 a repeat (the slice / RPT) $17 its decay +; $18 a tail playing +; $19 the slice now in use $1a/$1b MIX target/run +; $1c the dry's gain $2d the phase's wrap (1/2 in a tail, else never) $32 TAIL's decay $3f P (1 in a glitch) +; $40 chunks in a slice of TIME $41 the chunk's place in it $42 chunks left in the glitch +; $43 D, the glitch's gain (4/3 MIX, whole at 96) $44 K, the dry's ceiling (4 (1 - MIX)) +; $45 the glitch's repeats (RPT, or RAND's) $46 the crush mask (VAR's and 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 left/right gain +; $4e WIDE $4f RAND $50 DGRD $51 DIRT $52 scratch $53 samples of silence in $54 the call's loudest input +; $58-$5f DIRT's crush masks +; $40 chunks in a slice of TIME $41 the chunk's place in it $42 chunks left in the glitch $1d TYPE $1e VAR $1f ACT $20 Am from SHAP +; $21 RPT $22 TIME $23 tempo24 $24-$27 random pitches (Q21) +; $28-$2b major arpeggio (Q21) $2c seeded $2e/$2f the frame's L/R +; $30 replay $31 the glitch $33 jmax $34 the glitch's slice +; $35 the write index when the glitch started $36-$39 minor arpeggio +; $3a-$3d octave leaps $3e what is left of the slice (STUT) +; Nothing above $5f 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 #$60,>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,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 #>$7fffff,x0 + move x0,x:(r7+$15) + move x0,x:(r7+$2d) + 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 #>$200000,x0 + move x0,x:(r7+$28) + move #>$285146,x0 + move x0,x:(r7+$29) + move #>$2ff222,x0 + move x0,x:(r7+$2a) + move #>$400000,x0 + move x0,x:(r7+$2b) + move #>$200000,x0 + move x0,x:(r7+$36) + move #>$260dfc,x0 + move x0,x:(r7+$37) + move #>$2ff222,x0 + move x0,x:(r7+$38) + move #>$400000,x0 + move x0,x:(r7+$39) + move #>$400000,x0 + move x0,x:(r7+$3a) + move #>$100000,x0 + move x0,x:(r7+$3b) + move #>$400000,x0 + move x0,x:(r7+$3c) + move #>$080000,x0 + move x0,x:(r7+$3d) + 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 #>$1ffff,a + move #>$fffffe,a0 + bsr gbdi + move x0,x:(r7+$20) +; 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 x1,b + move #>$10000,y0 + cmp y0,b + move #>$0,y1 + tlt y1,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 its window 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 + clr a + move a,x:(r7+$18) + move a,x:(r7+$12) + move a,x:(r7+$17) + move #>$7fffff,x0 + move x0,x:(r7+$15) + move x0,x:(r7+$2d) + bra gbt9 +gbt5: + move x:(r7+$03),a + tst a + beq gbt9 + move x:(r7+$0b),a + move x:(r7+$00),x0 + sub x0,a + move x:(r7+$02),x0 + sub x0,a + move #>$0,y0 + move #>15870,x0 + tst a + move x0,b + tge y0,b + add b,a + move #>32,x0 + cmp x0,a + bgt 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 glitch, no tail, and the ring records again. + move x:(r7+$53),a + move #>176400,x0 + cmp x0,a + blt gbz1 + clr b + move b,x:(r7+$18) + move b,x:(r7+$12) + move b,x:(r7+$06) + move b,x:(r7+$17) + move b,x:(r7+$04) + move #>$7fffff,x0 + move x0,x:(r7+$15) + move x0,x:(r7+$2d) + 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: +; 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) +; 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 (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) +; The read head: position += rate, wrapped into [0, W). + move x:(r7+$0b),r5 + 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+$0c),x0 + move #>$0,y0 + cmp x0,a + move x0,b + tlt y0,b + sub b,a + tst a + move x0,b + tge y0,b + add b,a + move a1,x:(r7+$0d) + move a0,x:(r7+$0e) + move a1,n5 + move a0,b + lsr b + move b1,y1 + move (r5)+n5 + move y:(r5)+,a + move y:(r5),b + sub a,b + move b,x0 + mac x0,y1,a + move x:(r7+$46),x0 + and x0,a + move a1,x:(r7+$30) +; 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 envelope: min(u, 1/2 - u) at the fade's slope, from 0 to 1: the whole repeat's, which the dry follows. + move x:(r7+$10),a + move x:(r7+$11),x0 + add x0,a + move x:(r7+$2d),x0 + cmp x0,a + move #>$0,y0 + move x0,b + tlt y0,b + sub b,a + move a1,x:(r7+$10) + move a1,x0 + move x:(r7+$12),y1 + mpy x0,y1,b + asl #7,b,b + move b,x1 + move #>$400000,b + sub x0,b + move b,x0 + mpy x0,y1,b + asl #7,b,b + move b,x0 + move x1,b + cmp x0,b + tgt x0,b + tst b + move #>$0,y0 + tmi y0,b +; The dry ducks under the repeat as it swells and comes back in its fades: 1 - D x env x P, +; at most K, so from MIX 96 to 127 the dry fades out everywhere. + move b,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 glitch's own envelope: also at most (G/2 - u) at the slope, so STUT B's gate cuts the glitch, not the dry's duck. + move x:(r7+$10),x0 + move x:(r7+$13),a + sub x0,a + move a,x0 + move x:(r7+$12),y1 + mpy x0,y1,a + asl #7,a,a + move a,x0 + cmp x0,b + tgt x0,b + tst b + move #>$0,y0 + tmi y0,b + move b,y1 +; The glitch: the replay (a quarter of the mono sum) x env, then x 2 (x 0.99999 x 2): half the +; mono sum, as loud as the dry track for a mono sample; limited at full scale. + move x:(r7+$49),x0 + mpy x0,y1,a + move a,x0 + move #>$7fffff,y1 + mpy x0,y1,a + asl #1,a,a +; DIRT's drive, clipped at full scale, and its level. + 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 x:(r7+$15),y1 + mpy x0,y1,a + move a,x:(r7+$31) +; The tail's gain decays at c (0 outside a tail). + move x:(r7+$15),x0 + move x:(r7+$17),y1 + mpy x0,y1,b + move x0,a + sub b,a + move a1,x:(r7+$15) +; Left and right: glitch x D x WIDE's side + dry x its gain. + move x:(r7+$31),x0 + move x:(r7+$43),y1 + mpy x0,y1,a + move a,x:(r7+$52) + move x:(r7+$52),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 a,x:(r0)+ + move x:(r7+$52),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 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 x:(r7+$32),a + tst a + bne gbtl + move a,x:(r7+$12) + bra gbid +gbtl: + move a1,x:(r7+$17) + move #>$1,x0 + move x0,x:(r7+$18) + move #>$400000,x0 + move x0,x:(r7+$2d) + 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 + clr a + move a,x:(r7+$18) + move a,x:(r7+$12) + move a,x:(r7+$17) + move a,x:(r7+$04) + move #>$7fffff,x0 + move x0,x:(r7+$15) + move x0,x:(r7+$2d) + 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: + move #>$1,x0 + move x0,x:(r7+$06) + move x0,x:(r7+$03) + clr a + move a,x:(r7+$0a) + move a,x:(r7+$18) + move a,x:(r7+$17) + move #>$7fffff,x0 + move x0,x:(r7+$15) + move x0,x:(r7+$2d) + move x:(r7+$45),x0 + move x0,x:(r7+$09) + move x:(r7+$02),x0 + move x0,x:(r7+$35) + move x:(r7+$08),a + move a1,x:(r7+$34) + move a1,x:(r7+$3e) + asr #23,a,a + move x:(r7+$45),x0 + bsr gbdi + move x0,x:(r7+$16) + move #>$200000,x0 + move x0,x:(r7+$0f) + 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 + +; The next repeat: its window, rate, phase, envelope, gate and crush. +gbsr: +; STUT ratchets: each repeat half of what is left of the slice (the last, or +; under 128 samples, all of it); with nothing left this repeat is the last. + move x:(r7+$1d),a + move #>$1,x0 + cmp x0,a + bne gbo1 + move x:(r7+$3e),a + move x:(r7+$09),b + cmp x0,b + beq gbl1 + move #>128,x0 + cmp x0,a + blt gbl1 + asr #1,a,a + move a1,x0 + move x0,a +gbl1: + move a1,x:(r7+$16) + move a1,x0 + move x:(r7+$3e),a + sub x0,a + move a1,x:(r7+$3e) + tst a + bne gbl9 + move #>$1,x0 + move x0,x:(r7+$09) + bra gbl9 +; CHOP and ARPG: every repeat the slice over RPT; the last, or one longer +; than what is left (TYPE changed mid-glitch), takes what is left, so a +; slice's repeats add up to the slice (no drift off TIME's grid). +gbo1: + move x:(r7+$3e),a + move x:(r7+$16),x0 + move x:(r7+$09),b + move #>$1,y0 + cmp y0,b + beq gbo2 + cmp x0,a + bge gbo3 +gbo2: + move a1,x:(r7+$16) + move a1,x0 +gbo3: + sub x0,a + move a1,x:(r7+$3e) + tst a + bne gbl9 + move y0,x:(r7+$09) +gbl9: + move x:(r7+$16),a + sub #>$1,a + move a1,x:(r7+$0c) + move x:(r7+$34),x0 + move x:(r7+$1d),a + tst a + bne gbj9 + move x:(r7+$16),y0 + move x:(r7+$34),y1 + move #>$1,x0 + move x0,x:(r7+$33) + move x:(r7+$04),x0 + move #>15854,x1 + move y0,a + add y0,a + cmp x0,a + bgt gbj4 + tfr a,b + add y1,b + cmp x1,b + bgt gbj4 + move #>$2,b + move b,x:(r7+$33) + add y0,a + cmp x0,a + bgt gbj4 + tfr a,b + add y1,b + cmp x1,b + bgt gbj4 + move #>$3,b + move b,x:(r7+$33) + add y0,a + cmp x0,a + bgt gbj4 + tfr a,b + add y1,b + cmp x1,b + bgt gbj4 + move #>$4,b + move b,x:(r7+$33) +gbj4: + bsr gbrn + move x:(r7+$33),y1 + mpy x0,y1,a + add #>$1,a + move a1,x0 + move x:(r7+$16),y1 + mpy x0,y1,a + asr #1,a,a + move a0,x0 +gbj9: + move x:(r7+$35),a + sub x0,a + move #>$0,y0 + move #>15870,x0 + tst a + move x0,b + tge y0,b + add b,a + move x:(r7+$00),x0 + add x0,a + move a1,x:(r7+$0b) +; The rate. + move x:(r7+$1d),a + tst a + beq gbch + move #>$1,x0 + cmp x0,a + beq gbsu + move x:(r7+$1e),a + tst a + bne gba1 + move x:(r7+$0a),a + and #>$3,a + lua (r7+$28),r1 + bra gbat +gba1: + move #>$1,x0 + cmp x0,a + bne gba2 + move x:(r7+$0a),a + and #>$3,a + move a1,x0 + move #>$3,a + sub x0,a + lua (r7+$36),r1 + bra gbat +gba2: + move #>$2,x0 + cmp x0,a + bne gba3 + move x:(r7+$0a),a + and #>$3,a + lua (r7+$3a),r1 + bra gbat +gba3: + bsr gbrn + move #>$4,y1 + mpy x0,y1,a + lua (r7+$28),r1 +gbat: + move a1,n1 + move #>$ffffff,m1 + nop + move x:(r1+n1),x0 + move x0,x:(r7+$0f) + bra gbrd +gbch: + move #>$200000,x0 + move x0,x:(r7+$0f) + move x:(r7+$1e),a + move #>$1,x0 + cmp x0,a + beq gbc1 + move #>$3,x0 + cmp x0,a + beq gbc1 + move #>$2,x0 + cmp x0,a + bne gbrd + move #>$f00000,x0 + move x0,x:(r7+$0f) + bra gbrd +gbc1: + bsr gbrn + move #>$4,y1 + mpy x0,y1,a + move a1,n1 + lua (r7+$24),r1 + move #>$ffffff,m1 + nop + move x:(r1+n1),x0 + move x0,x:(r7+$0f) + bra gbrd +gbsu: + move x:(r7+$1e),a + move #>$2,x0 + cmp x0,a + beq gbs2 + move #>$3,x0 + cmp x0,a + beq gbs3 + move #>$200000,x0 + move x0,x:(r7+$0f) + bra gbrd +gbs2: + move #>$e00000,x0 + move x0,x:(r7+$0f) + bra gbrd +gbs3: + move x:(r7+$0a),a + tst a + move #>$200000,x0 + beq gbs4 + move x:(r7+$0f),x0 + move #>$5fe443,y1 + mpy x0,y1,a + move a,x0 +gbs4: + move x0,x:(r7+$0f) +; The position (reversed: from the end), the phase and its step. +gbrd: +; RAND: a random pitch, and half as often reversed. + move x:(r7+$4f),a + tst a + beq gbq9 + bsr gbrn + move x:(r7+$4f),a + cmp x0,a + ble gbq1 + bsr gbrn + move #>$4,y1 + mpy x0,y1,a + move a1,n1 + lua (r7+$24),r1 + move #>$ffffff,m1 + nop + move x:(r1+n1),x0 + move x0,x:(r7+$0f) +gbq1: + bsr gbrn + move x:(r7+$4f),a + asr #1,a,a + cmp x0,a + ble gbq9 + move x:(r7+$0f),a + neg a + move a,x:(r7+$0f) +gbq9: + clr a + move a,x:(r7+$0e) + move a,x:(r7+$10) + move x:(r7+$0f),b + tst b + bpl gbp1 + move x:(r7+$0c),a + sub #>$1,a +gbp1: + move a1,x:(r7+$0d) + move #>$0,a + move #>$800000,a0 + move x:(r7+$0c),x0 + bsr gbdi + move x0,x:(r7+$11) +; The fade (CHOP C: twice SHAP's, at most the full swell), the gate, the crush. + move x:(r7+$20),x0 + move x:(r7+$1d),a + tst a + bne gbm1 + move x:(r7+$1e),a + move #>$2,y0 + cmp y0,a + bne gbm1 + move x0,a + asr #$1,a,a + move #>$40000,y0 + cmp y0,a + tlt y0,a + move a1,x0 +gbm1: + move x0,x:(r7+$12) + move #>$400000,x0 + move x:(r7+$1d),a + move #>$1,y0 + cmp y0,a + bne gbg1 + move x:(r7+$1e),a + cmp y0,a + bne gbg1 + move #>$100000,x0 +gbg1: + move x0,x:(r7+$13) + move #>$ffffff,x0 + move x:(r7+$1e),a + move #>$3,y0 + cmp y0,a + bne gbk1 + move #>$fe0000,x0 +gbk1: + move x0,x:(r7+$14) +; 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) + move x:(r7+$16),x0 + move x0,x:(r7+$19) + rts + +; The next LFSR word; x0 = a random fraction. +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/glitchbox/evidence/cpu-price.json b/sdk/octatrack/modules/glitchbox/evidence/cpu-price.json new file mode 100644 index 0000000000..d579e1d306 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/evidence/cpu-price.json @@ -0,0 +1,146 @@ +{ + "module": "glitchbox", + "version": "0.1.0-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-05T00:53:48.892Z", + "result": { + "id": "glitchbox", + "version": "0.1.0-experimental", + "packageSha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0", + "before": { + "frame": 54.2, + "frameMax": 91.7, + "frames": 67256, + "skipped": 0, + "cpu": 68.9, + "dsp1to4": 39.6, + "dsp5to8": 49.2, + "dsp1to4Peak": 41.5, + "dsp5to8Peak": 50.2, + "readings": 3, + "spread": { + "frame": 0, + "cpu": 0.6, + "dsp1to4": 0, + "dsp5to8": 0, + "frameMax": 5.3, + "dsp1to4Peak": 0, + "dsp5to8Peak": 0.5 + } + }, + "atRest": { + "frame": 54.2, + "frameMax": 87.4, + "frames": 67282, + "skipped": 0, + "cpu": 69, + "dsp1to4": 39.6, + "dsp5to8": 49.1, + "dsp1to4Peak": 41.4, + "dsp5to8Peak": 50.2, + "readings": 3, + "spread": { + "frame": 0, + "cpu": 0.4, + "dsp1to4": 0, + "dsp5to8": 0.2, + "frameMax": 1.9, + "dsp1to4Peak": 0.1, + "dsp5to8Peak": 0.5 + } + }, + "atRestAdds": { + "frame": 0, + "cpu": 0.1, + "dsp1to4": 0, + "dsp5to8": -0.1, + "dsp1to4Peak": -0.1, + "dsp5to8Peak": 0 + }, + "inUse": { + "frame": 53.2, + "frameMax": 92.8, + "frames": 67242, + "skipped": 0, + "cpu": 68, + "dsp1to4": 47, + "dsp5to8": 49.2, + "dsp1to4Peak": 49.7, + "dsp5to8Peak": 50.2, + "readings": 3, + "spread": { + "frame": 0.8, + "cpu": 1.6, + "dsp1to4": 0.8, + "dsp5to8": 0, + "frameMax": 5.4, + "dsp1to4Peak": 0.4, + "dsp5to8Peak": 0.5 + } + }, + "inUseAdds": { + "frame": -1, + "cpu": -0.9, + "dsp1to4": 7.4, + "dsp5to8": 0, + "dsp1to4Peak": 8.2, + "dsp5to8Peak": 0 + }, + "inUseOn": "T1 FX2", + "curve": { + "tracks": [ + "T1", + "T3", + "T6", + "T7" + ], + "points": [ + 87.4, + 88.3, + 85.6, + 92, + 85 + ], + "adds": [ + 0.9, + -1.8, + 4.6, + -2.4 + ], + "first": 4.6, + "each": 4.6, + "notes": [], + "admission": [ + { + "pattern": "empty", + "number": 2, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 36.4, + "frame": 27.9, + "dropped": 0, + "stalls": 0 + }, + { + "pattern": "medium", + "number": 1, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 87, + "frame": 53.7, + "dropped": 0, + "stalls": 0 + } + ] + }, + "rolledBack": true + } +} diff --git a/sdk/octatrack/modules/glitchbox/evidence/frame-cost.json b/sdk/octatrack/modules/glitchbox/evidence/frame-cost.json new file mode 100644 index 0000000000..70d5dde6b4 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/evidence/frame-cost.json @@ -0,0 +1,55 @@ +{ + "module": "glitchbox", + "version": "0.1.0-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-05T00:53:48.892Z", + "tracks": [ + "T1", + "T3", + "T6", + "T7" + ], + "rest": 0, + "first": 4.6, + "each": 4.6, + "points": [ + 87.4, + 88.3, + 85.6, + 92, + 85 + ], + "adds": [ + 0.9, + -1.8, + 4.6, + -2.4 + ], + "admission": [ + { + "pattern": "empty", + "number": 2, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 36.4, + "frame": 27.9, + "dropped": 0, + "stalls": 0 + }, + { + "pattern": "medium", + "number": 1, + "track": "T1", + "seconds": 8, + "admitted": true, + "frameMax": 87, + "frame": 53.7, + "dropped": 0, + "stalls": 0 + } + ], + "notes": [] +} diff --git a/sdk/octatrack/modules/glitchbox/evidence/performance.json b/sdk/octatrack/modules/glitchbox/evidence/performance.json new file mode 100644 index 0000000000..9054f53ba0 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/evidence/performance.json @@ -0,0 +1,34 @@ +{ + "schema": 1, + "module": "glitchbox", + "version": "0.1.0-experimental", + "sourceSha256": "6e9a6277752d401afd906a11a10bdf7780b54069742d8926b154a786b1b2ab33", + "kind": "dsp", + "cycles": { + "unit": "instructions/sample", + "static": 198, + "measured": 231.7, + "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, 198 words; it has no branch, bsr, nested do or rep, so every sample runs every word. The per-call setup (knob decode, tempo and slice length, the silence watch, DIRT's tables, and at a slice boundary the event and the next repeat's set-up with its divisions) runs once a call and is not in this floor. measured: perf.py, executed instructions from dsp_host's meter, one instance on verify.py's synthetic image, 4,096 blocks of 16 frames of stereo noise: the defaults, the dearest setting for each TYPE (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND, DGRD 127, RPT 8, VAR D) and a moving pattern (every slot swept, TYPE and VAR stepped, all jumped every 37 blocks), each unsplit and with a trig split at every position 1-15: 80 cases. Unsplit: defaults 204.7, moving 212.1, dearest CHOP 211.7, STUT 208.0, ARPG 208.5; worst 231.7 with a split of 10 frames at the dearest CHOP setting, where the per-call setup runs twice a block. Executed instructions in dsp_host, not chip cycles; no stalls modelled." + }, + "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 replays a captured ring in slices; SPRING REV is the cost target for a new FX and, like Glitchbox, reads and writes a delay buffer every sample. Glitchbox's worst, 231.70, is 0.74x SPRING REV's 314.19 and 0.70x DJ EQ's 330.94; unsplit 212.1 against 257.50 and 293.38. Per sample it writes the mono sum into a 15,870-word ring, reads two words for an interpolated replay, crushes, holds and drives it, shapes it with two envelopes (the whole repeat's for the dry's duck, the glitch's own for STUT B's gate), fades a tail, glides MIX and pans the glitch left and right. On the author's MKII one instance raised the T1-T4 DSP load 7.7 points and the T5-T8 load 7.4 (TESTING.md)." + }, + "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 Glitchbox 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 -paramfile (every slot swept by triangles with a random jump every 37 blocks, TIME, RPT, TYPE and VAR stepped); trig splits of 1, 3, 7, 8, 12 and 15 frames on six instances; -guard 0x4000 -guard-shared, -dirty 0x5a. dsp_host hands every instance the same allocator entry, so the eight rings overlap here (on a unit each slot has its own buffer). Result: host exit 0, no hang; 0 stray write regions and 0 clobbers; per-core peaks 891.2 and 835.5 executed instructions/sample with four instances each. The instance at core 1 position 2 is where dsp_host writes its own word a block. It exercises the DSP side only: the firmware's LFO and lock delivery, Part switches and the ColdFire side are not in it." + } +} diff --git a/sdk/octatrack/modules/glitchbox/manifest.py b/sdk/octatrack/modules/glitchbox/manifest.py new file mode 100644 index 0000000000..82f895217f --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/manifest.py @@ -0,0 +1,87 @@ +"""GLITCHBOX -- an original glitch 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 glitches; a glitch fills it with RPT repeats from the ring as CHOP, STUT or +ARPG (TYPE, page 2), each with four variations (VAR, page 2). SHAP sets the repeats' fades, MIX how far a glitch replaces the track (dry between glitches up to 96, the glitches alone at 127), the +blend with the dry track. Timing follows the tempo word only: slices are free-running at the tempo, not locked +to the pattern's steps or swing (issue #2491 asks the owner for a step clock for effects). + +verify.py holds engine.asm to reference.py's model bit for bit in dsp_host. Earlier builds ran in short RAM trials on the +author's unit, and the test procedure passed there on package 9dec7880 (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("glitchbox_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="glitchbox", + key="GLITCHBOX", + kind=Kind.DSP_EFFECT, + doc="Glitch effect on FX2: CHOP, STUT, ARPG slices 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 (1ae4be59) and the author's Keep, Part reload and power cycle", + + menu=MenuEntry( + fx2_id=0x0a, + donor_desc=0x400d58b8, # DARK REV; every drawn slot is written below + abbr=b"GLCH", + fullname=b"GLITCHBOX", + 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; glitches 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 glitch: 0 none, 127 about 70 %"), + Param(b"SHAP", 32, 128, active=True, formatter=P, + doc="each repeat's fade: 1/64 of it at 0, rising evenly to a full swell"), + Param(b"RPT", 3, 8, active=True, formatter=W, labels=tuple(str(i) for i in range(1, 9)), + doc="repeats within a glitched slice: 1 plays it once, 8 rolls eighths of it"), + Param(b"MIX", 64, 128, active=True, formatter=P, + doc="how far a glitch takes over: 96 replaces the track at each repeat's peak; 127 the glitches alone"), + Param(b"TAIL", 64, 128, active=True, formatter=P, + doc="after a glitch its last repeat echoes on and fades: 0 none, 127 about 3 s"), + Param(b"TYPE", 0, 3, active=True, formatter=S, labels=_ref.TYPE_NAMES, + doc="CHOP reorders pieces, STUT ratchets faster and faster, ARPG steps through pitches"), + Param(b"DIRT", 0, 128, active=True, formatter=P, + doc="grit on the glitch: 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: plain, then pitched wide, gated or minor, reversed or two-octave leaps, crushed hard"), + Param(b"WIDE", 0, 128, active=True, formatter=P, + doc="ping-pong: repeats alternate left and right this far; with RAND anywhere in it"), + Param(b"RAND", 0, 128, active=True, formatter=P, + doc="chaos: random repeat counts, pitches, reversals 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/glitchbox/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/glitchbox/verify.py", remix_arg=False),), + # the shortest slices, a glitch every slice, eight repeats, the crushed variation, full wet + dear={"TIME": 0, "ACT": 127, "SHAP": 127, "RPT": 7, "MIX": 127, "TAIL": 127, "TYPE": 0, "DIRT": 127, "VAR": 3, + "WIDE": 127, "RAND": 127, "DGRD": 127}, +) diff --git a/sdk/octatrack/modules/glitchbox/media/LICENSE.md b/sdk/octatrack/modules/glitchbox/media/LICENSE.md new file mode 100644 index 0000000000..a658e75710 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/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 1 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/glitchbox/media/capture.json b/sdk/octatrack/modules/glitchbox/media/capture.json new file mode 100644 index 0000000000..3374b7c6e4 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/media/capture.json @@ -0,0 +1,22 @@ +{ + "firmware": "1.40C", + "baseIdentity": "ddb56b72d1ac0b606f5969bc4984b6b22662e87d1b1d56a480ef0da1aac53b49", + "packageSha256": "9dec78808d1dcaec2b275ceb57782c2fcbc358cd566d02f9a67f7fb440de609c", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Glitchbox (package 9dec7880) kept beside 25 modules; the author's project, pattern A01, a track's FX2 on Glitchbox with TYPE STUT 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 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": "adde3e62627b7c351adf0acc65e8fe39bfafb168ae9e427d026823493192a18a", + "keys": "TRACK, FUNC+FX2", + "shows": "FX2 SETUP: Glitchbox selected at the end of the effect list; TYPE (STUT), DIRT, VAR, WIDE, RAND and DGRD" + }, + { + "path": "media/ot-controls.png", + "sha256": "8e0e6438138f7fe5916f07486187041a71311b973af2803414fc651b28122b06", + "keys": "FX2", + "shows": "FX2 main page: TIME, ACT, SHAP, RPT, MIX, TAIL" + } + ], + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237" +} diff --git a/sdk/octatrack/modules/glitchbox/media/ot-controls.png b/sdk/octatrack/modules/glitchbox/media/ot-controls.png new file mode 100644 index 0000000000..a6dd1eed51 Binary files /dev/null and b/sdk/octatrack/modules/glitchbox/media/ot-controls.png differ diff --git a/sdk/octatrack/modules/glitchbox/media/ot-location.png b/sdk/octatrack/modules/glitchbox/media/ot-location.png new file mode 100644 index 0000000000..442cd7f0b3 Binary files /dev/null and b/sdk/octatrack/modules/glitchbox/media/ot-location.png differ diff --git a/sdk/octatrack/modules/glitchbox/octamod.module.json b/sdk/octatrack/modules/glitchbox/octamod.module.json new file mode 100644 index 0000000000..013682f5ff --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/octamod.module.json @@ -0,0 +1,376 @@ +{ + "schemaVersion": 2, + "id": "glitchbox", + "key": "GLITCHBOX", + "name": "Glitchbox", + "version": "0.1.0-experimental", + "category": "effects", + "author": { + "github": "jrs1717", + "credits": [ + "jrs1717" + ] + }, + "nativeManifest": "manifest.py", + "presentation": { + "label": "GLITCH", + "family": "Glitch", + "summary": "A glitch effect for FX2 of any track: it captures what you play and throws slices of it back as chops, stutters or pitch-stepped arpeggios, at the project tempo.", + "overview": "Glitchbox keeps the last third of a second of the track. At every slice, a note value at the project's tempo, ACT decides whether that slice glitches. A glitched slice is filled with RPT repeats taken from what was just played: CHOP replays recent pieces in a new order; STUT ratchets the start of the slice before, each repeat half as long as the last; ARPG steps it through arpeggios and octave leaps. Each type has four variations, from plain to pitched, reversed and crushed, SHAP sets how hard or soft each repeat fades in and out, and MIX blends the glitches with the dry track; between glitches the glitch side is silent. Slice timing follows the project tempo but not yet the pattern's steps or swing.", + "highlights": [ + "Three glitch types, CHOP, STUT and ARPG, each with four variations", + "Slices of 1/64 to 1/2 note at the project tempo; ACT sets how many glitch, RPT how many repeats fill each", + "MIX sets how far each glitch takes over: the track plays dry between glitches up to 96, and 127 is the glitches alone", + "TAIL lets each glitch echo on and fade, up to about 3 seconds", + "A second page for industrial grit: DIRT, WIDE ping-pong, RAND chaos and DGRD degrading tails" + ], + "usage": [ + "Select a track, hold FUNC and press FX2, turn LEVEL to GLITCHBOX and press YES. Press FX2 for TIME, ACT, SHAP, RPT, MIX and TAIL; hold FUNC and press it again for TYPE and VAR.", + "Start with TYPE CHOP, VAR A, TIME 1/16, ACT 64 and MIX 64 on a drum loop, then raise ACT for more glitches and MIX for less of the dry track." + ] + }, + "controls": [ + { + "name": "TIME", + "default": 2, + "count": 6, + "doc": "Slice length as a note value at the project's tempo, 1/64 to 1/2. Glitches start only on this grid and last the whole slice; a slice longer than 179 ms plays as 2, 4, 8, 16 or 32 equal chunks, each with its own repeats.", + "labels": [ + "1/64", + "1/32", + "1/16", + "1/8", + "1/4", + "1/2" + ] + }, + { + "name": "ACT", + "default": 64, + "count": 128, + "doc": "Activity: the share of slices that glitch, rising evenly from none at 0 to about 70 % at 127.", + "labels": null + }, + { + "name": "SHAP", + "default": 32, + "count": 128, + "doc": "Shape of each repeat: its fade in and out is 1/64 of the repeat at 0, rising evenly to a quarter at 64 and a full swell (half in, half out) at 127.", + "labels": null + }, + { + "name": "RPT", + "default": 3, + "count": 8, + "doc": "Repeats within a glitched slice, 1 to 8. CHOP and ARPG cut the slice into equal repeats (in ARPG, an arpeggio of that many notes); STUT makes each repeat half as long as the last, a ratchet that speeds up.", + "labels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "name": "MIX", + "default": 64, + "count": 128, + "doc": "How much a glitch takes over. Up to 96 the track plays dry between glitches and ducks under each repeat as it swells, coming back in its fades: 0 the track alone, 96 the repeat replaces it at its peak. From 96 to 127 the track fades out everywhere: 127 is the glitches alone, silent between them.", + "labels": null + }, + { + "name": "TAIL", + "default": 64, + "count": 128, + "doc": "After a glitch, its last repeat keeps echoing and fades out: 0 no tail, about a third of a second at 64, about 3 seconds at 127. The next glitch cuts it.", + "labels": null + }, + { + "name": "TYPE", + "default": 0, + "count": 3, + "doc": "CHOP replays recent pieces in a new order; STUT ratchets the start of the chunk before, faster and faster; ARPG steps it through pitches.", + "labels": [ + "CHOP", + "STUT", + "ARPG" + ] + }, + { + "name": "DIRT", + "default": 0, + "count": 128, + "doc": "Grit on the glitch only: sample-rate reduction (down to 1/16), a harder bit crush and a clipping drive. 0 clean.", + "labels": null + }, + { + "name": "VAR", + "default": 0, + "count": 4, + "doc": "Variation. CHOP: plain, pitched (0.25, 0.5, 2 or 3x), reversed an octave down with fades twice as long, pitched and crushed to 7 bits. STUT: plain, gated to each repeat's first eighth, reversed, five semitones lower each repeat and crushed. ARPG: major arpeggio up, minor arpeggio down, leaps over two octaves, random major steps and crushed.", + "labels": [ + "A", + "B", + "C", + "D" + ] + }, + { + "name": "WIDE", + "default": 0, + "count": 128, + "doc": "Ping-pong: each repeat alternates left and right, as far as WIDE; with RAND, repeats land anywhere in that width. 0 centred.", + "labels": null + }, + { + "name": "RAND", + "default": 0, + "count": 128, + "doc": "Chaos: the chance that a glitch takes a random number of repeats, and that each repeat takes a random pitch, a reversal (half as often) and a random place. 0 as set.", + "labels": null + }, + { + "name": "DGRD", + "default": 0, + "count": 128, + "doc": "Degrade: a tail grows dirtier as it fades, adding up to this much DIRT by its end. 0 a clean fade.", + "labels": null + } + ], + "compatibility": { + "firmware": "1.40C", + "location": "FX2", + "conflicts": [ + "analog-bassdrum" + ], + "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 replay is the track's mono sum on both sides.", + "Slices 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.", + "Not run on a unit: Glitchbox beside Sidechain Compressor (its key window starts right after the ring), and TIME 1/2 at 30 BPM; each is checked only in dsp_host.", + "Analog BD currently requires stock DSP effects; Glitchbox is declared incompatible with it like other custom DSP effects." + ], + "effectId": 10 + }, + "resources": { + "recorded": "2026-12-05", + "storage": { + "label": "DSP program / state", + "display": "1405 words / 96-word state", + "value": null, + "unit": "see display", + "method": "static", + "conditions": "The USB package 1ae4be59 (ABI 6): 1,405 program words on each DSP core it runs on; 96 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,200 bytes of ColdFire code and data (the effect's descriptor and menu), no bss.", + "source": "TESTING.md" + }, + "processing": { + "label": "DSP instruction peak", + "display": "232 instructions/sample per instance", + "value": null, + "unit": "see display", + "method": "emulator", + "conditions": "perf:audit record (perf.py in dsp_host): worst 231.7 executed instructions a sample at the dearest CHOP setting with a trig split of 10 frames, unsplit 204.7 to 212.1, static loop floor 198; SPRING REV 314.19 and DJ EQ, the dearest stock effect, 330.94 on the same stock image. Executed instructions, not chip cycles. On the author's MKII the DSP load of T1-T4 rose 7.6 to 7.9 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.2 % before, 54.2 % installed and used nowhere, 53.2 % on T1 FX2; CPU meter 68.9 % before, 69 % at rest, 68 % 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, played by device:price on the test pattern, read first 4.3 and each 3.2 points, admitted on the empty and the medium pattern.", + "source": "evidence/cpu-price.json" + }, + "dsp": { + "level": "moderate", + "basis": "measured-comparison", + "rationale": "231.7 executed instructions a sample worst case (0.74 of SPRING REV's 314.19, 0.70 of DJ EQ's 330.94): a ring write, an interpolated two-word read, crush, hold and drive, two envelopes, a tail, MIX and a pan, every sample. Four a core is 928 of 3,120. On the unit one instance raised its core's load about 8 points. Chip timing is unmeasured.", + "source": "evidence/performance.json" + }, + "memory": { + "level": "low", + "basis": "source-estimate", + "rationale": "Per instance 288 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); 5,271 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 1ae4be59 (the grid-drift fix) built from c7724e21 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 CHOP and ARPG while playing, TYPE changed mid-glitch, the ring-freeze path); the author kept 1ae4be59 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, including TIME 1/2 at 30 BPM, a glitch due on a frozen ring and a chunk's repeats adding up to the chunk; perf:audit worst 231.7 instructions a sample.", + "hardwareStatus": "reported", + "evidenceRevision": "c7724e2126f182d86543b3f3458489a87610bc48", + "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.0-experimental", + "sourceSha256": "fe424a6d288e41134a327804a576a3e20d6c751a7f909156d2f0a2c0baf58702", + "cycles": [ + { + "processor": "dsp", + "worstCase": 232, + "maxConfiguration": 928, + "maxInstances": 8, + "budget": 3120, + "unit": "cycles/sample", + "method": "emulator", + "conditions": { + "parameterExtremes": "232 cycles a sample covers the measured worst case in dsp_host, 231.7 executed instructions at the dearest CHOP setting (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND and DGRD at 127, RPT 8, VAR D) with a trig split of 10 frames (the per-call setup runs twice a block), over the defaults, the dearest setting for each TYPE and a moving pattern, unsplit and with a split at every position 1-15 (perf.py, 80 cases). The static floor of the loop alone is 198. 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 glitching 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 repeat; their cost is inside the measured per-call setup. verify.py sweeps both while glitching bit for bit; perf.py's moving case steps them; on the unit 12 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 232 = 928 of the 3,120 cycles a core can spend a sample. Stress in dsp_host: 4 a core, per-core peaks 891.2 and 835.5. 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": 1405, + "wordBits": 24, + "bytes": 4215, + "scope": "shared" + }, + { + "name": "DSP state per instance, the package's state words", + "space": "dsp-x", + "words": 96, + "wordBits": 24, + "bytes": 288, + "scope": "instance" + }, + { + "name": "ColdFire code and data of the USB package", + "space": "cpu-ram", + "words": 1200, + "wordBits": 8, + "bytes": 1200, + "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": 47898, + "sharedBytes": 5415, + "maxInstances": 8, + "totalBytes": 388599, + "conditions": "From the header of the USB package 1ae4be59 (ABI 6), checked against the source: the effect uses its own r7 block X:(r7+$00..$5f) (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": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0", + "hardware": { + "kind": "functional", + "status": "reported", + "model": "MKII", + "testedOn": "2026-12-05", + "tester": "jrs1717", + "sourceRevision": "c7724e2126f182d86543b3f3458489a87610bc48", + "imageSha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0", + "summary": "On the author's Octatrack MKII, OS 1.40C, 5 December 2026 (UTC): npm run test:procedure on package 1ae4be59 (the grid-drift fix) built from c7724e21, 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, first 4.6 and each 4.6, admitted on the empty and the medium pattern, longest frame 87 %) and putting the Part back; by hand, on T1 and T5 FX2 while playing, CHOP and ARPG at RPT 2 and 4, TYPE changed mid-glitch, and the ring-freeze path (TAIL 127, RPT 1) at TIME 1/8 and 1/2, with no stall, error or crash. The author's stage on the same package, on the flashed base: kept in place of 8d67a364 beside 20 modules, played, the Part saved and reloaded and the unit power-cycled; reported \"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).", + "Not set exactly on the unit: TIME 1/4 and RPT 3, 5 and 7 (the stepped knobs' encoder acceleration overshot); verify.py holds them bit for bit in dsp_host and test_a_chunks_repeats_add_up_to_the_chunk covers RPT 3, 5 and 7.", + "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.", + "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 9dec7880; no control or label changed since." + ], + "report": "TESTING.md" + }, + "documentation": { + "tutorial": { + "title": "Quick tutorial", + "steps": [ + "Put Glitchbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to GLITCHBOX at the end of the list and press YES. At the defaults it is CHOP A at 1/16, glitching about a third of the slices.", + "Raise ACT for more glitched slices, RPT for faster rolls inside them, and change TIME for longer or shorter slices.", + "Hold FUNC and press FX2, set TYPE to STUT or ARPG and VAR to B, C or D, and play the same loop.", + "Turn MIX to about 96 so each glitch replaces the track, to 127 for the glitches alone, or to 0 to hear the track alone again." + ] + }, + "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 glitch effects in general; 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: Glitchbox is chosen at the end of the effect list, with TYPE (here STUT), DIRT and VAR on the top row and WIDE, RAND and DGRD below.", + "alt": "FX2 SETUP page with an effect list ending in Glitchbox, selected; knobs labelled STUT, DIRT, VAR, WIDE, RAND and DGRD.", + "otUi": { + "page": "FX2 SETUP", + "shows": "location", + "firmware": "1.40C", + "moduleVersion": "0.1.0-experimental", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Glitchbox (package 9dec7880) kept beside 25 modules; the author's project, pattern A01, a track's FX2 on Glitchbox with TYPE STUT 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 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 Glitchbox with knobs TIME, ACT, SHAP, RPT, MIX and TAIL.", + "otUi": { + "page": "FX2", + "shows": "controls", + "firmware": "1.40C", + "moduleVersion": "0.1.0-experimental", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Glitchbox (package 9dec7880) kept beside 25 modules; the author's project, pattern A01, a track's FX2 on Glitchbox with TYPE STUT 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 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 GLITCHBOX 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/glitchbox/perf.py b/sdk/octatrack/modules/glitchbox/perf.py new file mode 100644 index 0000000000..a78976e5cb --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/perf.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Glitchbox'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("glitchbox-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/glitchbox/presentation/thumbnail.svg b/sdk/octatrack/modules/glitchbox/presentation/thumbnail.svg new file mode 100644 index 0000000000..a8368c2a9d --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/presentation/thumbnail.svg @@ -0,0 +1,51 @@ + + Glitchbox — slices of the track, thrown back three ways + Original illustration: one slice of a track drawn faint across each panel, and what each type makes of it. CHOP replays its pieces in a new order; STUT ratchets its start, each repeat half as long as the last; ARPG steps a piece up through pitches. A conceptual drawing, not a measured render or an Octatrack screenshot. + + + + GLITCHBOX + FX2 + TIME · ACT · RPT + MIX · TAIL + CHOP + STUT + ARPG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2413 + + diff --git a/sdk/octatrack/modules/glitchbox/reference.py b/sdk/octatrack/modules/glitchbox/reference.py new file mode 100644 index 0000000000..b5a2c0820e --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/reference.py @@ -0,0 +1,443 @@ +"""Glitchbox'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 replay RPT slices of the ring as CHOP (one of +the last slices), STUT (the latest, rolled, cut, reversed or slowing) or ARPG (the latest, stepped through +pitches), with variations A-D. 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, 3, 64, 64, 0, 0, 0, 0, 0, 0) +DEAREST = (0, 127, 127, 7, 127, 127, 0, 127, 3, 127, 127, 127) +TYPE_NAMES = ("CHOP", "STUT", "ARPG") +VAR_NAMES = ("A", "B", "C", "D") +TIME_LABELS = ("1/64", "1/32", "1/16", "1/8", "1/4", "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)) +T0 = (0x080000, 0x100000, 0x400000, 0x600000) # random pitch: 0.25, 0.5, 2, 3 (Q21) +T1 = (0x200000, 0x285146, 0x2ff222, 0x400000) # major arpeggio: 1, a major third, a fifth, an octave (Q21) +T2 = (0x200000, 0x260dfc, 0x2ff222, 0x400000) # minor arpeggio: 1, a minor third, a fifth, an octave +T3 = (0x400000, 0x100000, 0x400000, 0x080000) # leaps over two octaves: 2, 0.5, 2, 0.25 +ACT_SCALE = 0x5a0000 # ACT 127 glitches 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 +CRUSH = 0xfe0000 # D's crush: 7 bits of the quarter-scale replay +TAIL_MIN, TAIL_RANGE = 0x1b6, 0x64ea # the tail's decay a sample: about 3 s to -60 dB at TAIL 127, 50 ms near 0 +TAIL_END = 0x2000 # -72 dB: the tail is over +DECAY = 0x5fe443 # five semitones down a repeat (Q23) +REVERSE = 0xe00000 # -1 (Q21) +REVERSE_SLOW = 0xf00000 # -1/2: CHOP C, reversed an octave down +SILENT, SILENT_STOP, SILENT_MAX = 44100, 176400, 0x100000 # the silence watch: no new glitch, then nothing +SEED = 0x123456 +MAKEUP = 0x7fffff # the glitch at half the mono sum: x 0.99999 then x 2, level with a mono sample +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)], + "T1": [round(2 ** (s / 12) * (1 << 21)) for s in (0, 4, 7, 12)], + "T2": [round(2 ** (s / 12) * (1 << 21)) for s in (0, 3, 7, 12)], + "T3": [round(r * (1 << 21)) for r in (2, 0.5, 2, 0.25)], + "DECAY": round(2 ** (-5 / 12) * 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) + + +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] * 0x60 + self.ring = ring if ring is not None else [0] * R + x = self.x + x[0x00] = x[0x0b] = base + x[0x01] = 1 if ld(base) - ld(0x4000) >= 0 else 0 + x[0x03] = 1 + x[0x15] = x[0x2d] = 0x7fffff + x[0x05] = SEED + x[0x24:0x28] = list(T0) + x[0x28:0x2c] = list(T1) + x[0x36:0x3a] = list(T2) + x[0x3a:0x3e] = list(T3) + 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 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[0x20] = div((0x1ffff << 24) | 0xfffffe, 0x20000 + hi(mpy(p[0x2] & 0x7fffff, 0x3e0000))) + x[0x21] = stepped(p[0x3], 7) + 1 + t5 = p[0x5] & 0x7fffff + s = lim(ld(0x7fffff) - ld(t5)) + c = lim(mpy(lim(mpy(s, lim(mpy(s, s)))), TAIL_RANGE) + ld(TAIL_MIN)) + x[0x32] = 0 if t5 < 0x10000 else c + 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: + x[0x18] = x[0x12] = x[0x17] = 0 + x[0x15] = x[0x2d] = 0x7fffff + elif x[0x03]: + d = (x[0x0b] - x[0x00]) - x[0x02] + if d < 0: + d += R + if d <= 32: + 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 glitch, no tail, record again + x[0x18] = x[0x12] = x[0x06] = x[0x17] = x[0x04] = 0 + x[0x15] = x[0x2d] = 0x7fffff + x[0x03] = 1 + if x[0x07] >= x[0x19]: + self.event() + # P: 1 while a glitch plays, else 0 (a tail echoes over the whole track) + x[0x3f] = 0x7fffff if x[0x06] else 0 + # 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] + n = len(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 event(self): + x = self.x + x[0x07] -= x[0x19] + 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 glitch goes on through its slice of TIME + self.start() + return + x[0x06] = 0 # the glitch is over + if x[0x32] == 0: + x[0x12] = 0 + else: # its tail: the last repeat loops on, decaying + x[0x17] = x[0x32] + x[0x18] = 1 + x[0x2d] = 0x400000 + 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 + x[0x18] = x[0x12] = x[0x17] = x[0x04] = 0 + x[0x15] = x[0x2d] = 0x7fffff + 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 start(self): + x = self.x + x[0x06] = x[0x03] = 1 # a glitch always records: its window lies behind the writer + x[0x0a] = x[0x18] = x[0x17] = 0 + x[0x15] = x[0x2d] = 0x7fffff + x[0x45] = x[0x21] # RAND: a random number of repeats + if x[0x4f] and x[0x4f] - self.rand() > 0: + x[0x45] = hi(mpy(self.rand(), 8)) + 1 + x[0x09] = x[0x45] + x[0x35] = x[0x02] + x[0x34] = x[0x3e] = x[0x08] + x[0x16] = div(2 * x[0x08], x[0x45]) + x[0x0f] = 0x200000 + self.setrep() + + def setrep(self): + x = self.x + if x[0x1d] == 1: # STUT ratchets: half of what is left, or all of it + rem = x[0x3e] + lev = rem if (x[0x09] == 1 or rem < 128) else rem >> 1 + x[0x16] = lev + x[0x3e] = rem - lev + if x[0x3e] == 0: + x[0x09] = 1 + else: # CHOP and ARPG: the slice over RPT; the last, or one longer than what + if x[0x09] == 1 or x[0x3e] < x[0x16]: # is left (TYPE changed mid-glitch), takes what is left (no drift) + x[0x16] = x[0x3e] + x[0x3e] -= x[0x16] + if x[0x3e] == 0: + x[0x09] = 1 + lev, slice_ = x[0x16], x[0x34] + x[0x0c] = lev - 1 + off = slice_ + if x[0x1d] == 0: + jmax = 1 + for jj in (2, 3, 4): + if jj * lev <= x[0x04] and jj * lev + slice_ <= FRESH_MAX: + jmax = jj + else: + break + off = (hi(mpy(self.rand(), jmax)) + 1) * lev + s = x[0x35] - off + if s < 0: + s += R + x[0x0b] = x[0x00] + s + kind, var, k = x[0x1d], x[0x1e], x[0x0a] + if kind == 0: + x[0x0f] = 0x200000 + if var in (1, 3): + x[0x0f] = T0[hi(mpy(self.rand(), 4))] + elif var == 2: + x[0x0f] = REVERSE_SLOW + elif kind == 1: + if var == 2: + x[0x0f] = REVERSE + elif var == 3: + x[0x0f] = 0x200000 if k == 0 else lim(mpy(x[0x0f], DECAY)) + else: + x[0x0f] = 0x200000 + else: + if var == 0: + x[0x0f] = T1[k & 3] + elif var == 1: + x[0x0f] = T2[3 - (k & 3)] + elif var == 2: + x[0x0f] = T3[k & 3] + else: + x[0x0f] = T1[hi(mpy(self.rand(), 4))] + if x[0x4f]: # RAND: a random pitch, and half as often reversed + if x[0x4f] - self.rand() > 0: + x[0x0f] = T0[hi(mpy(self.rand(), 4))] + if (x[0x4f] >> 1) - self.rand() > 0: + x[0x0f] = lim(-ld(x[0x0f])) + x[0x0e] = x[0x10] = 0 + x[0x0d] = x[0x0c] - 1 if s24(x[0x0f]) < 0 else 0 + x[0x11] = div(0x800000, x[0x0c]) + am = x[0x20] + if kind == 0 and var == 2: + am = 0x40000 if (ld(am) >> 1) < ld(0x40000) else am >> 1 + x[0x12] = am + gate = kind == 1 and var == 1 + x[0x13] = 0x100000 if gate else 0x400000 + x[0x14] = s24(CRUSH) if var == 3 else s24(0xffffff) + p = x[0x4e] if k & 1 == 0 else lim(-ld(x[0x4e])) # WIDE: left, right, left; with RAND anywhere in it + if x[0x4f] and x[0x4f] - self.rand() > 0: + r = self.rand() + p = lim(mpy(lim(w56((ld(r) - ld(0x400000)) << 1)), x[0x4e])) + 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) + x[0x19] = lev + + 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 glitch'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[0x54] = max(x[0x54], abs(v)) # the mono ring word: what a glitch can replay + x[0x02] = (x[0x02] + x[0x03]) % R + a = ld(x[0x0d]) + (x[0x0e] & 0xffffff) + a = w56(a + (ld(x[0x0f]) >> 21)) + w = x[0x0c] + if a - ld(w) >= 0: + a -= ld(w) + if a < 0: + a += ld(w) + x[0x0d], x[0x0e] = hi(a), a & 0xffffff + fh = (a & 0xffffff) >> 1 + i = (x[0x0b] - x[0x00] + hi(a)) % R + s0, s1 = ring[i], ring[(i + 1) % R] + a = mac(ld(s0), lim(ld(s1) - ld(s0)), fh) + rep = s24((hi(a) & 0xffffff) & (x[0x46] & 0xffffff)) + x[0x30] = rep + 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] + u = ld(x[0x10]) + ld(x[0x11]) + if u - ld(x[0x2d]) >= 0: + u -= ld(x[0x2d]) + u = hi(u) + x[0x10] = u + e1 = lim(w56(mpy(u, x[0x12]) << 7)) + e2 = lim(w56(mpy(lim(ld(0x400000) - ld(u)), x[0x12]) << 7)) + env = min(e1, e2) # the whole repeat's envelope: the dry follows it + if env < 0: + env = 0 + # the dry ducks under the repeat as it swells and comes back in its fades + a = ld(0x7fffff) - ld(lim(mpy(lim(mpy(x[0x3f], env)), x[0x43]))) + if a - ld(x[0x44]) > 0: + a = ld(x[0x44]) + x[0x1c] = lim(a) + eg = lim(w56(mpy(lim(ld(x[0x13]) - ld(u)), x[0x12]) << 7)) + if env > eg: # the glitch's own: STUT B's gate cuts the glitch, not the duck + env = eg + if env < 0: + env = 0 + w = lim(w56(mpy(lim(mpy(rep, env)), MAKEUP) << 1)) + 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, x[0x15])) + x[0x31] = wet + x[0x15] = hi(ld(x[0x15]) - mpy(x[0x15], x[0x17])) + x[0x52] = wd = lim(mpy(wet, x[0x43])) + return (lim(mac(mpy(wd, x[0x4c]), left, x[0x1c])), lim(mac(mpy(wd, x[0x4d]), right, x[0x1c]))) + + +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/glitchbox/test_reference.py b/sdk/octatrack/modules/glitchbox/test_reference.py new file mode 100644 index 0000000000..c9c255dfe4 --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/test_reference.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python3 +"""Glitchbox's host test: no DSP tools, no firmware. reference.py's constants against their formulas, and the +model's behaviour: glitches happen as often as ACT asks, every TYPE and VAR changes the sound, 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 + + +def noise(seed, 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 glitching(row, seed=1): + """The share of samples where the output is not the dry track.""" + x = noise(seed) + out = R.render(x, x, {0: row})[0] + return sum(1 for a, b in zip(x, out) if a != b) / N, out + + +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.T1), n["T1"]) + self.assertEqual(list(R.T2), n["T2"]) + self.assertEqual(list(R.T3), n["T3"]) + self.assertEqual(R.DECAY, n["DECAY"]) + + 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.T1) + list(R.T2) + list(R.T3) + [R.DECAY, R.REVERSE, R.SEED, R.LFSR_TAPS, R.MAKEUP, R.ACT_SCALE, R.CRUSH, R.TAIL_MIN, R.TAIL_RANGE, R.TAIL_END, R.REVERSE_SLOW, R.THIRD, R.DRIVE] + list(R.MASKS): + self.assertIn(f"#>${w:06x}", text) + + def test_the_longest_slice_and_four_back_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), {0x13: (bpm * 24) << 8})) + self.assertEqual(m.x[0x08], want, (bpm, time)) + + def test_the_slowest_half_note_fits_the_ring(self): + # TIME 1/2 at 30 BPM, the Octatrack's slowest tempo: 4 s, played as 32 chunks within the ring's reach. + m = R.Model() + m.call([(0, 0)], R.pblock(knobs(time=5), {0x13: (30 * 24) << 8})) + self.assertLessEqual(m.x[0x08], R.LMAX) + self.assertEqual(m.x[0x40], 32) + + def test_a_glitch_never_starts_on_a_frozen_ring(self): + # TAIL 127, TIME 1/4, RPT 1: the tail freezes the ring; a glitch due then ends the tail and records again, + # so every glitch starts with the ring recording and a fresh chunk captured. + fs = 44100 + rnd = random.Random(8) + x = [round(0.5 * (rnd.random() * 2 - 1) * (R.Q - 1)) for _ in range(16 * (fs * 8 // 16))] + m, seen = R.Model(), [] + start = m.start + def watched(): + seen.append((m.x[0x03], m.x[0x04] >= m.x[0x08] or m.x[0x42] != m.x[0x40])) + start() + m.start = watched + froze = False + row = R.pblock(knobs(act=40, tail=127, time=4, rpt=0, type=1), {0x13: (95 * 24) << 8}) + 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) + self.assertTrue(all(cap and fresh for cap, fresh in seen), seen) + + def test_mix_zero_and_act_zero_leave_the_track(self): + # MIX 0 leaves the track within 1 LSB even while glitching; between glitches the track plays dry up to + # MIX 96, so ACT 0 at MIX 96 leaves it too. From 96 the dry fades out: at 127 ACT 0 is silence. + x = noise(1) + # (At MIX 96 exactly the dry's ceiling K is 4 (1 - 0.75) = 0x7ffffc, 4 LSB short of whole: 2 LSB here, -132 dB.) + for row, lsb in ((knobs(act=127, time=0, mix=0), 1), (knobs(act=0, mix=96), 2), (knobs(act=0, mix=95), 1)): + out = R.render(x, x, {0: row})[0] + self.assertLessEqual(max(abs(a - b) for a, b in zip(x, out)), lsb) + self.assertFalse(any(R.render(x, x, {0: knobs(act=0, mix=127)})[0])) + half = R.render(x, x, {0: knobs(act=0, mix=112)})[0] + ratio = sum(v * v for v in half) / sum(v * v for v in x) + self.assertGreater(ratio, 0.15) + self.assertLess(ratio, 0.4) + + def test_mix_127_cuts_the_dry_out_of_a_glitch(self): + # The input stops after 20,000 samples while glitches still replay it: what follows is the glitch alone, + # scaled by MIX (the dry is silence). + fs = 20000 + x = noise(1)[:fs] + [0] * (N - fs) + def energy(mix): + out = R.render(x, x, {0: knobs(act=127, time=0, mix=mix, tail=0)})[0] + return sum(v * v for v in out[fs:fs + 4000]) + self.assertEqual(energy(127), energy(96)) # the glitch is whole from MIX 96 + self.assertGreater(energy(96), 3 * energy(48)) + self.assertGreater(energy(48), 3 * energy(20)) + + def test_act_sets_how_often(self): + # At MIX 96 a glitch replaces the track at its peaks: count the samples that differ from it. + x = noise(1) + sounding = lambda act: sum(1 for a, b in zip(x, R.render(x, x, {0: knobs(act=act, time=0, mix=96, tail=0)})[0]) if abs(a - b) > 2) / N # noqa: E731 + low, high = sounding(20), sounding(127) + self.assertGreater(high, 0.5) + self.assertGreater(high, low) + + def test_every_type_and_variation_sounds_different(self): + outs = {} + for t in range(3): + for v in range(4): + outs[(t, v)] = glitching(knobs(act=127, time=0, type=t, var=v))[1] + 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_shap_changes_the_sound_evenly(self): + # The fade grows evenly with SHAP: 0, 64 and 127 sound clearly apart, and 64 sits between them. + x = noise(1) + outs = [R.render(x, x, {0: knobs(act=127, time=0, mix=127, shap=s)})[0] for s in (0, 64, 127)] + energy = [sum(v * v for v in o) / N for o in outs] + self.assertGreater(energy[0], energy[1] * 1.1) + self.assertGreater(energy[1], energy[2] * 1.1) + m = R.Model() + fades = [] + for s in (0, 64, 127): + m.call([(0, 0)], R.pblock(knobs(shap=s))) + fades.append(R.Q / m.x[0x20] / 64) + self.assertAlmostEqual(fades[0], 1 / 64, delta=0.001) + self.assertAlmostEqual(fades[1], 0.258, delta=0.01) + self.assertAlmostEqual(fades[2], 0.5, delta=0.01) + + def test_tail_rings_on_after_a_glitch(self): + # Glitches, then none: with TAIL 0 the track is dry after the last one; with TAIL 127 the echo keeps sounding + # over it, and longer than with TAIL 40. + x = noise(1) + def ringing(tail): + # glitches for 680 blocks (about four 1/32 slices), then none; listen from block 900, after the last + 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 * 900:], out[16 * 900:]) if abs(a - b) > 2) + none, short, long_ = ringing(0), ringing(40), ringing(127) + self.assertEqual(none, 0) + self.assertGreater(short, 0) + self.assertGreater(long_, short) + + def test_it_falls_silent_after_the_input_stops(self): + # 1 s of noise, then the transport stops: every type, TAIL at its longest, must fall silent within 6 s. + fs = 44100 + rnd = random.Random(3) + x = [round(0.5 * (rnd.random() * 2 - 1) * (R.Q - 1)) if i < fs else 0 for i in range(fs * 8)] + for t in range(3): + for act in (40, 127): + out = R.render(x, x, {0: knobs(act=act, tail=127, type=t, mix=127, time=2)})[0] + self.assertFalse(any(out[fs * 7:]), (t, act)) + + def test_everything_stops_within_four_seconds_of_silence(self): + # Each TYPE at VAR C (STUT C is the case that looped on the unit) at TIME 1/4, and STUT C at 1/2, + # TAIL 127, 95 BPM, the input stopping after 2 s: silent from 4.2 s after the stop (the silence watch), and + # the watch cleared once the input comes back at 6.4 s. verify.py holds all twelve TYPE and VAR at 1/4 to + # the same bit for bit in dsp_host. + fs = 44100 + rnd = random.Random(5) + n = 16 * (fs * 66 // 160) + x = [round(0.5 * (rnd.random() * 2 - 1) * (R.Q - 1)) if (i < 2 * fs or i >= int(6.4 * fs)) else 0 for i in range(n)] + cases = [(t, 2, 4) for t in range(3)] + [(1, 2, 5)] + for t, v, time in cases: + out = R.render(x, x, {0: knobs(act=64, tail=127, type=t, var=v, time=time, mix=127)}, + raw={0x13: (95 * 24) << 8})[0] + self.assertFalse(any(out[int(6.2 * fs):int(6.4 * fs)]), (t, v, time)) + m = R.Model() + row = R.pblock(knobs(act=127, time=0, tail=0)) + for b in range(0, n - 16, 16): + m.call([(x[b + i], x[b + i]) for i in range(16)], row) + if b == 6 * fs // 16 * 16: + self.assertGreaterEqual(m.x[0x53], R.SILENT) + self.assertEqual(m.x[0x53], 0) + + def test_a_glitch_is_level_with_a_mono_track(self): + # A steady mono tone, ACT 127 at MIX 127: the loudest glitch sample reaches the dry tone's peak. In a fade + # the dry comes back as the repeat leaves, so the two can sum a little over the peak: allow 10 %. + tone = [round(0.5 * (R.Q - 1) * math.sin(2 * math.pi * 220 * i / 44100)) for i in range(N)] + out = R.render(tone, tone, {0: knobs(act=127, mix=127, tail=0, shap=0, time=1)})[0] + self.assertGreater(max(abs(v) for v in out), 0.95 * max(abs(v) for v in tone)) + self.assertLessEqual(max(abs(v) for v in out), 1.10 * max(abs(v) for v in tone)) + + def test_the_dry_fills_the_fades(self): + # A steady tone at MIX 96, SHAP 64 (long fades): with the dry ducking under each repeat's envelope the + # output never sinks near silence inside a glitch, where a fixed duck left holes at every repeat's ends. + tone = [round(0.5 * (R.Q - 1) * math.sin(2 * math.pi * 220 * i / 44100)) for i in range(N)] + out = R.render(tone, tone, {0: knobs(act=127, mix=96, tail=0, shap=64, time=1)})[0] + win = 200 # 4.5 ms windows: the loudest sample in each, against the tone's peak + peaks = [max(abs(v) for v in out[i:i + win]) for i in range(4000, N - win, win)] + self.assertGreater(min(peaks), 0.5 * max(abs(v) for v in tone)) + + def test_a_glitch_fills_its_slice_of_time(self): + # At 120 BPM, 1/4 is 22,050 samples in 4 chunks and 1/2 is 44,100 in 8: every glitch starts on that grid + # and plays through all of it, whatever the chunks. + for time, chunks in ((4, 4), (5, 8)): + m = R.Model() + row = R.pblock(knobs(act=64, time=time, tail=0), {0x13: (120 * 24) << 8}) + x = noise(2) + playing, starts, runs, run = [], [], [], 0 + for b in range(0, 16 * 25000, 16): + f = [(x[(b + i) % N], x[(b + i) % N]) for i in range(16)] + was = m.x[0x06] + m.call(f, row) + if m.x[0x06] and not was: + starts.append(b) + if m.x[0x06]: + run += 16 + elif run: + runs.append(run) + run = 0 + self.assertEqual(m.x[0x40], chunks) + self.assertTrue(runs) + slice_ = chunks * m.x[0x08] + for r_ in runs: + self.assertLess(abs(r_ % slice_ - (slice_ if r_ % slice_ > slice_ // 2 else 0)), 64, (time, r_)) + for a, b in zip(starts, starts[1:]): + self.assertLess(abs((b - a) % slice_ - (slice_ if (b - a) % slice_ > slice_ // 2 else 0)), 64, (time, a, b)) + + def test_a_chunks_repeats_add_up_to_the_chunk(self): + # The last repeat takes what is left, so a chunk's repeats add up to the chunk exactly (no drift off the grid), + # in every type and at an RPT that does not divide the chunk. + for kind in (0, 1, 2): + for rpt in (3, 5, 7): + m = R.Model() + x = noise(13) + 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=2, rpt=rpt, type=kind, tail=0)) + for b in range(0, 16 * 4000, 16): + m.call([(x[(b + i) % N], x[(b + i) % N]) for i in range(16)], row) + if lengths and lengths[-1][0] == 1: + break + self.assertTrue(lengths, (kind, rpt)) + self.assertEqual(sum(l for _, l, _c in lengths), lengths[0][2], (kind, rpt, lengths)) + + def test_stut_b_gates_through_the_duck(self): + # A steady tone at MIX 96: STUT B's gate must leave real dips in the output (the duck does not fill them), + # where STUT A stays full. Measured as the quietest 4.5 ms window inside the glitching part. + tone = [round(0.5 * (R.Q - 1) * math.sin(2 * math.pi * 220 * i / 44100)) for i in range(N)] + def quietest(var): + out = R.render(tone, tone, {0: knobs(act=127, mix=96, tail=0, shap=0, time=1, type=1, var=var)})[0] + return min(max(abs(v) for v in out[i:i + 200]) for i in range(4000, N - 200, 200)) + peak = max(abs(v) for v in tone) + self.assertLess(quietest(1), 0.6 * peak) + self.assertGreater(quietest(0), 0.6 * peak) + + def test_dirt_holds_crushes_and_drives(self): + # At MIX 127 the output is the glitch alone. DIRT 127 holds each sample for 16 (runs of equal samples), + # and changes the sound; DIRT 0 holds none. + x = noise(1) + def runs(dirt): + out = R.render(x, x, {0: knobs(act=127, time=0, mix=127, tail=0, dirt=dirt)})[0] + longest, cur = 0, 0 + for a, b in zip(out, out[1:]): + cur = cur + 1 if (a == b and a) else 0 + longest = max(longest, cur) + return longest, out + (clean, a), (dirty, b) = runs(0), runs(127) + self.assertLess(clean, 3) + self.assertGreaterEqual(dirty, 12) + self.assertNotEqual(a, b) + + def test_wide_ping_pongs_the_repeats(self): + # A mono track: with WIDE 0 left and right are the same; with WIDE 127 the repeats alternate sides. + x = noise(1) + l0, r0, _ = R.render(x, x, {0: knobs(act=127, time=0, mix=127, wide=0)}) + l1, r1, _ = R.render(x, x, {0: knobs(act=127, time=0, mix=127, wide=127)}) + self.assertEqual(l0, r0) + only_left = sum(1 for a, b in zip(l1, r1) if a and abs(b) < abs(a) // 50) + only_right = sum(1 for a, b in zip(l1, r1) if b and abs(a) < abs(b) // 50) + self.assertGreater(only_left, N // 20) + self.assertGreater(only_right, N // 20) + + def test_rand_varies_the_glitches(self): + # RAND 127 changes the repeats (counts, pitches, directions); RAND 0 is the sound as it was. + x = noise(1) + a = R.render(x, x, {0: knobs(act=127, time=0, mix=127, rand=0)})[0] + b = R.render(x, x, {0: knobs(act=127, time=0, mix=127, rand=127)})[0] + self.assertNotEqual(a, b) + m = R.Model() + counts = set() + row = R.pblock(knobs(act=127, time=0, rand=127)) + for blk in range(0, N, 16): + f = [(x[blk + i], x[blk + i]) for i in range(16)] + was = m.x[0x06] + m.call(f, row) + if m.x[0x06] and not was: + counts.add(m.x[0x45]) + self.assertGreater(len(counts), 3) + + def test_dgrd_rots_only_the_tail(self): + # Glitches, then none, TAIL 127: DGRD changes the tail and nothing before it. + x = noise(1) + def render(dgrd): + rows = {0: knobs(act=127, time=1, mix=127, tail=127, dgrd=dgrd), 680: knobs(act=0, time=1, mix=127, tail=127, dgrd=dgrd)} + return R.render(x, x, rows)[0] + a, b = render(0), render(127) + first = next(i for i, (u, v) in enumerate(zip(a, b)) if u != v) + m = R.Model() + self.assertNotEqual(a, b) + self.assertGreater(first, 16 * 300) + + def test_silence_stays_silent(self): + z = [0] * N + for t in range(3): + l, r, _ = R.render(z, z, {0: knobs(act=127, time=0, type=t, var=3, dirt=127, wide=127, rand=127, dgrd=127)}) + self.assertFalse(any(l + r)) + + +if __name__ == "__main__": + unittest.main() diff --git a/sdk/octatrack/modules/glitchbox/verify.py b/sdk/octatrack/modules/glitchbox/verify.py new file mode 100644 index 0000000000..a007144cee --- /dev/null +++ b/sdk/octatrack/modules/glitchbox/verify.py @@ -0,0 +1,194 @@ +#!/usr/bin/env python3 +"""Glitchbox'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..$5f), and proc returns with every + modifier register it set to a modulus linear again. + 2. Bit for bit the model: every TYPE and VAR glitching 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 = 0x5f + + +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("glitchbox") + with G.workdir("glitchbox-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..$5f)", 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} glitching 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, "STUT"), (0, "CHOP")): + 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, glitching 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 52b4584325..0847428b8b 100644 --- a/src/catalog/module-documents.json +++ b/src/catalog/module-documents.json @@ -5858,6 +5858,382 @@ } ] }, + { + "schemaVersion": 2, + "id": "glitchbox", + "key": "GLITCHBOX", + "name": "Glitchbox", + "version": "0.1.0-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 GLITCHBOX 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": "GLITCH", + "family": "Glitch", + "summary": "A glitch effect for FX2 of any track: it captures what you play and throws slices of it back as chops, stutters or pitch-stepped arpeggios, at the project tempo.", + "overview": "Glitchbox keeps the last third of a second of the track. At every slice, a note value at the project's tempo, ACT decides whether that slice glitches. A glitched slice is filled with RPT repeats taken from what was just played: CHOP replays recent pieces in a new order; STUT ratchets the start of the slice before, each repeat half as long as the last; ARPG steps it through arpeggios and octave leaps. Each type has four variations, from plain to pitched, reversed and crushed, SHAP sets how hard or soft each repeat fades in and out, and MIX blends the glitches with the dry track; between glitches the glitch side is silent. Slice timing follows the project tempo but not yet the pattern's steps or swing.", + "highlights": [ + "Three glitch types, CHOP, STUT and ARPG, each with four variations", + "Slices of 1/64 to 1/2 note at the project tempo; ACT sets how many glitch, RPT how many repeats fill each", + "MIX sets how far each glitch takes over: the track plays dry between glitches up to 96, and 127 is the glitches alone", + "TAIL lets each glitch echo on and fade, up to about 3 seconds", + "A second page for industrial grit: DIRT, WIDE ping-pong, RAND chaos and DGRD degrading tails" + ], + "usage": [ + "Select a track, hold FUNC and press FX2, turn LEVEL to GLITCHBOX and press YES. Press FX2 for TIME, ACT, SHAP, RPT, MIX and TAIL; hold FUNC and press it again for TYPE and VAR.", + "Start with TYPE CHOP, VAR A, TIME 1/16, ACT 64 and MIX 64 on a drum loop, then raise ACT for more glitches and MIX for less of the dry track." + ] + }, + "controls": [ + { + "name": "TIME", + "default": 2, + "count": 6, + "doc": "Slice length as a note value at the project's tempo, 1/64 to 1/2. Glitches start only on this grid and last the whole slice; a slice longer than 179 ms plays as 2, 4, 8, 16 or 32 equal chunks, each with its own repeats.", + "labels": [ + "1/64", + "1/32", + "1/16", + "1/8", + "1/4", + "1/2" + ] + }, + { + "name": "ACT", + "default": 64, + "count": 128, + "doc": "Activity: the share of slices that glitch, rising evenly from none at 0 to about 70 % at 127.", + "labels": null + }, + { + "name": "SHAP", + "default": 32, + "count": 128, + "doc": "Shape of each repeat: its fade in and out is 1/64 of the repeat at 0, rising evenly to a quarter at 64 and a full swell (half in, half out) at 127.", + "labels": null + }, + { + "name": "RPT", + "default": 3, + "count": 8, + "doc": "Repeats within a glitched slice, 1 to 8. CHOP and ARPG cut the slice into equal repeats (in ARPG, an arpeggio of that many notes); STUT makes each repeat half as long as the last, a ratchet that speeds up.", + "labels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8" + ] + }, + { + "name": "MIX", + "default": 64, + "count": 128, + "doc": "How much a glitch takes over. Up to 96 the track plays dry between glitches and ducks under each repeat as it swells, coming back in its fades: 0 the track alone, 96 the repeat replaces it at its peak. From 96 to 127 the track fades out everywhere: 127 is the glitches alone, silent between them.", + "labels": null + }, + { + "name": "TAIL", + "default": 64, + "count": 128, + "doc": "After a glitch, its last repeat keeps echoing and fades out: 0 no tail, about a third of a second at 64, about 3 seconds at 127. The next glitch cuts it.", + "labels": null + }, + { + "name": "TYPE", + "default": 0, + "count": 3, + "doc": "CHOP replays recent pieces in a new order; STUT ratchets the start of the chunk before, faster and faster; ARPG steps it through pitches.", + "labels": [ + "CHOP", + "STUT", + "ARPG" + ] + }, + { + "name": "DIRT", + "default": 0, + "count": 128, + "doc": "Grit on the glitch only: sample-rate reduction (down to 1/16), a harder bit crush and a clipping drive. 0 clean.", + "labels": null + }, + { + "name": "VAR", + "default": 0, + "count": 4, + "doc": "Variation. CHOP: plain, pitched (0.25, 0.5, 2 or 3x), reversed an octave down with fades twice as long, pitched and crushed to 7 bits. STUT: plain, gated to each repeat's first eighth, reversed, five semitones lower each repeat and crushed. ARPG: major arpeggio up, minor arpeggio down, leaps over two octaves, random major steps and crushed.", + "labels": [ + "A", + "B", + "C", + "D" + ] + }, + { + "name": "WIDE", + "default": 0, + "count": 128, + "doc": "Ping-pong: each repeat alternates left and right, as far as WIDE; with RAND, repeats land anywhere in that width. 0 centred.", + "labels": null + }, + { + "name": "RAND", + "default": 0, + "count": 128, + "doc": "Chaos: the chance that a glitch takes a random number of repeats, and that each repeat takes a random pitch, a reversal (half as often) and a random place. 0 as set.", + "labels": null + }, + { + "name": "DGRD", + "default": 0, + "count": 128, + "doc": "Degrade: a tail grows dirtier as it fades, adding up to this much DIRT by its end. 0 a clean fade.", + "labels": null + } + ], + "compatibility": { + "firmware": "1.40C", + "effectId": 10, + "location": "FX2", + "conflicts": [ + "analog-bassdrum" + ], + "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 replay is the track's mono sum on both sides.", + "Slices 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.", + "Not run on a unit: Glitchbox beside Sidechain Compressor (its key window starts right after the ring), and TIME 1/2 at 30 BPM; each is checked only in dsp_host.", + "Analog BD currently requires stock DSP effects; Glitchbox is declared incompatible with it like other custom DSP effects." + ] + }, + "resources": { + "recorded": "2026-12-05", + "storage": { + "label": "DSP program / state", + "display": "1405 words / 96-word state", + "value": null, + "unit": "see display", + "method": "static", + "conditions": "The USB package 1ae4be59 (ABI 6): 1,405 program words on each DSP core it runs on; 96 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,200 bytes of ColdFire code and data (the effect's descriptor and menu), no bss.", + "source": "TESTING.md" + }, + "processing": { + "label": "DSP instruction peak", + "display": "232 instructions/sample per instance", + "value": null, + "unit": "see display", + "method": "emulator", + "conditions": "perf:audit record (perf.py in dsp_host): worst 231.7 executed instructions a sample at the dearest CHOP setting with a trig split of 10 frames, unsplit 204.7 to 212.1, static loop floor 198; SPRING REV 314.19 and DJ EQ, the dearest stock effect, 330.94 on the same stock image. Executed instructions, not chip cycles. On the author's MKII the DSP load of T1-T4 rose 7.6 to 7.9 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, played by device:price on the test pattern, read first 4.3 and each 3.2 points, admitted on the empty and the medium pattern.", + "source": "evidence/cpu-price.json" + }, + "dsp": { + "level": "moderate", + "basis": "measured-comparison", + "rationale": "231.7 executed instructions a sample worst case (0.74 of SPRING REV's 314.19, 0.70 of DJ EQ's 330.94): a ring write, an interpolated two-word read, crush, hold and drive, two envelopes, a tail, MIX and a pan, every sample. Four a core is 928 of 3,120. On the unit one instance raised its core's load about 8 points. Chip timing is unmeasured.", + "source": "evidence/performance.json" + }, + "memory": { + "level": "low", + "basis": "source-estimate", + "rationale": "Per instance 288 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); 5,271 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.2 % before, 54.2 % installed and used nowhere, 53.2 % on T1 FX2; CPU meter 68.9 % before, 69 % at rest, 68 % 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 1ae4be59 (the grid-drift fix) built from c7724e21 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 CHOP and ARPG while playing, TYPE changed mid-glitch, the ring-freeze path); the author kept 1ae4be59 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, including TIME 1/2 at 30 BPM, a glitch due on a frozen ring and a chunk's repeats adding up to the chunk; perf:audit worst 231.7 instructions a sample.", + "hardwareStatus": "reported", + "evidenceRevision": "c7724e2126f182d86543b3f3458489a87610bc48", + "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 Glitchbox on FX2 of a track playing a drum loop: select the track, hold FUNC and press FX2, turn LEVEL to GLITCHBOX at the end of the list and press YES. At the defaults it is CHOP A at 1/16, glitching about a third of the slices.", + "Raise ACT for more glitched slices, RPT for faster rolls inside them, and change TIME for longer or shorter slices.", + "Hold FUNC and press FX2, set TYPE to STUT or ARPG and VAR to B, C or D, and play the same loop.", + "Turn MIX to about 96 so each glitch replaces the track, to 127 for the glitches alone, or to 0 to hear the track alone again." + ] + }, + "screenshots": [ + "media/ot-location.png", + "media/ot-controls.png" + ], + "screenshotStyle": "black-and-white" + }, + "moduleVersion": "0.1.0-experimental", + "sourceSha256": "fe424a6d288e41134a327804a576a3e20d6c751a7f909156d2f0a2c0baf58702", + "imageSha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0", + "cycles": [ + { + "processor": "dsp", + "worstCase": 232, + "maxConfiguration": 928, + "maxInstances": 8, + "budget": 3120, + "unit": "cycles/sample", + "method": "emulator", + "conditions": { + "parameterExtremes": "232 cycles a sample covers the measured worst case in dsp_host, 231.7 executed instructions at the dearest CHOP setting (TIME 1/64, ACT, SHAP, MIX, TAIL, DIRT, WIDE, RAND and DGRD at 127, RPT 8, VAR D) with a trig split of 10 frames (the per-call setup runs twice a block), over the defaults, the dearest setting for each TYPE and a moving pattern, unsplit and with a split at every position 1-15 (perf.py, 80 cases). The static floor of the loop alone is 198. 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 glitching 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 repeat; their cost is inside the measured per-call setup. verify.py sweeps both while glitching bit for bit; perf.py's moving case steps them; on the unit 12 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 232 = 928 of the 3,120 cycles a core can spend a sample. Stress in dsp_host: 4 a core, per-core peaks 891.2 and 835.5. 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": 1405, + "wordBits": 24, + "bytes": 4215, + "scope": "shared" + }, + { + "name": "DSP state per instance, the package's state words", + "space": "dsp-x", + "words": 96, + "wordBits": 24, + "bytes": 288, + "scope": "instance" + }, + { + "name": "ColdFire code and data of the USB package", + "space": "cpu-ram", + "words": 1200, + "wordBits": 8, + "bytes": 1200, + "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": 47898, + "sharedBytes": 5415, + "maxInstances": 8, + "totalBytes": 388599, + "conditions": "From the header of the USB package 1ae4be59 (ABI 6), checked against the source: the effect uses its own r7 block X:(r7+$00..$5f) (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": "c7724e2126f182d86543b3f3458489a87610bc48", + "imageSha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0", + "summary": "On the author's Octatrack MKII, OS 1.40C, 5 December 2026 (UTC): npm run test:procedure on package 1ae4be59 (the grid-drift fix) built from c7724e21, 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, first 4.6 and each 4.6, admitted on the empty and the medium pattern, longest frame 87 %) and putting the Part back; by hand, on T1 and T5 FX2 while playing, CHOP and ARPG at RPT 2 and 4, TYPE changed mid-glitch, and the ring-freeze path (TAIL 127, RPT 1) at TIME 1/8 and 1/2, with no stall, error or crash. The author's stage on the same package, on the flashed base: kept in place of 8d67a364 beside 20 modules, played, the Part saved and reloaded and the unit power-cycled; reported \"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).", + "Not set exactly on the unit: TIME 1/4 and RPT 3, 5 and 7 (the stepped knobs' encoder acceleration overshot); verify.py holds them bit for bit in dsp_host and test_a_chunks_repeats_add_up_to_the_chunk covers RPT 3, 5 and 7.", + "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.", + "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 9dec7880; no control or label changed since." + ], + "report": "TESTING.md" + } + } + }, + "license": { + "spdx": "MIT", + "file": "LICENSE", + "declaration": "Original code by jrs1717 under the MIT licence in LICENSE: an original design inspired by glitch effects in general; 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: Glitchbox is chosen at the end of the effect list, with TYPE (here STUT), DIRT and VAR on the top row and WIDE, RAND and DGRD below.", + "alt": "FX2 SETUP page with an effect list ending in Glitchbox, selected; knobs labelled STUT, 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.0-experimental", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Glitchbox (package 9dec7880) kept beside 25 modules; the author's project, pattern A01, a track's FX2 on Glitchbox with TYPE STUT 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 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 Glitchbox 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.0-experimental", + "imageSha256": "2f7286525f0a4e84fc70fc6d48f8dab2171b6afd386be59a40a8b96eecfe3237", + "setup": "The author's Octatrack on its flashed Modwerk base ddb56b72, Glitchbox (package 9dec7880) kept beside 25 modules; the author's project, pattern A01, a track's FX2 on Glitchbox with TYPE STUT 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 captures on the same base." + } + } + ] + }, { "schemaVersion": 2, "id": "analog-bassdrum", diff --git a/src/community/module-changelogs/glitchbox.json b/src/community/module-changelogs/glitchbox.json new file mode 100644 index 0000000000..23e500b41b --- /dev/null +++ b/src/community/module-changelogs/glitchbox.json @@ -0,0 +1,13 @@ +[ + { + "version": "0.1.0-experimental", + "date": "2026-12-01", + "changes": [ + "New: Glitchbox, a tempo-synced glitch effect for FX2 of any track.", + "Three types on the setup page, CHOP, STUT and ARPG, each with four variations from plain to crushed.", + "TIME sets slices from 1/64 to 1/2 at the project tempo; ACT how often a slice glitches; RPT how many repeats fill it.", + "MIX lets the track play between glitches up to 96 and leaves the glitches alone at 127; TAIL echoes the last repeat.", + "DIRT, WIDE, RAND and DGRD on the setup page add grit, ping-pong, chaos and tails that rot as they fade." + ] + } +] diff --git a/src/engine/assets/descriptor-recipes.json b/src/engine/assets/descriptor-recipes.json index fce4479752..4409e303b8 100644 --- a/src/engine/assets/descriptor-recipes.json +++ b/src/engine/assets/descriptor-recipes.json @@ -5732,6 +5732,466 @@ "value": "MODE" } ] + }, + { + "id": "glitchbox", + "key": "GLITCHBOX", + "author": "jrs1717", + "fxId": 10, + "donorAddress": 1074616560, + "donorSha256": "3b3f9b15f2f6addfea9fc281f5b9fdf054bf305778059b8d43db41d390f0401f", + "fx2Slot": 1074618372, + "slotSha256": "79bc740214b4d029e385d06d21e224d04e8f91b53fb26ea08ffa4e5d70964b7a", + "sourceSha256": "b27ca416f0a173069231f8b2ac82bb2936e038778ec2f8b000aa99c05b8d66a3", + "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": 3 + }, + { + "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": "GLCH" + }, + { + "offset": 9, + "width": 13, + "value": "GLITCHBOX" + }, + { + "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 3daaca0a97..a048475309 100644 --- a/src/engine/assets/dsp-packages.json +++ b/src/engine/assets/dsp-packages.json @@ -240,6 +240,45 @@ } ] }, + { + "id": "glitchbox", + "version": "0.1.0-experimental", + "key": "GLITCHBOX", + "author": "jrs1717", + "sources": { + "modules/glitchbox/engine.asm": "a7063327a1af3192c37130945530c86528194cca1ff225c561b9e29803872ab7", + "modules/glitchbox/manifest.py": "b27ca416f0a173069231f8b2ac82bb2936e038778ec2f8b000aa99c05b8d66a3" + }, + "fxId": 10, + "words": 1405, + "code": "20001322f50005f425ffffff066080000006565d0000000064f00000021305f424ffffff00000044e400020784022fc4208e0044f40000400020004420001b44f4000000012000030230480207cf44f400000001020fc444f4007fffff0257c402b7c444f4001234560217c444f40008000002978444f4001000000297c444f400400000029f8444f400600000029fc444f40020000002a78444f40028514602a7c444f4002ff22202af8444f40040000002afc444f40020000002df8444f400260dfc02dfc444f4002ff22202e78444f40040000002e7c444f40040000002ef8444f40010000002efc444f40040000002f78444f40008000002f7c444f400ffffff0a778400005844f400fff0000a778400005944f400ffc0000a778400005a44f400ff80000a778400005b44f400ff00000a778400005c44f400fe00000a778400005d44f400fc00000a778400005e44f400f800000a778400005f00000c0207de2000030d104a0002a505f424ffffff05f425ffffff02069e0140c67f00000c1c2044f400000005200045027040028f8c0206de0140c67fffff21840047f4005a00002000c0027fce020e9e0140c67fffff21840047f4003e00002000c821a40057f40002000020004821a40056f40001ffff50f400fffffe0d10800004d9028784020ede0140c67f00000c1c2044f4000000072000450270400140c00000010287cc0216de0140c67fffff21850056f4007fffff20006421c4002087002000c021c7002000c021c40047f4000064ea2000c046f4000001b620005020af0046f40001000020005d47f40000000002907002cf8e02169e0140c67fffff218400208e0046f4007f000020005547f4007fffff021070026f8c02369e0140c67f00000c1c2044f4000000022000450270400277cc0236de0140c67f00000c1c2044f400000003200045027040027f8c02369e0140c600ff000c1d100a778c0000510236de0140c600ff000c1d100a778c00004e023e9e0140c67f00000a778c00004f023e9e0140c600ff000c1d100a778c000050024edf0c1c9121a400208f0044f4000002d020004d44f400000b4002904844f400001c2020004d027048028fcd028f9f56f40000000050f400791fd044f40000000120004d0d104900002a56f40000000050f400f23fa044f40000000220004d0d104900002156f40000000150f400e47f4044f40000000320004d0d104900001856f40000000350f400c8fe8044f40000000420004d0d104900000f56f40000000750f40091fd0044f40000000520004d0d104900000656f40000000f50f40023fa00028fd40d1080000439208f0045f40000000144f400001edc20004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850020004d0d104f0000080c1c8321a60020cf0020ae000c1d0221850002278d0a778500004002b79e2000030d104200000c026f94026fc444f4007fffff0277840227940267c444f40000000102b784026f9e026fd420004420002644f400000040200045026fdf026f96029058026fcd02679e2000030d104a00002a0257de44f4000020002000450d104100000c20001302678e024f8e025fce44f4007fffff0257c402b7c40d10c000001a020fde2000030d104a000016022fde020794200044020f9420004446f40000000044f400003dfe200003208f0002105820001044f4000000202000450d1047000004200013020fce020fde2000030d104200000f021f9e2000030d104200000b02679e2000030d104200000744f400000001020fc420001302178e0a77ce00005344f40002b1102000450d104900000f20001b02678f024f8f021f8f025fcf02178f44f4007fffff0257c402b7c444f400000001020fc4021fde0267d42000450d10490000040d108000013d021f9f44f4007fffff20001320000b02204002ffcc0a77ce00005102679f20000b0d104a00000b0257d457f4007fffff20004c21e4000a77c70000502000c820001021c400208e000c1c280140c000005821990022f10005f421ffffff00000046e90002579e2000560a778c000046208e000c1c260140c00000010a778c00004747f4006000002000c00140c02000000a778e00004a208e000c1c0221860057f4007fffff20005c0a778f00004b02079e020f9420004021940005f424003dfd0a77dc00000305f425003dfd70f40000000106df000002f3026f9e026fd42000440c1c0c200040026fcc026fd447f4002aaaab2000c02000400a778e00004356f4007fffff2000440c1d040a778e00004445e00046e80002bf8502bfc620ae002000500c1c045e6400204c0021c400208e002000260a77cf00005420000d0290080a778d0000540a77d500000b0237de023f98023fdf0c1cab20001002379446f400000000200045208f00029058200014200003208f000210582000100237cc023f88219d00210f0020002b21a700204d005edd005fe50020001c21e4002000c20a77c400004620004602c78c0a77ce0000480140c40000010a77cf00004902c7950a77c400004702f06802f0400a778c0000480a778f00004902479e0247d420004002b7d420004546f400000000208f0002905820001402478c218400024f972000c80c1d8f21e50057f40040000020004c21e4002000c80c1d8f21e40020af0020004d02704820000b46f40000000002b05821e70002ffd42000c021c4000a77c70000432000c021c40056f4007fffff2000440a77c400004420004502704002778e024794024fde20004421c400024f972000c00c1d0e21c40020004d02704820000b46f40000000002b05821e7000a77c40000492000c021c40047f4007fffff2000c00c1d0221c4000a77c700004a2000c00c1d0421c4000a77c700004b2000c021c4000257d72000c002c7ce0257d4025fd72000c8208e002000140257cc02c7d40a77c70000432000c00a778e0000520a77c40000520a77c700004c2000c002bf940277972000c25658000a77c40000520a77c700004d2000c002bfd40277972000c2565800000000228e00020794200044020f8c23e400021fde200040021fcc0a77cf00005320004845f40010000020006d0270680a77ce00005447f40000004020007546f4000000000210580a778d0000532000130a778e000054020fdf20000b0d104a00000902179e20004046f400003dee20005502705002178c05f424ffffff05f425ffffff00000c021fde0267d420004420004546f400000000021050021fcc021f9e2000030d104a00002d0227de0140c40000010227cc2000030d104a000009022f9e0140c0000001022f8c0d108000009500000c0d10800000850a77ce0000420140c40000010a778c0000422000030d1047000044200013021f8e02cf9e2000030d1042000005024f8e0d10c000000d025fcc44f40000000102678444f40040000002b7c40d10c00000040d10800000680227940267c40a77ce0000412000030d10420000600a77ce00005346f40000ac442000550d104100005902179e2000450d10490000550d10800001ff027fde2000450d104f00004f020fde2000030d104200001020001302678e024f8e025fce02178e44f4007fffff0257c402b7c444f400000001020fc40d10c000003d0a77c40000400a77840000420287d40a77840000450a77ce00004f2000030d104a0000120d10800001db0a77ce00004f2000450d104f00000b0d10800001d447f4000000082000c00140c00000010a778c00004544f400000001021f84020fc4200013022f8e02678e025fce44f4007fffff0257c402b7c40a77c40000450227c4020f9402d7c402279e02d78c02ff8c0c1c2e0a77c40000450d10800001c0025f8444f400200000023fc40d108000001000000c0a77ce0000410140c00000010a77c400004020004546f4000000000210500a778c00004100000c0277de44f4000000012000450d104200001c02ff9e0227df20004d0d104a00000a44f4000000802000450d10490000050c1c02218400208e00025f8c21840002ff9e20004402ff8c2000030d104200001a44f4000000010227c40d10c000001502ff9e025f940227df46f40000000120005d0d104a0000052000450d1041000004025f8c21840020004402ff8c2000030d10420000030227c6025f9e0140c400000102378c02d7940277de2000030d104200003a025f9602d79744f40000000102cfc402179445f400003dee20ce002000502000450d104700002220000920007820006d0d104700001d57f40000000202cfcf2000502000450d104700001620000920007820006d0d104700001157f40000000302cfcf2000502000450d104700000a20000920007820006d0d104700000557f40000000402cfcf0d108000013502cfd72000c00140c0000001218400025f972000c00c1c0221040002d7de20004446f40000000044f400003dfe200003208f00021058200010020794200040022fcc0277de2000030d104a00003944f4000000012000450d104a00005a027f9e2000030d1042000008022f9e0140c60000030417810d10c000002244f4000000012000450d104200000c022f9e0140c600000321840056f400000003200044041f610d10c000001344f4000000022000450d1042000008022f9e0140c6000003041fa10d10c00000080d10800000f047f4000000042000c004178121990005f421ffffff00000044e900023fc40d10c000004944f400200000023fc4027f9e44f4000000012000450d104a00001144f4000000032000450d104a00000c44f4000000022000450d104200003644f400f00000023fc40d10c00000310d10800000ca47f4000000042000c021990004174105f421ffffff00000044e900023fc40d10c0000023027f9e44f4000000022000450d104a00000c44f4000000032000450d104a00000c44f400200000023fc40d10c000001344f400e00000023fc40d10c000000e022f9e20000344f4002000000d104a000007023fd447f4005fe4432000c021c400023fc40a77ce00004f2000030d104a0000200d10800000960a77ce00004f2000450d104f00000e0d108000008f47f4000000042000c021990004174105f421ffffff00000044e900023fc40d10800000830a77ce00004f0c1c022000450d104f000005023fde200036023fce200013023f8e02478e023fdf20000b0d104300000502379e0140c40000010237cc56f40000000050f4008000000237940d10800000740247c40287940277de2000030d104200000f027f9e46f4000000022000550d1042000009208e000c1c0246f400040000200055029050218400024f8444f4004000000277de46f4000000012000550d1042000008027f9e2000550d104200000444f400100000024fc444f400ffffff027f9e46f4000000032000550d104200000444f400fe00000257840a77ce00004e022f9f0140ce00000120000b0d104a0000032000360a778e0000520a77cf00004f20000b0d104a0000150d10800000280a77ce00004f2000450d104f00000e0d1080000021208e000140c44000000c1d0221c4000a77c700004e2000c00a778e0000520a77c400005246f4007fffff56f4007fffff2000442000550210500a778e00004d57f4007fffff20004820005d0210580a778f00004c025f940267c400000c0217de2000230d104000000544f400e100002000430217cc0140c67fffff21840000000c00feb906188000057a01804021040000000c", + "sha256": "59036ca6527163a669fbbfd84ffa39c7516c5aeb18ff27d8519d22fb5d79d096", + "relocations": [ + 5, + 557, + 1401 + ], + "init": 0, + "proc": 117, + "proofs": [ + { + "base": 4096, + "sha256": "9d21d8111dc52d050b597af3847b13b12b4d50ba7063b337888cecf09185300f" + }, + { + "base": 5120, + "sha256": "5aa95de27ea8defb9a122622080a3bd220c1fd0e0a9e37e28f643d04bf2f67fe" + }, + { + "base": 6145, + "sha256": "9fa7b23f5598abe7b8ace3edf50559c96dc5c7facca6cee4555537e3e1fdb81a" + }, + { + "base": 9223, + "sha256": "b3a7cea86f69e9bb6e3a93459614944f1d2ffc438cedf0382fd357a1e56e6119" + } + ] + }, { "id": "lofi2", "version": "0.1.1-experimental", diff --git a/src/engine/assets/menu-recipes.json b/src/engine/assets/menu-recipes.json index 141cd7c4cc..f1984e3ce6 100644 --- a/src/engine/assets/menu-recipes.json +++ b/src/engine/assets/menu-recipes.json @@ -1202,6 +1202,129 @@ "sha256": "07b8c52ea73b94ee8a395a09e69a4f3c2e6082bbec0ee8e0460971207613eafb" } ] + }, + { + "id": "glitchbox", + "key": "GLITCHBOX", + "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": "glitchbox", + "key": "GLITCHBOX", + "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": "glitchbox", + "key": "GLITCHBOX", + "author": "jrs1717", + "slot": 6, + "name": "TYPE", + "labels": [ + "CHOP", + "STUT", + "ARPG" + ], + "renames": { + "0": { + "6": "CHOP" + }, + "1": { + "6": "STUT" + }, + "2": { + "6": "ARPG" + } + }, + "wideMaximum": null, + "proofs": [ + { + "namesAddress": 1074621238, + "bytes": 166, + "sha256": "a02a96dfb847a8d2c35c2d0c7f4ccd06115497ef49d80bf3a27ba9426ad906e3" + }, + { + "namesAddress": 1074623350, + "bytes": 166, + "sha256": "5744a9416a3940dc09563242af7b3a9a98eb8db2b280065b329b1891b8c80220" + } + ] + }, + { + "id": "glitchbox", + "key": "GLITCHBOX", + "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 753523e29e..5fe0515084 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": "9e4e37a45b57dd57ac749c6caee6f320602a491e", + "sourceCommit": "42de4af162974445bbb67f176aac70f75f0707b8", "nativeRevision": "b8deefc88b2c3e5f3c6158e364eb741df1924e1d", - "sourceTreeSha256": "fe13d023aae10c21b1557c039e80fd385daf8bab54b5b9337c0bbc919907ae69", - "compilerSha256": "3c31dea368ddcf68b3263c2ccda8a1b9c3e222dda1116cca7300fe03b08e6719", + "sourceTreeSha256": "ef16b9464383c0c37bd25763e15baf95ecbdc02ac025b15e1d2f7477c1ee2179", + "compilerSha256": "766ea9cbc6be006bb0c3cd7402571901c01fabe24d3830385a94fbce703a570e", "moduleVersions": { "miniverb": "0.2.3-experimental", "tapeecho": "0.1.9-experimental", @@ -23,6 +23,7 @@ "ringbank": "0.1.0-experimental", "void": "0.1.1-experimental", "fuzzbox": "0.1.0-experimental", + "glitchbox": "0.1.0-experimental", "analog-bassdrum": "0.1.7-experimental", "usb-audio-out-tracks-main-cue": "0.4.3-experimental", "quantizer": "0.1.5-experimental", @@ -55,8 +56,8 @@ }, "files": { "dsp-packages.json": { - "bytes": 113198, - "sha256": "85875515dae3217c17f24eb5a407091ac7eb51cc2828d048236aa3213d6be941" + "bytes": 122801, + "sha256": "3f9ad5fb5b20ca6dddbaf9207fe55ba48de5b21b4df59c4a2e84140589c9e47d" }, "resident-dsp.json": { "bytes": 6981, @@ -75,12 +76,12 @@ "sha256": "f4b17e0eb4e297e6dbfc61781fe5aed41262c1e7263e42579184c7cc15fa843e" }, "menu-recipes.json": { - "bytes": 34729, - "sha256": "61507b281a85393e0351158328104d09777face828cd9980dd23682625e9e2d8" + "bytes": 37438, + "sha256": "1b7eee1e48572e40a9329d8b611d24d6f76209346e20cab41f5a401ea92c3ae7" }, "descriptor-recipes.json": { - "bytes": 108057, - "sha256": "1229ed48a30d2b606533f81e69d03fd9c32e4758bc215101f798ecabedbbaf87" + "bytes": 116605, + "sha256": "661357e141783da67cee8e848c3cb413799a9c7c1ef7325872aee14d1433ef05" }, "platform-writes.json": { "bytes": 15585, diff --git a/src/engine/assets/octatrack-module-packages.json b/src/engine/assets/octatrack-module-packages.json index edeeb8e0f2..348376e84c 100644 --- a/src/engine/assets/octatrack-module-packages.json +++ b/src/engine/assets/octatrack-module-packages.json @@ -934,6 +934,25 @@ "bytes": 2926, "sha256": "091ab5ac90a10cf5a19b560a208fc7368e4482e666be706de34f855d7e7609ae" }, + { + "id": "glitchbox", + "slots": "fx2", + "cycles": 232, + "cyclesKind": "executed", + "state": 96, + "buffer": 15870, + "version": "0.1.0-experimental", + "path": "octatrack-modules/glitchbox/0.1.0-experimental.mwrm", + "abi": 6, + "features": 0, + "sites": 0, + "copies": 0, + "fills": 0, + "name": "Glitchbox", + "module": "5014cc13", + "bytes": 6910, + "sha256": "1ae4be591343727b7fb82eeaf3da28bfb0715c0b61d35f73cadc75ed18d809e0" + }, { "id": "arr-rows", "octabam": true,