So I finally got a handle on this. David's video on the File API was super helpful getting started.
Here's how its done:
const var ScriptnodeSyntesiser1 = Synth.getAudioSampleProcessor("Scriptnode Syntesiser1");
const slot = ScriptnodeSyntesiser1.getAudioFile(0);
inline function onLoadSFZControl(component, value)
{
if (value)
{
FileSystem.browse (FileSystem.Desktop, false, "*.sfz", function (f)
{
slot.loadFile("{XYZ::SFZ}" + (f.toString(File.FullPath)));
});
}
};
Content.getComponent("LoadSFZ").setControlCallback(onLoadSFZControl);
Generally speaking it works really well. Some observations:
It prefers well formatted files like this to autogenerated messes like this
I've not extensively tested this, but it seems the path must be included in the region. Setting it with "default_path" doesn't seem to work
It doesn't like .AIF or FLAC files
If a file doesn't work, try removing anything that isn't directly related to the mapping of samples (opcodes, comments etc)