Repository navigation
Fix: Rytm base: the lean engine clears an idle sample voice's output every block - #2515
Merged
repeat98 merged 3 commits intoDec 2, 2026
Conversation
… block, as stock does The sample voices' trim (LE_TRIM) left a skipped voice's 32 output longs (0x800067f8 + 128 x voice) alone while a bit a voice (dsz_out) said they still held zeros from an earlier block. That assumed nothing else writes the buffer, but it is the sample stream stock's voice mixer reads, and a module may shape it in place first: Sample Layer (repeat98#2253) does, from a gate on the mixer's call 0x4012129a, so after a voice went idle its TRANSIENT delay tail or band ring stayed in the buffer and was read back every block. le_dsg now zeroes the 32 longs in every block it skips stock's gain loop, the bytes stock's loop writes; dsz_out is gone (le_dsk_total [7] unused). rytm-emu, a twin module on Sample Layer's site marking idle voice 7 every 1000 blocks: old base 137,812 of 137,812 blocks after the first mark found the stream stale (and its DAC channel kept the marker), fixed base 0. Release identities plain 8b2663e1, voices dacd67fe, send-bus b37be733 (sizes unchanged); packages, record and registry follow. Review: no defect; the README's lean-engine section now says which buffers a module may not shape in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8b2663e1, voices dacd67fe, send-bus b37be733) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npp1993
added a commit
to npp1993/modwerk
that referenced
this pull request
Dec 2, 2026
repeat98#2515 (lean engine: an idle voice's sample stream zeroed every block) changed perf-sample-voices.s, so the release bases with the loader are rebuilt from the merged sources: plain 6496a83a, voices a0efb9e9, send-bus a981a3b0 (sizes unchanged). base-next's loaderless 8b2663e1, dacd67fe and b37be733 are replaced; its README note on stock's audio buffers is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chevyone
added a commit
to chevyone/modwerk
that referenced
this pull request
Dec 2, 2026
…epeat98#2515) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes. With the Rytm base's lean engine, a module that shapes a sample voice's audio in place could hear its own last block again after the sample ended. Sample Layer's TRANSIENT delay (SHF, PUNCH) or band then looped forever instead of dying away. Found while reviewing Sample Layer (#2253). The base now clears an idle sample voice's output every audio block, as the stock OS does, so any module may write that buffer.
What it means for musicians. Nothing changes with today's library modules: none writes that buffer. Sample Layer's tails end as designed once it is in the library.
Cost. About 240 instructions a block with all 8 sample voices idle (about 0.16 % of the audio block); the lean engine keeps 98 % of its sample-voice saving. Idle and playing output is identical to stock's sample engine, sample for sample (emulator, zero-time twin).
On a unit: yes, on the maintainer's MKII, inside the current combo set (RC47's 20 modules plus Sample Layer from #2253), RAM-booted, 1 Dec 2026. On the old base Sample Layer's TRANSIENT tail (SHF at its top, DEC INF) still sounded at -12 dBFS 2.5 s after the hit; on the fixed base it was silent (-83.9 dBFS, the noise floor), like the SHF-0 control (-83.5).
Who acts: a maintainer merges this into
base/analog-rytm-mkii-nextonce green; it ships with the next Rytm base release.Tested on a unit: base a0b41d24 (this tree's voices variant, built as a development base for the RAM boot; the release packages b37be733 / dacd67fe / 8b2663e1 are the same sources without the dev parts and did not run on a unit), MKII, RC47's set + Sample Layer: slv-tail, abd-voice, sy-voices pass; the old base 89a81ff5 fails slv-tail.
Guides: the Rytm base's lean-engine section did not say which stock buffers the lean engine no longer rewrites every block; added there (
sdk/machines/analog-rytm-mkii/elekloader/README.md).Edge cases
Cause, change and tests
Cause.
commonbuildsperf-sample-voices.swithLE_TRIM=1. For a voice with nothing to play,le_dsgskips stock's gain loop and writes the voice's 32 output longs (0x800067f8 + 128 x voice) itself, but skipped that write while a per-voice bit (dsz_out) said the buffer still held zeros from an earlier block. That assumed nothing else writes the buffer. It is the sample stream stock's voice mixer reads, and Sample Layer shapes it in place from a gate on the mixer's call (0x4012129a): after a voice went idle, the last block Sample Layer wrote stayed in the buffer and was fed back into its delay every block, at unity with DEC INF.Change.
le_dsgzeroes the 32 longs in every block it skips the gain loop (4 passes of 8clr.l);dsz_outis gone. TheLE_VERIFYbuild runs stock's loop there as before. The lean-engine section ofelekloader/README.mdnow says which buffers the lean engine zeroes once and then leaves (the delay's return while it rests, the USB input streams while nothing streams), so a module does not shape those in place. Release identities: plain8b2663e1, voicesdacd67fe, send-busb37be733(sizes unchanged); packages, import record, catalog and registry follow.Library modules that write the sample stream: none (searched every Rytm module and draft for the buffer). Analog BD and the digital voices write the digital stream (
0x80006bf8), Improved SMPL changes a fetch's source (a real transfer, which the trim already treats as unknown).Tests.
base-binding.json's identities; the fixed tree records the new ones.slv-tail: BD with the amp held open, the analog body off, a one-shot sample; a control hit on TRANSIENT with SHF 0, then a hit with SHF at its top and DEC INF; each tail measured 2.5 s after its note.npm run check: passed.What the guides lacked. The lean-engine section did not say that some stock buffers are no longer rewritten every block; fixed there (
sdk/machines/analog-rytm-mkii/elekloader/README.md).🤖 Generated with Claude Code