Taking the Fundamental WT VCO with a custom wavetable loaded as an example here:
- If you save this module in a patch, then the custom wavetable file is also saved inside the patch
- If you save a preset on this module, then the file name without the path is saved inside the preset json file, but the custom wavetable file is not saved/copied to the patch folder, so you can’t reuse this particular preset later on
- If you save a selection with this module inside, the same happens as if you save a preset
Has anyone already coded some workarounds for successfully saving/loading presets and selections with module assets?
I just noticed that the Surge XT wavetable module takes another approach: A custom wavetabel file is serialized inside the preset json file. This may work well for ‘smaller’ assets, but IMO it doesn’t seem to be a general solution.
A general soultion could be saving presets and selections the same way as patches. But this needs changes in the Rack itself, od could it be possible to code a module that replaces the internal saving mechanism?
Yeah… In assuming that Andrew has made all these choices quite deliberately, then:
- A patch is an archive, including all module assets (such as wavetables), that preserves the entire state of the patch.
- A preset is a configuration of a module’s control values. If the module has additional assets saved in a patch, the preset is only useful inside that specific patch.
- A selection is a capture of the control values and wiring of a group of modules. If the modules have additional assets saved in a patch, the selection is only useful inside that specific patch.
If you want to expand the notion of presets and selections to include module assets, they need to use an archive format like patches do. I think it’s a very reasonable and useful request, and I would encourage you to make it to Andrew. It’s very easy to argue that when custom assets became a thing presets and selections should have taken account of it, like the patches-as-archives did, and without it lessens the utility of them and puts a damper on modules using custom assets free of worry.
I asked VCV support and they say they will look into adding this feature in a future version of VCV Rack. That’s fine
that’s mostly because “I didn’t know there was another alternative until i saw this thread just now”
Is there an API to store binaries in the patch not serialized as json? I should probably use that for the wavetable instead if so.
On rack::engine::Module::onSave() the API only says: ‘If your module uses patch asset storage, make sure all files are saved in this event.’
I only found an implementation in the Fundamental WT VCO.
But your solution works also for presets and selections, the solution described above only works for patches. So your actual solution on your wavetable oscillator has an advantage over the WT VCO when it comes to saving/loading presets and selections.
If the audio data I want to store would be rather small (e.g. max some seconds), I would embed the audio into the json file. But storing multi-track audio of half an hour or more in 32 bit-depth would extremely blow up the json file.
Plus (from another thread a little while back), there is a limit on the max size of a json file imposed by the library Rack uses for json support, so it would be likely to start blowing past that limit.