poc of soundfiler for dpf#288
Conversation
|
To get the outlets to work I'm thinking of passing However this probably requires symbol support in |
… DPF getSpecialDir(); split to separate template include
|
@pedrojg321 done :) Are you interested in testing this feature? |
|
Thanks! I was able to compile a patch that had soundfile blocks. I'm trying to persist some values but still need to work more on it |
|
thanks for pointing me here @dromer ! so am i right in assuming this is currently not working even in develop? or is there a way in which i could test this from plugdata by installing a dev-version of the hvcc toolchain? |
|
Using |
thanks, did that and got this in terminal: looking at the toolchain folder in Documents/plugdata/Toolchain it is not entirely clear to me which files/parts I would have to replace. |
|
You would only need to replace Let me do a rebuild of this branch to create a build in CI for you. |
|
This Action should result in some builds of the Heavy binary: https://github.com/Wasted-Audio/hvcc/actions/runs/22004826723 |
|
Oh yeah this is not part of Heavy internals yet so it's a manual thing. This branch is in Draft status for a reason ;) |
|
sorry to waste so much time on this... after exporting source + GUI from plugdata, i manually added tinywav.c and tinywav.h to the plugin/source/ directory and tried "make" now i get an error, because: |
|
Ah, from the Makefile for the plugin you can see that I was putting Tinywav in a folder on the root level. Again this was super Proof of Concept stuff so not in any way polished for users. I think I just cloned https://github.com/mhroth/tinywav into the project root. |
|
I think so, maybe check what info is passed to the outlets and print it to the console. Not all hosts will print debug info though, personally I always test using jack standalone from cli. Should also work on macOS. |
|
hmm. i am getting: [tinywav] Failed to open file for reading: No such file or directory if i try to load a file via "soundfiler" (compiled to tinywav) . the path works in PD, it is valid. |
There was a problem hiding this comment.
Pull request overview
Adds an initial (WIP) [soundfiler] implementation intended for the DPF generator by introducing a Pd abstraction and wiring generated DPF plugins to perform WAV file read/write via TinyWav.
Changes:
- Add a Pd
soundfiler.pdabstraction that routesread/write(and-resize) to internal__hv_snd_*sends. - Extend the DPF generator templates with a
sndFileOperator()handler and TinyWav build integration. - Filter
__hv_snd_*sends from exported output parameters, and document/announce DPF-only soundfiler support.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| hvcc/interpreters/pd2hv/PdSendObject.py | Minor comment movement for @raw/@owl handling. |
| hvcc/interpreters/pd2hv/libs/pd/soundfiler.pd | New Pd abstraction forwarding soundfiler messages to internal __hv_snd_* plumbing. |
| hvcc/generators/c2owl/c2owl.py | Treat raw attribute as present when not None (instead of truthy). |
| hvcc/generators/c2dpf/templates/sndFileOperator.cpp | New DPF-side operator implementing read/write/resize via TinyWav and patch messaging. |
| hvcc/generators/c2dpf/templates/Makefile_plugin | Adds TinyWav source and include paths to DPF builds. |
| hvcc/generators/c2dpf/templates/HeavyDPF.hpp | Includes TinyWav header and declares sndFileOperator(). |
| hvcc/generators/c2dpf/templates/HeavyDPF.cpp | Dispatches __hv_snd_* sends to sndFileOperator() and includes its template. |
| hvcc/compiler.py | Renames/filter helper and filters soundfiler sends out of exported output parameters. |
| docs/reference/objects/supported.md | Marks [soundfiler] as supported only for some generators (DPF). |
| docs/generators/dpf.md | Adds WIP section documenting DPF soundfiler + TinyWav dependency. |
| CHANGELOG.md | Adds “Support soundfiler object (DPF only)” entry. |
Comments suppressed due to low confidence (1)
hvcc/compiler.py:125
- The parameter name
midi_out_objectsis now misleading because the function is also used to filter non-MIDI objects (soundfiler sends). Renaming it would make the intent clearer.
def filter_objects_from_out_parameters(output_parameter_list: List, midi_out_objects: List) -> List:
new_out_list = []
for item in output_parameter_list:
if not item[0] in midi_out_objects:
new_out_list.append(item)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FILES_DSP += $(wildcard *.c) | ||
| FILES_DSP += ../../tinywav/tinywav.c |
| BUILD_CXX_FLAGS += -I ../../tinywav | ||
| BUILD_C_FLAGS += -I ../../tinywav |
| #include "Heavy_{{name}}.hpp" | ||
| #include "tinywav.h" | ||
|
|
| void hostTransportEvents(uint32_t frames); | ||
| void setOutputParameter(uint32_t sendHash, const HvMessage *m); | ||
| void sndFileOperator(uint32_t sendHash, const HvMessage *m); | ||
|
|
| plugin->setOutputParameter(sendHash, m); | ||
| switch (sendHash) | ||
| { | ||
| case HV_HASH_SND_WRITE: | ||
| case HV_HASH_SND_READ: | ||
| case HV_HASH_SND_READ_RES: | ||
| plugin->sndFileOperator(sendHash, m); | ||
| break; | ||
| } |
| const char *tableName = hv_msg_getSymbol(m, 2); | ||
|
|
||
| auto filePath = getSpecialDir(kSpecialDirDocumentsForPlugin) + std::string("/Samples/") + std::string(fileName); | ||
|
|
| TinyWav tw; | ||
| tinywav_open_read(&tw, filePath.c_str(), TW_INLINE); | ||
|
|
||
| tinywav_read_f(&tw, table, tableSize); | ||
|
|
||
| _context->sendMessageToReceiverV( |
| ## Soundfiler | ||
| > WORK IN PROGRESS | ||
|
|
||
| It is possible to read and write `.wav` audio files to/from tables using `[soundfiler]` object. This currently depends on [TinyWav](https://github.com/mhroth/tinywav) being placed on the same level as `DPF` in your build environment. Paths are relative to the execution directory of the plugin. | ||
|
|


Todo: