HISE Logo Forum
    • Categories
    • Register
    • Login

    SNEX nodes - Waveshaping / Saturation / Distortion?

    Scheduled Pinned Locked Moved General Questions
    44 Posts 7 Posters 3.3k 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.
    • Matt_SFM
      Matt_SF @Dan Korneff
      last edited by

      @dustbro said in SNEX nodes - Waveshaping / Saturation / Distortion?:

      @matt_sf said in SNEX nodes - Waveshaping / Saturation / Distortion?:

      but actually requires floats

      How did you figure that one out???

      Just an idea : seem odd that the node said it can't resolve the math. Tried it. Worked 😄
      But actually it also works if you write : Math.pow(int, float) ot Math.pow(float, int).... Guess the result of the Math.pow() have to be float...
      (I really like nodes but I'm really not a DSP expert)

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

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

        Woah, system error ... information overload...

        I really need some completed docs and a proper tutorial on how all of these things are supposed to work together.

        Soon. I just want to finalize the workflow before writing the docs because I've already written it twice.

        So a short glossary:

        • Scriptnode is the entire visual graph DSP environment that is based on a script processor but replaces the process(channel) and prepare() callbacks with the processing of the graph you specify.
        • SNEX is a language that is a subset of C++ and HISE (not the compiled plugins) has a JIT compiler that is used in various places.
        • SNEX nodes are nodes inside scriptnode that dynamically compile SNEX code and run it. There are different nodes for different applications (eg. a node for oscillators, a node for timers, a node for wave shapers). The logic for these nodes is defined in a class that is loaded from a separate file.
        • if you have a very simple expression that fits into one line, you can use the math.expr node (or the control.expression nodes). They will also use the SNEX JIT compiler but without the overhead of the class syntax required by all other nodes.

        Now for your use case I would suggest the snex.shaper node, which gives you a full class and some callbacks to perform the wave shaping. You'll still get the shape display and you can add multiple custom parameters.

        There are in total 3 different applications which use SNEX:

        1. HISE itself.
        2. The SNEX workbench, which is a trimmed down version of HISE and focusses on scriptnode development. The only exclusive feature of the SNEX workbench is the ability to compile SNEX code into a C++ library which can be loaded by HISE (as a .dll plugin). This step is required to get anything that uses SNEX in a compiled plugin (we are compiling the plugin with a real compiler anyway so there's almost no benefit of dragging the JIT compiler around in exported projects).
        3. The SNEX playground. This is nothing more than a code editor with the JIT compiler attached to it and some facilities to load and run tests. I use this primarily for implementing & testing JIT compiler features but it's also a low overhead option to dive into SNEX (the language). If you click on the SNEX icon on the top left you'll get a drop down where you can load different test files and inspect what they do (they cover most of the language features).
        Dan KorneffD 4 Replies Last reply Reply Quote 5
        • Dan KorneffD
          Dan Korneff @Christoph Hart
          last edited by

          @christoph-hart Thank you for this! I'm gonna tinker and come back with more questions 💩

          Dan Korneff - Producer / Mixer / Audio Nerd

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

            @christoph-hart noticed that the workbench app is missing it's icon after you build.
            I have an icon suggestion: :grinning_face_with_sweat:

            cable-mess1-1024x768.jpg

            Dan Korneff - Producer / Mixer / Audio Nerd

            1 Reply Last reply Reply Quote 3
            • Dan KorneffD
              Dan Korneff @Christoph Hart
              last edited by

              Does anyone have some wisdom to share on the delay nodes?
              Is there one that can be modulated in real time without artifacts?
              How do you sync them to Host BPM?
              Is there a node that has a longer delay time than 1000ms? or do I need to mod the source code?

              Dan Korneff - Producer / Mixer / Audio Nerd

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

                @dustbro sending you here :

                Snex_node Needs to be wrapped into a compileable DSP Network

                We discussed the matter, but long story short : jdsp.delay and fix8.container.

                For the sync there is a control.tempo_sync node available

                Is there a node that has a longer delay time than 1000ms

                jdsp.delay >> right-click on the 'DelayTime' parameter and adjust the maxValue

                :)

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

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

                  @matt_sf My hero!

                  Dan Korneff - Producer / Mixer / Audio Nerd

                  1 Reply Last reply Reply Quote 2
                  • Dan KorneffD
                    Dan Korneff @Christoph Hart
                    last edited by

                    @christoph-hart said in SNEX nodes - Waveshaping / Saturation / Distortion?:

                    I would suggest the snex.shaper node

                    Has anyone use the snex.shaper and could give me some basic guidance on usage?
                    I've added the snex.shaper node to my network, and selected "create new file".
                    hsaper.png

                    How do I begin to add expression to the node?

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      Ok... got a little bit further. Clicking on the SNEX logo opens up the node in the Snex script editor:

                      tab.png

                      how would I implement this simple equation?

                      output = (1.0 + value) * input / (1.0 + value * Math.abs(input));
                      

                      Dan Korneff - Producer / Mixer / Audio Nerd

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

                        @dustbro following... I would be interested to know more about SNEX too... I'm still trying to de-cypher everything 😅

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

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

                          @dustbro try putting this in the getSample function (which in fact can be any other function you call from this one)
                          Just don't forget the SNEX language rules (i.e. the float numbers)

                          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 said in SNEX nodes - Waveshaping / Saturation / Distortion?:

                            getSample function

                            Looks like this is the spot.

                            float getSample(float input)
                            	{
                            		input = (1.0 + 0.5) * input / (1.0 + 0.5 * Math.abs(input));
                            
                            		return input;
                            	}
                            

                            I've added a parameter to the snex module. How do i reference it in the script?

                            parameter.png

                            Dan Korneff - Producer / Mixer / Audio Nerd

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

                              @dustbro

                              float gain = 0.0f;
                              
                              float getSample(float input)
                              {
                              	return (1.0f + gain) * input / (1.0f + gain * Math.abs(input));
                              }
                              
                              /*
                              .
                              .
                              .
                              */
                              
                              template <int P> void setParameter(double v)
                              {
                              	gain = (float)v;
                              }
                              

                              This works if you have only one parameter, although if you have more then you'll need an enum to find which one is moved so you set the right variable

                              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 got it. Thanks!!

                                Dan Korneff - Producer / Mixer / Audio Nerd

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

                                  Is anyone able to compile a SNEX node to dll?

                                  I'm getting this error from VS2017 and wanna make sure it's not just my rig

                                  Severity	Code	Description	Project	File	Line	Suppression State
                                  Error	C2662	'void scriptnode::wrap::no_data<scriptnode::core::snex_shaper<snex_shaper_impl::snex_shaper<1>>>::setParameter<0>(double)': cannot convert 'this' pointer from 'T' to 'scriptnode::wrap::no_data<scriptnode::core::snex_shaper<snex_shaper_impl::snex_shaper<1>>> &'	snex compile_DynamicLibrary	c:\users\dan\documents\github\hise\hi_dsp_library\node_api\nodes\processors.h	421	
                                  
                                  

                                  Dan Korneff - Producer / Mixer / Audio Nerd

                                  DanHD 1 Reply Last reply Reply Quote 0
                                  • DanHD
                                    DanH @Dan Korneff
                                    last edited by

                                    @dustbro I've compiled a script fx to .dll but it didn't have a SNEX node in it (in case that helps! :face_with_tears_of_joy: )

                                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                    https://dhplugins.com/ | https://dcbreaks.com/
                                    London, UK

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

                                      @danh said in SNEX nodes - Waveshaping / Saturation / Distortion?:

                                      it didn't have a SNEX node

                                      Same here. I can compile script FX that do not contain SNEX nodes.

                                      Dan Korneff - Producer / Mixer / Audio Nerd

                                      DanHD Matt_SFM 2 Replies Last reply Reply Quote 0
                                      • DanHD
                                        DanH @Dan Korneff
                                        last edited by

                                        @dustbro out of interest can you export a plugin that has a compiled .dll in it?

                                        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                        https://dhplugins.com/ | https://dcbreaks.com/
                                        London, UK

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

                                          @danh I can. It MOSTLY works pretty well ;)

                                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                                            @dustbro said in SNEX nodes - Waveshaping / Saturation / Distortion?:

                                            Same here. I can compile script FX that do not contain SNEX nodes.

                                            Do you get the "frozen" icon on your compiled nodes ? Here I can wrap the network, compiling it doesn't show any errors (seems to go well) but HISE is not using the compiled node.

                                            BTW I didn't try to compile a SNEX node yet because I'm not smart enough ATM to understand how to write SNEX code 😂

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

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

                                            18

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            103.2k

                                            Posts