HISE Logo Forum
    • Categories
    • Register
    • Login

    SNEX & JSON

    Scheduled Pinned Locked Moved General Questions
    18 Posts 5 Posters 709 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by

      Can SNEX load arrays from JSON files dynamically? I'm not actually up to that part yet but just asking ahead of time in case I need to do something different 😂

      orangeO 1 Reply Last reply Reply Quote 0
      • orangeO
        orange @A Former User
        last edited by

        @iamlamprey SNEX engine uses a different compiler that requires compiling the SNEX stuff to the dll before exporting the plugin.

        So, since you have to compile SNEX to the dll, you can not load stuff dinamically. But you can use the brand new HardcodedMasterFX for loading the pre dll compiled nodes like SlotFX unit.

        develop Branch / XCode 13.1
        macOS Monterey / M1 Max

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @orange
          last edited by A Former User

          @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 :)

          orangeO 1 Reply Last reply Reply Quote 0
          • orangeO
            orange @A Former User
            last edited by orange

            @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.

            develop Branch / XCode 13.1
            macOS Monterey / M1 Max

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

              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?

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @A Former User
                last edited by Christoph Hart

                @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.

                ? 3 Replies Last reply Reply Quote 1
                • ?
                  A Former User @Christoph Hart
                  last edited by

                  @Christoph-Hart perfect, thank you!

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @Christoph Hart
                    last edited by A Former User

                    @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:

                    4b299262-9095-4927-944e-f6eeaec44b7c-image.png

                    Do I need to referTo somewhere? Or is that handled by the external data function

                    ? 1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User @A Former User
                      last edited by

                      okay I had the old externalData method at the bottom of the node still there :) everything working now!

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        Sawer @A Former User
                        last edited by

                        Screenshot 2022-07-05 at 12.07.12.png

                        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.

                        Matt_SFM 1 Reply Last reply Reply Quote 0
                        • Matt_SFM
                          Matt_SF @Sawer
                          last edited by

                          @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

                          Develop branch
                          Win10 & VS17 / Ventura & Xcode 14. 3

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            Sawer @Matt_SF
                            last edited by

                            @Matt_SF
                            Screenshot 2022-07-05 at 12.57.10.png

                            The editor is still not here, strange..

                            Christoph HartC Matt_SFM 2 Replies Last reply Reply Quote 0
                            • Christoph HartC
                              Christoph Hart @Sawer
                              last edited by

                              @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).

                              S 1 Reply Last reply Reply Quote 0
                              • Matt_SFM
                                Matt_SF @Sawer
                                last edited by

                                @Sawer sorry I forgot that. With the default layout, the SNEX tab is already there.

                                Develop branch
                                Win10 & VS17 / Ventura & Xcode 14. 3

                                1 Reply Last reply Reply Quote 0
                                • S
                                  Sawer @Christoph Hart
                                  last edited by

                                  @Christoph-Hart
                                  Screenshot 2022-07-05 at 22.29.22.png
                                  Should it be in this list right?

                                  Christoph HartC 1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart @Sawer
                                    last edited by

                                    @Sawer Yes, update to the latest version:

                                    fe72af3b-ccc2-4b12-b3d3-d1f23d5f2d33-image.png

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      Sawer @Christoph Hart
                                      last edited by

                                      @Christoph-Hart Thanks so much

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User @Christoph Hart
                                        last edited by A Former User

                                        @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

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post

                                        50

                                        Online

                                        1.7k

                                        Users

                                        11.7k

                                        Topics

                                        101.8k

                                        Posts