SNEX & JSON
-
@iamlamprey If it's ten's of thousands of float numbers, you can write the data as audio file (you can do this in HISE itself with
File.writeAudioFile(var audioData, double sampleRate, int bitDepth)
) and then load it through the ExternalData interface.In the snex code you do this:
template <int NV> struct mynode { // tell the compiler that it should have one external file slot // If you recompile the node, you can click on the popup button // to show the audio waveform... static const int NumAudioFiles = 1; // this is basically the same as a span but with a dynamic // length that can reference external float data dyn<float> envData; void setExternalData(const ExternalData& ed, int index) { ed.referBlockTo(envData, 0); } }
If you don't use an external file slot, it will write a C++ float array of the embedded audio data on plugin compilation.
-
@Christoph-Hart perfect, thank you!
-
@Christoph-Hart Got the file-writing stuff all working, and I think the dynData is referencing the audio data properly, but both of these make HISE crash:
template <int C> void processFrame(span<float, C>& data) { for (auto& s: data) { //crashes s *= (float)amplitudesData[index]; //also crashes (i know its overwriting the data I just wanted to test a loop) for(auto& a: amplitudesData) { a = 0.01f; } } }
Could this be an issue with how I wrote the audio file? Or am I doing something else stupid
Edit: Think I'm stupid, I assume this is supposed to have more than just a block:
Do I need to referTo somewhere? Or is that handled by the external data function
-
okay I had the old externalData method at the bottom of the node still there :) everything working now!
-
Hello everyone. How can I see the snex editor? Not seeing it in the scripting tools nor when calling a snex node. any help is appreciated.
-
@Sawer you have to create a new file by clicking on the three dots on the left, ther click on the SNEX logo on the right
-
The editor is still not here, strange..
-
@Sawer You need to create a SNEX Editor floating tile (it's a different editor than the HiseScript editor). Right click on the empty Floating tile and select SNEX editor (should be somewhere at the top), then unclick and click the SNEX button on the node again, and it will show up).
-
@Sawer sorry I forgot that. With the default layout, the SNEX tab is already there.
-
@Christoph-Hart
Should it be in this list right? -
@Sawer Yes, update to the latest version:
-
@Christoph-Hart Thanks so much
-
@Christoph-Hart said in SNEX & JSON:
If it's ten's of thousands of float numbers, you can write the data as audio file
Is this also appropriate for multidimensional arrays? [[a, b, c], [d, e, f]]
Edit: ah could I pass an sfz instead of wav for more complex data?
Edit edit: Okay I can just have multiple audio files :) easy