Snex_node Needs to be wrapped into a compileable DSP Network

  • @Christoph-Hart Hi Christoph
    What This Means ?
    How To Wrap It ?

    Snex_node Needs to be wrapped into a compileable DSP Network
    I Tried To compile A ScriptFx With Snex Node In it
    And Seen This Message.

  • I'll post this here, but will move it to the docs later 🙂

    Everything that is using the SNEX compiler in HISE must be compiled to a C++ class for the exported plugin (the JIT compiler is not included in the codebase of a exported plugin). This includes:

    • any SNEX node
    • any expression node (control.cable_expr and math.expr)
    • any expression in a parameter connection (the Expression property)

    So what you need to do if you have one of these nodes in a network that you like to export is:

    1. Move that node into a separate network
    2. Duplicate its parameters in the root network and connect them to the node
    3. Set this network to be compiled
    4. Replace the node in your original network with the DSP network that you've wrapped it in. Now it is still using the SNEX node, but if you
    5. Run the Compile DSP Networks command in the SNEX workbench, it will use the hardcoded version of that network.

    Since this is a very tedious process, there is a helper function available that does the steps 1-4 for you automatically. Let's say that we have this patch (which is the infamous saturation effect from the HISE saturator):


    I've picked the math.expr node for this, but the procedure is the same for SNEX nodes.

    Now we want to prepare this network for compilation, that means that thing has to go. Save the network, select the node, then click on the Wrap icon in the toolbar:


    And choose the first item Wrap into DSP Network. It will now show you this frankenstein patch:


    As you can see it has preserved the connection from the Saturation parameter to the first parameter of the chain, which itself connects back to the original destination.

    Now I said Frankenstein, because this intermediate is not the final state (and if you've read the popup message carefully you know why). The process has created an additional DspNetwork (which can be found in the network folder) called saturator.xml, but it hasn't replaced it yet. All you need to do is to reload that patch to make it use the proper network. So please click File -> Save and Reload, then you will see this:


    The saturation node has now been replaced by a nested DSP network - you can think of it like a folder that encapsulates an entire network as a opaque node. If you click on the


    icon, it will zoom in the network (and you can navigate the network hierarchy with the breadcrumbs in the toolbar).

    If you want to add a nested network for yourself, you can simply do so - the project category holds all networks available in the current project:


    We're still not at the end of this process though - even if it's tucked away in another network, the SNEX compiler is still doing the work, so what we need to do is to create a C++ class from this network. This is done by compiling the project DLL using Tools - Compile DSP Networks. This will launch a mini version of the compile exporter known from HISE and will compile all networks in the project into a small dynamic library that is loaded back into the workbench. If the compilation goes through smoothly, you will see a popup message that shows all "compiled" networks in this project:


    By default, the SNEX workbench will not compile every network, but only the ones that you choose to export (that is why the original network "satWrapper" doesn't show up here). If you want to flag a network as compileable, you can edit its properties. Make sure no node is selected, then click on the properties icon in the toolbar, then enable AllowCompilation.

    Now if we reload the network one last time, you will see that a tiny thing has changed. Can you spot it?


    Or we can skip that loser version of "Where is Waldo": it's the Freeze Icon indicating that the node is currently using the "frozen" (aka compiled) version of itself. You can toggle back between the uncompiled and compiled version by clicking on that button to ensure both sound the same. Anyways, now we have gotten rid of any SNEX compiler in the signal path and the project is ready for export.

    When you run the Compile DSP network command, it will also copy the generated C++ node files to the project`s AdditionalSourceCode directory. And when you export your project, it will compile them again and embed the code into the plugin's binary, so you don't need to ship that .dll you've created during development with your plugin.

  • Thank You @Christoph-Hart For The Tutorial

  • Can We See A Video Tutorial For This,
    It's Too Complex To Understand It.
    Been Playing With It For A Few Hours, And Can't Get Amywhere

  • @Natan

    Can We See A Video Tutorial For This,

    Once I'm able to build the develop branch I'll make a video.

  • @d-healey Thank You Sir 🙂

  • Hi there, and thank you @Christoph-Hart for this tutorial !
    I'm facing an issue though : wrapping my custom node into a dsp network works as expected, but when I click 'save & reload' my custom node is gone... all that's left are the root parameter and the other 'factory nodes' I put in the signal chain... The xml file is actually saved in the folder...
    If someone has an idea of why this happens... maybe I missed something ?
    Thanks !

  • @Matt_SF Same Here

  • @Natan At first I thought I oversighted a parameter in the projucer project, I tried to compile using different options but I ended up with the same result...

  • @Matt_SF

    @d-healey said in [Snex_node Needs to be wrapped into a

    Once I'm able to build the develop branch I'll make a video.

    There is No New updated Commit Since 2 Weeks Ago, I Guess Christoph Is Making Some Big Changes, And Still Need To Wait For @d-healey To Change His Mind And Getting A Windows Machine 🙂 LOL And Bring Us An Indepth Tutorial 🙂

  • @Natan said in Snex_node Needs to be wrapped into a compileable DSP Network:

    To Change His Mind And Getting A Windows Machine

    I have a Windows machine 😛 but I only use it for compiling, I have no desire to spend any time with it.

  • @d-healey said in Snex_node Needs to be wrapped into a compileable DSP Network:

    I have no desire to spend any time with it.

    I really shoul give Linux a try...
    (Completey unrelated to the post) 😋

  • @Matt_SF Same for me

  • @Christoph-Hart I'm suffering from a severe node-tweaking deficiency so I'm making a small bump 😁

Log in to reply