HISE Logo Forum
    • Categories
    • Register
    • Login

    ScriptNode Compilation Workflow and What to Do About It

    Scheduled Pinned Locked Moved ScriptNode
    70 Posts 11 Posters 5.2k 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 @Christoph Hart
      last edited by

      @Christoph-Hart awesome, thank you Christoph!

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

      1 Reply Last reply Reply Quote 0
      • A
        aaronventure @Christoph Hart
        last edited by

        @Christoph-Hart Ahh that's right, now that you removed the need to restart HISE, networks marked as Allow Compilation can be compiled prior to the exporting process.

        Is this what this dialog does? Are networks marked as Allow compilation now automatically compiled on export, i.e. there's no need for swapping them for hardcoded anymore just for the export and I can work on them, click export, test my plugin, then come back and the network is still editable?

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

          Are networks marked as Allow compilation now automatically compiled on export,

          Nope, but almost. On compilation the ScriptFX modules are replaced with their hardcoded counterpart so we're 80% there. What's missing is that if there is no DLL present at all (or the DLL was never exported manually once before), it won't create the C++ files for the networks that will be included in the plugin export.

          I've added this step now too in the compilation process although I'm hitting a few issues with hardcoded FX not being initialised correctly if there is no DLL present.

          I'll sort this out and then commit it, but this will make it very convenient - you actually do not have to bother at all about compiling scriptnode networks anymore and it will be all taken care of at plugin export - unless you want to compile the DLLs before to see that state during development.

          A 1 Reply Last reply Reply Quote 4
          • A
            aaronventure @Christoph Hart
            last edited by aaronventure

            @Christoph-Hart Awesome!

            Let me run down the original post and see if I understood you correctly.

            1. Individual SNEX Nodes and single-instance Faust .dsp programs

            This is now solved because the networks get compiled automatically at export.

            2. Function-like Node Chains and Nested Networks

            You mentioned this could be behind collapsible node chains (lock thing). I mentioned functions in Unreal Blueprint. Also, if I got it right, networks cannot be nested unless they're compiled first. How does this play with a workflow where we need to compile just that network? To be clear, I'm talking about editable network chains that are used repeatedly across networks, which, when edited, update appropriately everywhere.

            3. Faust Specifically

            While single-instance Faust nodes need no compilation anymore, requiring a single .dsp Faust program to be used across multiple places in a network (or networks) will still pose challenges:

            • when the .dsp file itself is changed, are all Faust nodes sporting that .dsp file automatically updated across all networks or do we have to manually hit the refresh button?
            • why are parameters not being rebuilt on every compile? I found that there's zero downside to doing it other than the second long visual glitch, because the cable connections always get restored properly. It's just an unnecessary extra step that you always have to do when you make parameter changes, and it always does recompilation again anyway. The node craps itself anyway (all the parameters go away) if you have a code error, and the rebuilding happens then. Why not have it happen all the time and remove this manual step from the workflow altogether?

            Sometimes Faust is a good alternative to making a long node chain, so this is in fact also the other side of #2 problem in this post, it's just done in Faust.

            1 Reply Last reply Reply Quote 0
            • DabDabD
              DabDab
              last edited by DabDab

              Hardcoded Master FX and hardcoded Polly FX Instant crashing HISE.

              HSD.gif

              Bollywood Music Producer and Trance Producer.

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

                @DabDab try deleting the DLL in your project and try again.

                DabDabD ChazroxC 2 Replies Last reply Reply Quote 0
                • DabDabD
                  DabDab @Christoph Hart
                  last edited by

                  @Christoph-Hart Tried. Not working. Still crashing.

                  Bollywood Music Producer and Trance Producer.

                  ChazroxC 1 Reply Last reply Reply Quote 0
                  • ChazroxC
                    Chazrox @DabDab
                    last edited by

                    @DabDab Im currently experiencing problems compiling dsp's also causing immediate crash upon clicking compile. I've resorted to only using script fx nodes as it allows me to still use certain features but im still not able to work at full capacity for some reason that I cant figure out. This thread seems like its right on point!

                    1 Reply Last reply Reply Quote 1
                    • ChazroxC
                      Chazrox @Christoph Hart
                      last edited by

                      @Christoph-Hart Where do I get the latest version of HISE as you guys are updating? Sorry if im redundant, im still new to this. You're greatly appreciated!

                      DabDabD 1 Reply Last reply Reply Quote 0
                      • DabDabD
                        DabDab @Chazrox
                        last edited by

                        @Chazrox said in ScriptNode Compilation Workflow and What to Do About It:

                        Where do I get the latest version of HISE as you guys are updating?

                        Link Preview Image
                        GitHub - christophhart/HISE: The open source framework for sample based instruments

                        The open source framework for sample based instruments - christophhart/HISE

                        favicon

                        GitHub (github.com)

                        Bollywood Music Producer and Trance Producer.

                        ChazroxC 1 Reply Last reply Reply Quote 0
                        • ChazroxC
                          Chazrox @DabDab
                          last edited by

                          @DabDab Thank you.

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

                            Not working. Still crashing.

                            Oops, forgot to push a simple typo... should be fixed now.

                            DabDabD ustkU 2 Replies Last reply Reply Quote 1
                            • DabDabD
                              DabDab @Christoph Hart
                              last edited by

                              @Christoph-Hart Please add currentGitHash.txt and currentGit.h files.

                              Bollywood Music Producer and Trance Producer.

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

                                @DabDab yup, done.

                                DabDabD 1 Reply Last reply Reply Quote 0
                                • DabDabD
                                  DabDab @Christoph Hart
                                  last edited by

                                  @Christoph-Hart Yup.. Working fine now !! bb507f34-48cf-49ed-aa09-020d202e72f7-image.png

                                  @griffinboy thanks for the LPF. Can we get HPF ?

                                  Bollywood Music Producer and Trance Producer.

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

                                    @DabDab HPF = signal - LPF?

                                    DabDabD griffinboyG 2 Replies Last reply Reply Quote 0
                                    • DabDabD
                                      DabDab @Christoph Hart
                                      last edited by DabDab

                                      @Christoph-Hart Well I don't know much C++ DSP How High pass filter is structured in C++.

                                      Bollywood Music Producer and Trance Producer.

                                      1 Reply Last reply Reply Quote 0
                                      • griffinboyG
                                        griffinboy @Christoph Hart
                                        last edited by

                                        @Christoph-Hart

                                        From my understanding, that'll kind of work but not completely.
                                        I'll release a highpass version at somepoint

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

                                          From my understanding, that'll kind of work but not completely.

                                          It does with the only filter I've been writing myself - a one pole. Thanks for coming to my TED Talk.

                                          griffinboyG 1 Reply Last reply Reply Quote 2
                                          • DabDabD
                                            DabDab
                                            last edited by DabDab

                                            I have tried to make it a High Pass Filter from the Griffin_LadderFilter.h provided by @griffinboy
                                            I am not a good C++ DSP programmer. Test it whether it is working or not.

                                            /*
                                            Copyright (c) 2024 griffinboy
                                            
                                            Permission is hereby granted, free of charge, to any person obtaining a copy
                                            of this software and associated documentation files (the "Software"), to deal
                                            in the Software without restriction, including without limitation the rights
                                            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                                            copies of the Software, and to permit persons to whom the Software is
                                            furnished to do so, subject to the following conditions:
                                            
                                            The above copyright notice and this permission notice shall be included in all
                                            copies or substantial portions of the Software.
                                            
                                            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                                            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                                            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                                            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                                            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                                            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
                                            SOFTWARE.
                                            */
                                            
                                            #pragma once
                                            #include <JuceHeader.h>
                                            
                                            namespace project
                                            {
                                                using namespace juce;
                                                using namespace hise;
                                                using namespace scriptnode;
                                            
                                                template <typename T>
                                                class ScopedValue
                                                {
                                                public:
                                                    explicit ScopedValue(T& val) : value(val), ref(val) {}
                                                    ~ScopedValue() { ref = value; }
                                                    T& get() { return value; }
                                            
                                                private:
                                                    T value;
                                                    T& ref;
                                                    ScopedValue(const ScopedValue&) = delete;
                                                    ScopedValue& operator=(const ScopedValue&) = delete;
                                                };
                                            
                                                template <int NV>
                                                struct Griffin_HighPassFilter : public data::base
                                                {
                                                    SNEX_NODE(Griffin_HighPassFilter);
                                            
                                                    struct MetadataClass
                                                    {
                                                        SN_NODE_ID("Griffin_HighPassFilter");
                                                    };
                                            
                                                    static constexpr bool isModNode() { return false; }
                                                    static constexpr bool isPolyphonic() { return NV > 1; }
                                                    static constexpr bool hasTail() { return true; }
                                                    static constexpr bool isSuspendedOnSilence() { return false; }
                                                    static constexpr int getFixChannelAmount() { return 2; }
                                            
                                                    static constexpr int NumTables = 0;
                                                    static constexpr int NumSliderPacks = 0;
                                                    static constexpr int NumAudioFiles = 0;
                                                    static constexpr int NumFilters = 0;
                                                    static constexpr int NumDisplayBuffers = 0;
                                            
                                                    void prepare(PrepareSpecs specs)
                                                    {
                                                        filtersLeft.prepare(specs);
                                                        filtersRight.prepare(specs);
                                            
                                                        for (auto& filter : filtersLeft)
                                                            filter.prepare(specs.sampleRate);
                                            
                                                        for (auto& filter : filtersRight)
                                                            filter.prepare(specs.sampleRate);
                                                    }
                                            
                                                    void reset()
                                                    {
                                                        for (auto& filter : filtersLeft)
                                                            filter.reset();
                                            
                                                        for (auto& filter : filtersRight)
                                                            filter.reset();
                                                    }
                                            
                                                    template <typename ProcessDataType>
                                                    void process(ProcessDataType& data)
                                                    {
                                                        auto& fixData = data.template as<ProcessData<getFixChannelAmount()>>();
                                                        auto audioBlock = fixData.toAudioBlock();
                                            
                                                        auto* leftChannelData = audioBlock.getChannelPointer(0);
                                                        auto* rightChannelData = audioBlock.getChannelPointer(1);
                                                        int numSamples = (int)data.getNumSamples();
                                            
                                                        for (auto& leftFilter : filtersLeft)
                                                        {
                                                            leftFilter.process(leftChannelData, numSamples);
                                                        }
                                            
                                                        for (auto& rightFilter : filtersRight)
                                                        {
                                                            rightFilter.process(rightChannelData, numSamples);
                                                        }
                                                    }
                                            
                                                    class AudioEffect
                                                    {
                                                    public:
                                                        AudioEffect() = default;
                                            
                                                        void prepare(float sampleRate)
                                                        {
                                                            fs = sampleRate;
                                                            reset();
                                                        }
                                            
                                                        void reset()
                                                        {
                                                            x1 = x2 = y1 = y2 = 0.0f;
                                                        }
                                            
                                                        void updateCoefficients(float fc, float q)
                                                        {
                                                            float omega = 2.0f * MathConstants<float>::pi * fc / fs;
                                                            float alpha = std::sin(omega) / (2.0f * q);
                                                            float cosOmega = std::cos(omega);
                                            
                                                            float a0 = 1.0f + alpha;
                                                            b0 = (1.0f + cosOmega) / (2.0f * a0);
                                                            b1 = -(1.0f + cosOmega) / a0;
                                                            b2 = (1.0f + cosOmega) / (2.0f * a0);
                                                            a1 = (-2.0f * cosOmega) / a0;
                                                            a2 = (1.0f - alpha) / a0;
                                                        }
                                            
                                                        void process(float* samples, int numSamples)
                                                        {
                                                            for (int i = 0; i < numSamples; ++i)
                                                            {
                                                                samples[i] = processSample(samples[i]);
                                                            }
                                                        }
                                            
                                                    private:
                                                        float fs = 44100.0f;
                                                        float b0 = 0.0f, b1 = 0.0f, b2 = 0.0f;
                                                        float a1 = 0.0f, a2 = 0.0f;
                                                        float x1 = 0.0f, x2 = 0.0f;
                                                        float y1 = 0.0f, y2 = 0.0f;
                                            
                                                        inline float processSample(float input)
                                                        {
                                                            float output = b0 * input + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
                                                            
                                                            x2 = x1;
                                                            x1 = input;
                                                            y2 = y1;
                                                            y1 = output;
                                                            
                                                            return output;
                                                        }
                                                    };
                                            
                                                    template <int P>
                                                    void setParameter(double value)
                                                    {
                                                        if (P == 0) // Cutoff Frequency
                                                        {
                                                            cutoffFrequency = static_cast<float>(value);
                                                            for (auto& filter : filtersLeft)
                                                                filter.updateCoefficients(cutoffFrequency, q);
                                            
                                                            for (auto& filter : filtersRight)
                                                                filter.updateCoefficients(cutoffFrequency, q);
                                                        }
                                                        else if (P == 1) // Q Factor
                                                        {
                                                            q = static_cast<float>(value);
                                                            for (auto& filter : filtersLeft)
                                                                filter.updateCoefficients(cutoffFrequency, q);
                                            
                                                            for (auto& filter : filtersRight)
                                                                filter.updateCoefficients(cutoffFrequency, q);
                                                        }
                                                    }
                                            
                                                    void createParameters(ParameterDataList& data)
                                                    {
                                                        {
                                                            parameter::data p("Cutoff Frequency", { 20.0, 20000.0, 1.0 });
                                                            registerCallback<0>(p);
                                                            p.setDefaultValue(1000.0);
                                                            data.add(std::move(p));
                                                        }
                                                        {
                                                            parameter::data p("Q Factor", { 0.1, 10.0, 0.01 });
                                                            registerCallback<1>(p);
                                                            p.setDefaultValue(0.707);
                                                            data.add(std::move(p));
                                                        }
                                                    }
                                            
                                                    void setExternalData(const ExternalData& data, int index) {}
                                                    void handleHiseEvent(HiseEvent& e) {}
                                            
                                                    template <typename FrameDataType>
                                                    void processFrame(FrameDataType& data) {}
                                            
                                                private:
                                                    PolyData<AudioEffect, NV> filtersLeft;
                                                    PolyData<AudioEffect, NV> filtersRight;
                                                    float cutoffFrequency = 1000.0f;
                                                    float q = 0.707f;
                                                };
                                            }
                                            

                                            Bollywood Music Producer and Trance Producer.

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

                                            36

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.0k

                                            Posts