Bit confused: How to load a json file?
-
I'm trying to load in an external json file.
I don't like pasting in giant arrays.// We need to create & initialise the network via script, the scriptnode node will then reference // the existing network const var neuralOsc = Engine.createNeuralNetwork("JoshSine2"); //const var audioFolder = FileSystem.getFolder(FileSystem.AudioFiles); //var jfile = audioFolder.getChildFile("01.json"); //reg joshJson = jfile.loadAsObject(); // load the sine wave approximator network var joshJson = Engine.loadFromJSON("{PROJECT_FOLDER}/01.json"); // loads a JSON file into an object. neuralOsc.loadTensorFlowModel(joshJson); // Now head over to the Scriptnode Synthesiser where this model is used by the math.neural node...
This is definitely not right
-
This post is deleted! -
@griffinboy said in Bit confused: How to load a json file?:
This is definitely not right
Other than
var
instead ofconst
I don't see a problem.If you're loading from outside the project folder you can use the File and FileSystem APIs to load a file as an object.
-
@d-healey But in this case that would mean delivering the file in question along with the binary, right? I am not sure it is "appropriate" for a neural model.
@griffinboy Why not simply paste it in an included script file that only serves this purpose? After all, having an include line or a variable you load a json into, there are not much differences in terms of code weight
-
This post is deleted!