Skip to content

BUG: a MARBLES rip (ROTC) takes one audio block over budget #48

Open

Description

@Worldwave

Description

A MARBLES rip (ROTC) takes one audio block over its CPU budget. The re-seed that a rip requests rebuilds all of Marbles' generators inside the audio thread, in a single 2 ms block.

Module / Page

MARBLES · rip out the cables (ROTC)

Measured on hardware (v0.7.2)

log (local, logs/) engine block max mrb that window (avg/max) result
sp1-20261006-232648.log (rip at 23:27:17.641) VA (8) 105.67 % 4.0 / 44.7 ovr=1, fail=0 rst=0
sp1-20261006-225513.log (rip at 23:11:38.210) VA (8) 99.25 % 4.0 / 37.1 fail=0 rst=0
  • Marbles normally costs ~4 % per block with a max of ~7 %. The rip block alone adds ~37–45 points.
  • The only other over-budget block in these logs is the known single block right after power-on (pre/rte ~46 %), present since v0.6.0.
  • These are the first CPU-logged rips: the rip logs of 2026-09-24/25 predate the CPU line.
  • On VA (~54–62 % engine) the rip block lands at ~100–106 %. On heavier engines (Chords ~72 %, String machine ~74 %) it would go further over: one late block every rip. No stream failure or reset has been seen. A single late block is non-fatal (issue BUG: Distortion costs so much CPU it causes crashing with some modes #22's notes), but it may be audible.

Cause

sp1_marbles_render() in firmware/src/sp1_marbles.cc handles a pending sp1_marbles_reseed() (requested by main.c's rip, M4d) at the top of an audio block:

random_generator.Init(seed); random_stream.Init(...); InitGenerators();

InitGenerators() re-initialises TGenerator and XYGenerator. In Marbles' own code (vendored, unmodified):

  • XYGenerator::Init: four RandomSequence::Init (16 random draws each) and four OutputChannel::Init.
  • OutputChannel::Init: initialises 6 quantizers to Marbles' empty default scale. That is 24 Quantizer::Init in one block, all thrown away, because loaded_scale = -1 makes the next block reload the selected scale anyway.
  • TGenerator::Init: the Markov history, the sequence and the ramps.

None of this changed in #47. This report comes from logging made possible by #22.

Possible fixes (not decided; costs are estimates until measured)

  1. Build in main, swap in audio. Main builds a fresh generator set (random_stream 524 B, t_generator 1 940 B, xy_generator 5 788 B ≈ 8.3 KB RAM) and the audio thread switches to it with one pointer swap at the top of a block. This removes the spike entirely.
  2. Spread the re-init over several blocks: the t generator in one block, then one X/Y channel per block, then the scale. No extra RAM. Marbles' outputs hold for ~5 blocks (~10 ms) during the rip. The worst block drops to roughly a quarter of today's.
  3. Skip the 24 throw-away quantizer inits with a one-passage override of output_channel.cc (the selected scale is reloaded next block anyway). This may account for most of the spike, but that is unmeasured. Measure the split first (DWT around each Init on hardware) before choosing.

Controls

ROTC on the MARBLES page (any page).

Version

0.7.2

Activity

  1. added this to the M7 milestone on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions