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

      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

                                46

                                Online

                                1.7k

                                Users

                                11.7k

                                Topics

                                101.8k

                                Posts