WIP: first setup of rfft~ components#110
Draft
dromer wants to merge 18 commits into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the initial scaffolding for Pd rfft~ / rifft~ support across the hvcc pipeline (Pd parsing → Heavy JSON → hv2ir → C codegen), including new Pd-lib wrappers and a first test patch.
Changes:
- Capture Pd
block~size into the graph representation and propagate it through Heavy JSON / hv2ir for RFFT sizing. - Add new IR object types (
__rfft~f,__rifft~f) and wire them into hv2ir and the ir2c generator (with new static C/H stubs). - Add Pd-lib abstraction wrappers for
rfft~/rifft~and a new Pd test patch for exercising the objects.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_signal.py | Updates the golden WAV generation script flow (hvcc run + C asset copy + build/run). |
| tests/pd/signal_rfft/test-rfft.pd | Adds a new Pd patch intended to exercise rfft~/rifft~. |
| tests/framework/base_signal.py | Adds an out_dir check after hvcc compilation in the signal test harness. |
| hvcc/interpreters/pd2hv/PdParser.py | Extracts block~ size into the parsed graph and updates warning behavior. |
| hvcc/interpreters/pd2hv/PdGraph.py | Stores graph block_size and exports it into Heavy JSON. |
| hvcc/interpreters/pd2hv/libs/pd/rfft~.pd | Adds Pd-lib wrapper abstraction for rfft~ using @hv_obj __rfft~f. |
| hvcc/interpreters/pd2hv/libs/pd/rifft~.pd | Adds Pd-lib wrapper abstraction for rifft~ using @hv_obj __rifft~f. |
| hvcc/generators/ir2c/static/HvSignalRFFT.h | Introduces C API/structs for SignalRFFT/SignalRIFFT. |
| hvcc/generators/ir2c/static/HvSignalRFFT.c | Adds init/free/onMessage stubs and placeholder DSP entry points. |
| hvcc/generators/ir2c/SignalRFFT.py | Adds ir2c codegen for the new RFFT/RIFFT IR nodes. |
| hvcc/generators/ir2c/ir2c.py | Registers the new signal object generators. |
| hvcc/core/json/heavy.ir.json | Registers __rfft~f / __rifft~f IR definitions. |
| hvcc/core/hv2ir/HIrRFFT.py | Adds hv2ir object reducer for RFFT/RIFFT to inject block_size. |
| hvcc/core/hv2ir/HeavyParser.py | Parses block_size from Heavy JSON into graph args. |
| hvcc/core/hv2ir/HeavyGraph.py | Removes a stray blank line. |
Comments suppressed due to low confidence (1)
hvcc/interpreters/pd2hv/PdParser.py:366
- The warning currently says
block~is "ignored", but this PR also uses it to setg.block_size. This message is misleading (and the warning enum may be too strong) now thatblock~has an effect.
g.add_warning(
f"This graph contains a {obj_type} object that is ignored.",
NotificationEnum.WARNING_USELESS_OBJECT)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
91
to
95
| try: | ||
| out_dir = self._run_hvcc(pd_path) | ||
| assert out_dir is not None | ||
| except Exception as e: | ||
| self.fail(str(e)) |
Comment on lines
+66
to
70
| test_patch = TestPdSignalPatches() | ||
| test_patch.setUp() | ||
| out_dir = test_patch._run_hvcc(args.pd_path) | ||
| assert out_dir is not None | ||
|
|
Comment on lines
358
to
+362
| if obj_type in ('block~',): | ||
| if obj_type == 'block~': | ||
| # grab the block size for this graph | ||
| g.block_size = obj_args[0] | ||
|
|
Comment on lines
117
to
+124
| graph_args = graph_args or {} | ||
|
|
||
| # set the block size | ||
| try: | ||
| if json_heavy["block_size"] is not None: | ||
| graph_args["block_size"] = int(json_heavy["block_size"]) | ||
| except KeyError: | ||
| graph_args["block_size"] = 64 |
Comment on lines
+37
to
+40
| def reduce(self) -> Optional[tuple]: | ||
| if self.graph is not None: | ||
| self.args["block_size"] = self.graph.args["block_size"] | ||
| return ({self}, []) |
Comment on lines
+1
to
+5
| #N canvas 1039 0 450 300 12; | ||
| #N canvas 1216 43 450 300 subtest 1; | ||
| #X obj 74 84 rfft~; | ||
| #X obj 74 146 rifft~; | ||
| #X obj 72 231 outlet~; |
Comment on lines
+33
to
+36
| hv_size_t sRFFT_init(SignalRFFT *o, const int size); | ||
| void sRFFT_free(SignalRFFT *o); | ||
| void sRFFT_onMessage(HeavyContextInterface *_c, SignalRFFT *o, int letIndex, const HvMessage *m, void *sendMessage); | ||
| void __hv_rfft_f(SignalRFFT *o, hv_bInf_t bIn, hv_bOutf_t bOut0, hv_bOutf_t bOut1); |
Comment on lines
+44
to
+47
| hv_size_t sRIFFT_init(SignalRIFFT *o, const int size); | ||
| void sRIFFT_free(SignalRIFFT *o); | ||
| void sRIFFT_onMessage(HeavyContextInterface *_c, SignalRIFFT *o, int letIndex, const HvMessage *m, void *sendMessage); | ||
| void __hv_rifft_f(SignalRIFFT *o, hv_bInf_t bIn0, hv_bInf_t bIn1, hv_bOutf_t bOut); |
Comment on lines
+36
to
+41
| void sRFFT_onMessage(HeavyContextInterface *_c, SignalRFFT *o, int letIndex, | ||
| const HvMessage *m, void *sendMessage) { | ||
| switch (letIndex) { | ||
| default: return; | ||
| } | ||
| } |
Comment on lines
+60
to
+65
| void sRIFFT_onMessage(HeavyContextInterface *_c, SignalRIFFT *o, int letIndex, | ||
| const HvMessage *m, void *sendMessage) { | ||
| switch (letIndex) { | ||
| default: return; | ||
| } | ||
| } |
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.
Lets see if we can get everything in place to properly add these objects!