Skip to content

fill(): a patch that renders slower than real time no longer hangs it - #39

Merged
bdbarnett merged 1 commit into
mainfrom
fix/fill-bounded
Nov 1, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/fill-bounded

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

On a board, an instrument whose patch renders on the rack (not compiled to a graph) plays through a ring that fill() tops up. fill() looped while ring.space() >= need, and when the patch rendered slower than real time the pump drained the ring as fast as fill() wrote it, so the call never returned and the interpreter stopped.

Measured on an ESP32-P4 with electric_piano (rack engine) pumped to I2S: a render of 35 ms per 5.3 ms block (0.15x real time), and one fill() call still writing after 85 blocks and 3 s, with the ring's free space unchanged.

fill() now renders the blocks that fit when it is called and returns, so a slow patch underruns instead of hanging. The same board then played electric_piano for 60 s with fill() every 20 ms: longest call 411 ms, and underruns as expected at that render speed.

tests/test_fill_bounded.py drives fill() against a ring that never fills; it fails on the old loop and passes now.

https://claude.ai/code/session_0156jxeQhrF9XaLXNUos1NHF

On a board, a patch that renders on the rack slower than real time never
caught up with a ring the pump drains while it renders, so fill() looped
for ever and the interpreter stopped. It now renders the blocks that fit
when it is called and returns; the audio underruns instead.

Claude-Session: https://claude.ai/code/session_0156jxeQhrF9XaLXNUos1NHF
@bdbarnett
bdbarnett merged commit 4e3f788 into main Nov 1, 2026
1 check passed
@bdbarnett
bdbarnett deleted the fix/fill-bounded branch November 1, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant