SNEX & JSON
-
@orange Can you pass data through to the SNEX node through the masterFX stuff? I have like 40something thousand points of data so modulating parameter sliders isn't going to work
Edit: Probably easier if I restructure the question:
span<float, 1000> amplitudes = {9.39368486e-01f, 8.45795572e-01f, 7.28350461e-01f, 6.44296527e-01f, 5.82393408e-01f, 5.30696571e-01f, 4.90134478e-01f, 4.56860274e-01f, 4.33835536e-01f, 4.17075038e-01f, 3.98857445e-01f, 3.80587161e-01f};
Here's 10 of the first 1000 amplitude values (samples/frames) of a sample, I can add these to a
span<float, 10>
and use them to adjust the output level on a per-sample basis:template <int C> void processFrame(span<float, C>& data) { for (auto& s: data) { //deleted secret stuff :) //apply the amplitude envelope s *= amplitudes[step]; } }
But obviously making a thousand-length array for this inside SNEX isn't ideal, especially when I also need ones for other parameters like harmonic distribution and filters.
Is there any option to put these massive arrays into external files, or pass them through to the DSP via the Hardcoded Master FX?
I'd like to avoid simplifying / interpolating between the values, as it's a physical model so realism is important :)
-
@iamlamprey I haven't tried something like that much. But AFAIK there is a limit for the Parameters in SN/SNEX, thus there should be a limit for the Modulation stuff too.
-
I also saw this post: https://forum.hise.audio/topic/3300/passing-array-from-a-script-to-snex-jit-node
@ustk @Christoph-Hart has there been any updates on this?
-
@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