Repository navigation
Change the patch of a graph the audio pump plays - #5
Merged
Merged
Conversation
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.
Stacked on #4. A rack attached to the audio pump can now change its patch while it plays: plug or pull a cable, add or remove a module.
recompile()on an attached graph compiles the new graph while the pump plays on, then parks the pump at a block boundary, carries the state and trades patches withGraph.swap. Whatever pulls the graph (the pump, an output, a mixer) keeps the same object and hears the new patch from its next block. An instrument'sconnect(),disconnect(),add_module()andremove_module()now work withoutput="graph"; every change made in one turn lands together on the block after the turn. A module that still runs in Python is refused, and the old patch plays on.It needs audiodsp's
Graph.swapand carry-while-parked, PyDevices/audiodsp#350, which isn't released yet. Without it an attached recompile raisesRuntimeErroras before, and the new tests skip (MicroPython) or fail (CPython) on an audiodsp without it.What was checked.
tools/pump_swap.pyplays the cable phrase on the pump, plugs a cable and opens an attenuator in one held batch mid-phrase, and compares every block the pump played with a rack built with the cable whose attenuator opens at the block the swap reports:No block was dropped (the ring's overflow count stays 0).
tests/test_graph_pump_swap.py(and its MicroPython twin) hold these. Scoped runs:test_graph_pump_swap,test_graph_live_patch,test_graph_pumpandtest_adapterpass on CPython (199); the three MicroPython modules pass.What it costs. Eight swaps of a held chord per voice. "Held" is the time from asking the pump to park to letting it go, so how long it could not render:
The compile runs while the pump plays, so only "held" eats into the ring's headroom.