Repository navigation
audiograph on CPython and CircuitPython, with a three-way render comparison - #301
Merged
Merged
Conversation
…rison The wheel carries audiograph now (a Graph type in _audiodsp, re-exported by src/cpython/audiograph.py), and the CircuitPython build compiles it from circuitpython_spike/shared-bindings/audiograph, so unix CircuitPython and the CircuitPython firmware both have it. All three bind the same shared/audiodsp_graph.c with the same arguments and refusals; no node file changed. tests/parity/verify_graph.py renders one patch with every node kind in it on CPython and each interpreter named and compares every output sample, with a tolerance of 0 counts. CPython, MicroPython (double and single precision) and CircuitPython unix agree on all 41221 samples. Its planted faults, one fed input sample one count off and one set() a block late, each fail it (615 and 3197 samples differ). CI runs the faults, then the comparison, beside graph_probe.
bdbarnett
force-pushed
the
feat/graph-bindings
branch
from
October 21, 2026 17:28
19f2f69 to
7d57975
Compare
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.
audiographis no longer MicroPython only. The wheel has it (import audiographon CPython), and the CircuitPython build compiles it, both the unix port and the firmware, throughcircuitpython.mk's module list. All three bind the samesrc/shared/audiodsp_graph.cwith the same arguments and the same refusals, and no node file changed.Graphtype in_audiodsp.c, re-exported as is bysrc/cpython/audiograph.py. The constants are read by name from the C enums. A delay's wow table is held through a memoryview, so the array can't be resized under it.src/circuitpython_spike/shared-bindings/audiograph/andshared-module/audiograph/, laid out like the other modules.The comparison.
tests/parity/verify_graph.pyrunsgraph_parity_probe.pyon CPython and on each interpreter you name, then compares every output sample. The patch has two voices with every node kind, groups that park, a fed buffer, moved gains and cutoffs, a delay reset mid-tail, and a mono graph. The tolerance is 0 counts. Locally, CPython, MicroPython unix (double and single precision) and CircuitPython unix agree on all 41,221 samples.Two planted faults, applied to every interpreter after the first, each make the comparison fail:
lsb: one fed input sample is one count off, and 615 samples differ by up to 2.late: oneset()lands a block late, and 3,197 samples differ by up to 183.CI runs both faults first, then the CPython against MicroPython comparison, beside
graph_probe. As withverify_dsp, the three-way that includes CircuitPython is a local run.graph_probe.pypasses on all three, with the same digests on each.Tests.
tests/test_cpython_audiograph.pyruns the runner's probe on the wheel. It also checks that the module exports every name the board module does, that a borrowed table is held, and that a dropped graph frees its memory; a planted leak fails that last check.test_binding_paritynow coversaudiograph(22 types), andGraphis exempt from the nodedeinitrule because nothing plays it.