Load/Save Table(envelope) shapes
-
@DanH Ok so you have to use the fileSystem and save/restore the base64 shape to/from the external file you've created
https://docs.hise.audio/scripting/scripting-api/filesystem/index.html -
@ustk Thanks mate, will take a look! No doubt I will be messaging you again soon! :face_with_tears_of_joy:
-
What's wrong with copy/paste?
-
@d-healey Thanks David, this is great for working within Hise, but I want the User to be able to do the same within the plugin... and even across plugins if possible!
-
-
@d-healey Do you think it would be possible to create a mini preset browser for it like this https://forum.hise.audio/topic/3273/custom-mini-preset-browser-example-using-filesystem-api
-
@ustk Can't see how to 'save' a file from that link.. do you know how? Do I need to wrap it in a callback function from a button?
-
Did you load the snippet from that post into HISE? There's everything in there that you'd need to make what you're describing. You just need to export the table as base64 and save that string to a file. When you load the file, you restore the table from the base64 string like @ustk said.
-
@Lunacy-Audio I took a look at it the other day, thanks for posting it up :)
I'm a bit at a loss trying to work these base64 API's but will take another look at that snippet and see if any clues are inside!
-
The table's are definitely confusing! Took me a while to get a hang of them.
This is where you'll need to start:
// retrieve table processor from backend synth var tableProcessor = Synth.getTableProcessor("Velocity Modulator1"); // export backend table as base 64 - this is what you save in the preset file var tableData = tableProcessor.exportAsBase64(0); // restore backend table from base 64 tableProcessor.restoreFromBase64(0, tableData);
-
@Lunacy-Audio Aaaaaahhh... ok that makes more sense! Brilliant, thanks mate :)
-
Also note: You never actually need to do anything with the visible table in the UI. It should just be linked to the backend table and you do all of the processing on the backend table.
-
@Lunacy-Audio How do you mean? The UI table is just a dummy? In this case my visible table in the UI is a global LFO. So I need to create a new table to replace this one, and link it to the Global LFO?
-
I just mean in the code you only do work on the backend table. The user uses the front end table as usual, but it's linked to the backend table. You just need to set the
processorId
on the front end table component. -
@Lunacy-Audio Oh right haha, all good :) Thank you
-
@Lunacy-Audio Ok I'm officially lost :smiling_face_with_open_mouth_closed_eyes:
I can't find a way to save the Base64 string as a preset / file of any sort.
I did manage to restore a default Table shape using a simple button callback and the restoreFromBase64 API.
-
It's just a few lines. This is all in that snippet I posted. You just need to save the base64 string instead of the other two knobs I save in the example.
var tableProcessor = Synth.getTableProcessor("Velocity Modulator1"); var tableData = tableProcessor.exportAsBase64(0); var userPresetFolder = FileSystem.getFolder(FileSystem.UserPresets); var presetFile = userPresetFolder.getChildFile("MyCoolTableData.preset"); presetFile.writeObject(tableData);
-
@Lunacy-Audio Thanks mate. So I've given this a go but so far its kinda half way there. I can get the Table shape into a preset file, and load it back in, but there's a few issues - firstly; all my Presets' table shapes change to whatever I just saved, and then saving/loading a new file doesn't change the shape. I've tried to merge it with your mini preset menu snippet in case you can see where I'm going wrong!
Thanks in advance for any help with this :)
HiseSnippet 4770.3oc4a07ibajcmsjngl1VN9qDDDj.PnSsVoL6Lijk8XiMd3GU2MmljEM+X5oGGm08zMaMbmdZ1aSNi7rFBw.4Ptr.AKPNkSAH.IXABB1+DBPRtjSKvdHWxg8Og8b7AkWUjrppY+gZIXGrKx.Hgtp5Uu526i58dUQR2YIChRSSlIUaqfqmFIU6Mj8udR1Y5m0OdhjogTsaK6NKJMJSR65o8SSiFJUq1MaQFs1V2Rh92u4Sz5Ot+jAQ7tjjNJIdPjU7EwY7dcOnS73wM6OLJH9BApezAlCRlnmLN4R.I2TdGoo8Gbd+mD4zmP1Mjkp8ZngwYIy7y5mEkJU6VZICu1+rjmNIm9ihSiOcbDowtR9.ix6tYx3gDDS9sj9YwiG5VJwoRR0jc4x+Myk+2S1NdXLqetd3snCnvmgn9n1MVG71UDd6rT3s6xfWMA3cqb381x9ClEOMiOBAautr4jrnYi5Cl.QXkSqzMF8Vx5I.ESx19h9mG0bFzfMiFOdmcdfx6uyN26iuS86T+6+8UHzNKYbpRVhxoQJo8uJZnR7DkoTGg6TGrUoYJW0elh+33AmC+2vnYJ+.kx03IQY5IWLMYBznwcEn4tjkfOasn9WlEO5xwZWlkkLYkbnBcU3RVePyxzG.SnNvDVDL2HMtqUS7tKaxF8y5CyadFsczWNMYVlZpV+znG+nFb0iQzn3IQoJ8GOVYPopp+jgJCfdNEbbSUFA.IWaob5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4Hl4y+6.Hds4Vu4++L2pWBTu5jmX2OaVLT2lrykW3CIuFDAHYBb5HxKcJbFJxTos2gzlnY7ilLj134veECtKocshA2sbv+OYMtn+fYI+vxudTvvcaZOfbOg9IOukrMosB68DUVdms2Q5BH03Obv.h59OEzOKeN68JLmG9JLmG8JLm2+UXNO9UXNevqvb9v0NGRUIpWB4fx2JBc3hxirWikEq1Mk9eAG54Re
-
@DanH You forgot to put
data
in front oftableData
in line 78. Remember thatdata
is the object you're loading from the preset, so you need to refer to that when restoring the values.Should read:
tableProcessor.restoreFromBase64(0, data.tableData);
-
@Lunacy-Audio Amazing thank you!! Is it possible to save these presets to a different folder and as a different type of file than .preset? For example save a .lfo into a folder called 'LFO'? When I change the path and extensions I get errors....