Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/machines/analog-rytm-mkii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ A machine that makes its sound in software (as stock's CP CLASSIC does) adds one
- **The stream:** LEV squared into the voice's digital stream (0x80006bf8 + 128 x voice), which stock's mixer sends through the voice's filter, AMP and OVR. `ev_render_out` clears it after the mixer, so a voice another machine takes over plays no stale block. A hit ends after 64 blocks below -102 dB, measured before LEV.
- **The type:** up to eight variants of a machine in a 3-bit field of the sound. A tap of the record's encoder on the machine's SYNTH page steps it and that knob's label follows; `ev_sound_applied` keeps each track's type exact through kit and sound loads and a trig's sound lock.
- **The EMAC:** `render` runs in fractional mode with all four accumulators clear; the base keeps stock's MACSR and all four accumulators around it, as stock's mixers rely on them. [`include/modwerk/dsp.h`](include/modwerk/dsp.h) has the multiply, sum and table helpers, and a host model for testing the same C off the unit.
- **Cost on the unit:** the core runs at twice DTIM0. A `mac.l` whose accumulator is read by the next instruction waits 3 cycles (5 for the pair, 2 with three independent instructions between, measured on a MKII), so a voice's hot loops spread independent products over ACC0-ACC3; GCC's `qmul` pairs cannot. Stock's audio work evicts a voice's code and tables between blocks, so every block pays their cache refill (about a third of a bass drum voice's render, measured, before it was trimmed): keep per-block code and tables small, and pass settings in place rather than copying records. rytm-emu counts instructions only; its ticks match the unit's warm cost, not the stalls or refills. A routine in assembly saves every register it uses of d2-d7 and a2-a6 (the caller's under GCC's convention); one that did not corrupted its caller without a fault. Budget against what is left: on a MKII with the base (send bus, no send effect) the whole audio block, ev_render_in to ev_render_out, takes about two thirds of its 88,000 ticks with nothing playing and three quarters at its dearest, so digital voices hitting together share about a quarter of the block.
- **Cost on the unit:** the core runs at twice DTIM0. A `mac.l` whose accumulator is read by the next instruction waits 3 cycles (5 for the pair, 2 with three independent instructions between, measured on a MKII), so a voice's hot loops spread independent products over ACC0-ACC3; GCC's `qmul` pairs cannot. Stock's audio work evicts a voice's code and tables between blocks, so every block pays their cache refill (about a third of a bass drum voice's render, measured, before it was trimmed): keep per-block code and tables small, and pass settings in place rather than copying records. rytm-emu counts instructions only; its ticks match the unit's warm cost, not the stalls or refills. A routine in assembly saves every register it uses of d2-d7 and a2-a6 (the caller's under GCC's convention); one that did not corrupted its caller without a fault. In inline assembly, take a struct's address from an `"r"(&s)` operand, never by moving its `"+m"(s)` operand into an address register: that loads the struct's first word, and the voice then wrote through it, which hung a unit at the first note while the host tests (C fallback) passed; rytm-emu stopped on the same image with `FAULT vector 4`, so run an image with new assembly there first (HH ALLOY, 28 November 2026). A voice played from a short sample table cost a quarter of one synthesised per sample (HH ALLOY: 2.3 % against 8.8 % of a block, one voice on a MKII). Budget against what is left: on a MKII with the base (send bus, no send effect) the whole audio block, ev_render_in to ev_render_out, takes about two thirds of its 88,000 ticks with nothing playing and three quarters at its dearest, so digital voices hitting together share about a quarter of the block.
- **The meter:** `mw_voice_meter` keeps each slot's blocks, DTIM0 ticks (88,000 a block) and dearest block.

The base's voices are in the voices and send-bus variants and take about 4 KB of `.run`. A module that adds a voice machine lists its id in [`voice-modules.json`](voice-modules.json) (`npm run modules:check` asks for it), so the site builds its sets on voices, which has no send bus, or on send-bus when the set also holds a send effect. Such a module uses none of the send bus's code (`mw_send_*`, `mw_fx_clock`, `mw_fx_step`, `mw_fx_rate`, `mw_fx_onepole`, `mw_fx_tempo`): `modules:check` refuses it, since it would not link on voices.
Expand Down