HISE Logo Forum
    • Categories
    • Register
    • Login

    Scripnode 101

    Scheduled Pinned Locked Moved General Questions
    157 Posts 13 Posters 14.5k 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.
    • C
      crd
      last edited by

      Has anyone successfully exported a plugin with a script node network/dll?

      I was able to export for a while without compiling a dll but now I am getting an error:Screen Shot 2022-01-28 at 5.14.25 PM.png

      and the script node workbench crashes whenever I try to compile wrapped dsp nodes into a dll.

      Dan KorneffD 1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff @crd
        last edited by

        @crd I'm successfully exporting scriptnode plugins with compiled dll.

        Dan Korneff - Producer / Mixer / Audio Nerd

        1 Reply Last reply Reply Quote 1
        • Dan KorneffD
          Dan Korneff
          last edited by Dan Korneff

          What's the best way to access L/R inputs to process them separately in SNEX?
          Can we use arrays in SNEX?

          @Christoph-Hart is there an example showing how to use block?

          block - a wrapper around a preallocated buffer of float numbers
          

          When I try to initialize an index of a block with a number, I get an error saying statement cant be parsed.

          Dan Korneff - Producer / Mixer / Audio Nerd

          ustkU 2 Replies Last reply Reply Quote 0
          • ustkU
            ustk @Dan Korneff
            last edited by ustk

            @dustbro got it to work for the left channel only, it might be obvious why data[1] isn't working but I can't find...

            	// Process the signal here
            	template <typename ProcessDataType> void process(ProcessDataType& data)
            	{
            		for (auto& s: data[0])
            			s *= 0.5f;
            	}
            

            Can't help pressing F5 in the forum...

            1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @Dan Korneff
              last edited by ustk

              @dustbro oh I finally found a solution

              	// Process the signal here
              	template <typename ProcessDataType> void process(ProcessDataType& data)
              	{
              		auto frame = data.toFrameData();
              		    
              		while(frame.next())
              		{
              			frame[0] *= levelLeft;
              			frame[1] *= levelRight;
              		}
              	}
              

              Can't help pressing F5 in the forum...

              Dan KorneffD 1 Reply Last reply Reply Quote 1
              • Dan KorneffD
                Dan Korneff @ustk
                last edited by

                @ustk Thanks! What about the function to process the input?

                For instance, the SNEX shaper has:

                float getSample(float input)
                {
                       return input;
                }
                

                Anything other than float input returns a parse error.

                Dan Korneff - Producer / Mixer / Audio Nerd

                1 Reply Last reply Reply Quote 0
                • Dan KorneffD
                  Dan Korneff
                  last edited by

                  @Christoph-Hart is there a simple example that shows how to do this with an SNEX node?

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  ustkU 1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @Dan Korneff
                    last edited by ustk

                    @dustbro getSample is just a way to make an external function from the process one, nothing prevents you to remove it and make your algorithm directly in the process function, or make one getLeftSample and one getRightSample like below:

                    	float getLeftSample(float input)
                    	{
                    		return Math.tanh(input);
                    	}
                    	
                    	float getRightSample(float input)
                    	{
                    		return Math.tanh(input);
                    	}
                    	
                    	template <typename T> void process(T& data)
                    	{
                    		auto frame = data.toFrameData();
                    		    
                    		while(frame.next())
                    		{
                    			frame[0] = getLeftSample(frame[0]);
                    			frame[1] = getRightSample(frame[1]);
                    		}
                    	}
                    	
                    

                    The only thing is that this way of using process to separate the channels actually transforms it in a frame processing. So if you want block processing of separated channels, I don't know the trick.

                    Can't help pressing F5 in the forum...

                    Dan KorneffD 1 Reply Last reply Reply Quote 1
                    • Dan KorneffD
                      Dan Korneff @ustk
                      last edited by

                      @ustk said in Scripnode 101:

                      if you want block processing of separated channels, I don't know the trick

                      Thanks again for this!
                      That's what I was doing, but got unexpected results. Now that I look a little closer, it appears that placing an SNEX node into a frame2_block returns a mono signal.

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      ustkU 1 Reply Last reply Reply Quote 0
                      • ustkU
                        ustk @Dan Korneff
                        last edited by

                        @dustbro Strange indeed...

                        Can't help pressing F5 in the forum...

                        Dan KorneffD 1 Reply Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @ustk
                          last edited by

                          @ustk Looks like it's my code in processFrame. Lemme see if I can figure out the magic potion.

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          ustkU 1 Reply Last reply Reply Quote 0
                          • ustkU
                            ustk @Dan Korneff
                            last edited by ustk

                            @dustbro That's what I'm doing, as you can see the output is stereo:

                            Screenshot 2022-02-01 at 13.12.55.png

                            Can't help pressing F5 in the forum...

                            Dan KorneffD 1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff @ustk
                              last edited by Dan Korneff

                              @ustk The framex_block gets it's stream from processFrame. If you leave that blank, the output will be unprocessed.

                              Here's the same example using an oscilloscope to see the results of placing the SNEX node into the frame block. I'm inverting one channel for easier viewing.

                              INVERT.gif

                              Dan Korneff - Producer / Mixer / Audio Nerd

                              ustkU 2 Replies Last reply Reply Quote 1
                              • ustkU
                                ustk @Dan Korneff
                                last edited by

                                @dustbro Oh yes of course! My bad!!!

                                Can't help pressing F5 in the forum...

                                1 Reply Last reply Reply Quote 0
                                • ustkU
                                  ustk @Dan Korneff
                                  last edited by

                                  @dustbro Then you might not need a frame2_block, or?

                                  Can't help pressing F5 in the forum...

                                  Dan KorneffD 1 Reply Last reply Reply Quote 0
                                  • Dan KorneffD
                                    Dan Korneff @ustk
                                    last edited by

                                    @ustk Maybe, but without the frame2_block my DSP is glitchy and distorted.

                                    Dan Korneff - Producer / Mixer / Audio Nerd

                                    ustkU 2 Replies Last reply Reply Quote 0
                                    • ustkU
                                      ustk @Dan Korneff
                                      last edited by

                                      @dustbro That kinda makes sense. I'm trying to get the channels in the processFrame with no luck. in fact it works for the left channel but not for the right one. I'm investigating the use of span with no more luck since yesterday...

                                      Can't help pressing F5 in the forum...

                                      1 Reply Last reply Reply Quote 1
                                      • ustkU
                                        ustk @Dan Korneff
                                        last edited by ustk

                                        @dustbro Got something! Try this:

                                        	float getLeftSample(float input)
                                        	{
                                        		return input;
                                        	}
                                        	
                                        	float getRightSample(float input)
                                        	{
                                        		return input * 0.05f;
                                        	}
                                        	
                                        	// Process the signal here
                                        	template <typename ProcessDataType> void process(ProcessDataType& data)
                                        	{
                                        	}
                                        	
                                        	// Process the signal as frame here
                                        	template <int C> void processFrame(span<float, C>& data)
                                        	{
                                        		for (int i = 0; i<2; i++)
                                        		{
                                        			auto& s = data[i];
                                        			
                                        			s = i == 0 ? getLeftSample(s) : getRightSample(s);
                                        		}
                                        	}
                                        

                                        Can't help pressing F5 in the forum...

                                        Dan KorneffD 1 Reply Last reply Reply Quote 1
                                        • Dan KorneffD
                                          Dan Korneff @ustk
                                          last edited by Dan Korneff

                                          @ustk Nice one! That's pretty close. Something about it is making the DSP process differently on each channel.
                                          process.png

                                          Trying my code again with just the process block seems to work now with:

                                          	auto frame = data.toFrameData();
                                          

                                          Since the data is being converted to frame data, I no longer need to use a frame?_block.

                                          I can now pop it into a fix_block without glitches :)
                                          processbuffer.png

                                          Dan Korneff - Producer / Mixer / Audio Nerd

                                          ustkU 1 Reply Last reply Reply Quote 1
                                          • ustkU
                                            ustk @Dan Korneff
                                            last edited by

                                            @dustbro Glad it works :)
                                            But strange the last solution with the processFrame isn't working properly...

                                            Can't help pressing F5 in the forum...

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

                                            14

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts