HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. iamlamprey
    • Profile
    • Following 0
    • Followers 1
    • Topics 22
    • Posts 90
    • Groups 0

    iamlamprey

    @iamlamprey

    50
    Reputation
    25
    Profile views
    90
    Posts
    1
    Followers
    0
    Following
    Joined
    Last Online

    iamlamprey Unfollow Follow

    Best posts made by iamlamprey

    • Introducing Altar (and looking for Windows testers)

      Hello friends.

      For the past few months I have been quietly working on a new guitar amp VST plugin, "Altar". The goal was to create something state-of-the-art, with a feature-set you'd only find in a $200 product.

      ...and make it completely free and open source:

      b1ba8de7-228e-4489-9ec8-11487fb865c7-{A8BFC142-DFC7-4939-9629-3C92829A3D6B}.png

      I am currently in need of testers and feedback for the Windows version (MacOS and hopefully standalone later). Please try to break the plugin, drag the modules around, create and load presets, make use of the Cab Designer and NAM models if you have them, and report any and all issues back here.

      DSP feedback is also appreciated, I'm not necessarily 100% happy with the sound of each module yet and will be tweaking them more over the next few weeks.

      (There's currently 3 cab IR's and no presets, the full release will have all of that included.)

      Download (Windows): https://iamlamprey.com/altar

      Features:

      • Full suite of high quality DSP modules, which can be re-ordered by dragging.
      • NAM support (writeup on this soon).
      • Cab-Designer to create your own impulse responses.
      • Realtime transpose and sub-octave layer with Rubberband.
      • Multiple modes per modules, like Reverse Delay, Glitch and Circuit-Bending.
      • In built utilities like Tuner and Click, Pre and Postprocess and output Limiter.

      I look forward to hearing back from everyone, thanks! 🥳

      posted in General Questions
      iamlampreyI
      iamlamprey
    • [Tutorial] Real-Time Pitch Shifting with Rubberband

      Hello my old friends.

      Here's how to get realtime Pitch-Shifting working with the Rubberband Library.

      First, your project either needs to be GPL (open-source), or you need to pay the developers of Rubberband for a license (and Christoph!). Also this is just for Windows, I don't use or own a Mac so YMMV.

      First, there's some dependancy conflicts between JUCE and Rubberband. To fix, we have to open the file:

      HISE/hi_tools/simple_css/Renderer.h

      And replace EVERY instance of the Rectangle class with juce::Rectangle instead. I've tried the preprocessor flags and it didn't fix the problem, so I just ended up replacing everything manually. Don't use Find & Replace, there's some other "Rectangle" variables that you don't want to override, just go through manually and replace every Rectangle with the strictly type juce variant.

      I also replaced the copy variable in the Positioner class to rectangleCopy because I think this will also cause problems on Windows. Lines 333 and 336.

      Next, in your Projucer, add the preprocessor flag HI_ENABLE_CUSTOM_NODES=1.

      Okay, now we can build HISE. When it's done, open a project and hit Tools -> Create C++ Third Party Node Template. Name it anything.

      We'll also need to tell HISE where our Custom Nodes are stored, open HISE Settings -> Development -> Custom Node Path and point it to {*YourProjectName*}\DspNetworks\ThirdParty. Click "Save".

      We just created our Third Party node, but it won't do much good without the Rubberband Library.

      Navigate to that same folder in a File Browser, there should be a src folder, if there isn't, create it. Clone the Rubberband Repository into that folder.

      Open your custom node in any editor. Let's start with the includes, which go AFTER the JUCE one:

      // Original Code:
      #pragma once
      #include <JuceHeader.h>
      
      // What we're adding:
      #include "src/rubberband/single/RubberBandSingle.cpp"
      #include "src/rubberband/rubberband/RubberBandStretcher.h"
      

      Inside the primary node struct, declare a unique pointer to hold our RubberBandStretcher:

      // Original Code:
      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;
      
      // What we're adding:
      std::unique_ptr<RubberBand::RubberBandStretcher> rb;
      

      In the Prepare method, assign the RubberBandStretcher with the OptionProcessRealTime Option:

      void prepare(PrepareSpecs specs)
      {   
        rb = std::make_unique<RubberBand::RubberBandStretcher> (specs.sampleRate, specs.numChannels, RubberBand::RubberBandStretcher::Option::OptionProcessRealTime);
        rb->reset(); // not sure if this is necessary, but I don't think it hurts   
      }
      

      RubberBand uses Block-Based processing, not per-sample. So we'll use the process method, not the processFrame one:

      template <typename T> void process(T& data)
      {
        if (!rb) return; // safety check in case the rb object isn't constructed yet
      
        // "data" is given to us by HISE, it has multiple channels of audio values as Floats, as well as some utility functions:
        
        int numSamples = data.getNumSamples(); // the number of audio samples in the block
        auto ptrs = data.getRawDataPointers(); // RB expects Pointers, not just values
      
        rb->process(ptrs, numSamples, false); // This is the Pitch-Shifting Part
      
        // the "false" is just telling RB if we're using the last audio buffer, which we're not if it's realtime
      
        int available = rb->available(); // Checks to see if there is repitched audio available to return
      
        if (available >= numSamples)
        {
          // We have enough output, retrieve the repitched audio
          rb->retrieve(ptrs, numSamples);
        }     
      }
      

      Okay, we're almost there. We just need to tell the Pitch Shifter how much we want to shift the signal by. It uses a Frequency Ratio, so:

      1.0 = None
      0.5 = - Octave
      2.0 = + Octave
      

      If you'd prefer to have a Semitones-based control, I recommend using the conversion function in the ControlCallback of your UI element instead. It looks like this:

      // In the GUI Slider Control Callback
      // This assumes the Slider goes from -12 to +12, with a stepSize of 1.0
      
      inline function onknbPitchControl(component, value)
      {
        // bypass if semitones = 0 (save CPU & reduce latency)
        if (value == 0)
          pitchShifterFixed.setBypassed(true);
        else
          pitchShifterFixed.setBypassed(false);   
        
        // Calculate the FreqRatio from Semitone Values 
        local newPitch = Math.pow(2.0, value / 12.0);       
        pitchShifterFixed.setAttribute(pitchShifterFixed.FreqRatio, newPitch);
      };
      
      

      Either way, we need to connect our Custom Node's only Parameter to our RubberBand Object.

      In the createParameters method:

      void createParameters(ParameterDataList& data)
      {
        {
          // Create a parameter like this
          parameter::data p("FreqRatio", { 0.5, 2.0 }); // Between -1 Octave and +1 Octave
          // The template parameter (<0>) will be forwarded to setParameter<P>()
          registerCallback<0>(p);
          p.setDefaultValue(1.0);
          data.add(std::move(p));
        }
      }
      

      And finally, we connect the Parameter in the setParameters method:

      template <int P> void setParameter(double v)
      {
        if (P == 0) // This is our first paramater, if you add more, increment the index.
        {
          rb->setPitchScale(v); // passes the parameter value "v" to our pitch-shifter
        }
      }
      

      Okay, that's all the code we need.

      Now hit Export -> Compile DSP networks as dll.

      Assuming everything worked, you can now add a HardcodedMasterFX and load your pitch-shifter.

      Notes / Thoughts:

      1. I haven't tested this extensively, there might be other Includes that cause problems depending on your HISE installation.
      2. There's about 30-50ms Latency which is effectively unavoidable, the Pitch Shifter needs a window of a certain size in order to perform calculations.
      3. There might be other RubberBand::RubberBandStretcher::Option values that make it sound better for transients etc, I haven't tested them yet.
      4. Make sure your Parameter doesn't go to 0, as the Library uses it for dividing somewhere.

      Here's the full node, if you copy-paste it, make sure you rename it to whatever your node was or HISE won't find it:

      // ==================================| Third Party Node Template |==================================
      
      /*
      
      Don't forget, you have to replace every instance of Rectangle in HISE/hi_tools/simple_css/Renderer.h to juce::Rectangle
      
      And replace both "copy" variables in that same file with copyRectangle
      
      Then build HISE with HI_ENABLE_CUSTOM_NODES=1 preprocessor
      
      */
      
      #pragma once
      #include <JuceHeader.h>
      
      #include "src/rubberband/single/RubberBandSingle.cpp"
      #include "src/rubberband/rubberband/RubberBandStretcher.h"
      
      namespace project
      {
      using namespace juce;
      using namespace hise;
      using namespace scriptnode;
      
      // ==========================| The node class with all required callbacks |==========================
      
      template <int NV> struct rubberband: public data::base
      {
        // Metadata Definitions ------------------------------------------------------------------------
        
        SNEX_NODE(rubberband);
        
        struct MetadataClass
        {
          SN_NODE_ID("rubberband");
        };
        
        // set to true if you want this node to have a modulation dragger
        static constexpr bool isModNode() { return false; };
        static constexpr bool isPolyphonic() { return NV > 1; };
        // set to true if your node produces a tail
        static constexpr bool hasTail() { return false; };
        // set to true if your doesn't generate sound from silence and can be suspended when the input signal is silent
        static constexpr bool isSuspendedOnSilence() { return false; };
        // Undefine this method if you want a dynamic channel count
        static constexpr int getFixChannelAmount() { return 2; };
        
        // Define the amount and types of external data slots you want to use
        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;
      
        // declare a unique_ptr to store our shifter
        std::unique_ptr<RubberBand::RubberBandStretcher> rb;
        
        // Scriptnode Callbacks ------------------------------------------------------------------------
        
        void prepare(PrepareSpecs specs)
        {   
          // assign the shifter to our pointer
          rb = std::make_unique<RubberBand::RubberBandStretcher> (specs.sampleRate, specs.numChannels, RubberBand::RubberBandStretcher::Option::OptionProcessRealTime);
          rb->reset(); // not sure if this is necessary, but I don't think it hurts   
        }
        
        void reset(){}    
        void handleHiseEvent(HiseEvent& e){}  
        
        template <typename T> void process(T& data)
        {
          if (!rb) return; // safety check in case the rb object isn't constructed yet
          
          int numSamples = data.getNumSamples();
          auto ptrs = data.getRawDataPointers(); // RB needs pointers
      
          rb->process(ptrs, numSamples, false); // 
      
          int available = rb->available();
      
          if (available >= numSamples)
          {
            // We have enough output, retrieve it directly
            rb->retrieve(ptrs, numSamples);
          }     
        }
        
        template <typename T> void processFrame(T& data){}
        
        int handleModulation(double& value)
        { 
          return 0;   
        }
        
        void setExternalData(const ExternalData& data, int index)
        {
          
        }
        // Parameter Functions -------------------------------------------------------------------------
        
        template <int P> void setParameter(double v)
        {
          if (P == 0)
          {
            if (!rb) return; // Safety check in case the Parameter is triggered before the rb object is constructed
            rb->setPitchScale(v); 
          }
          
        }
        
        void createParameters(ParameterDataList& data)
        {
          {
            // Create a parameter like this
            parameter::data p("FreqRatio", { 0.5, 2.0 });
            // The template parameter (<0>) will be forwarded to setParameter<P>()
            registerCallback<0>(p);
            p.setDefaultValue(1.0);
            data.add(std::move(p));
          }
        }
      };
      }
      
      posted in Blog Entries
      iamlampreyI
      iamlamprey
    • RE: So close to Rubberband-ing

      https://www.youtube.com/watch?v=ekapsMx8vR8

      (laughs in thall)

      Writeup soon 🙂

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Introducing Altar (and looking for Windows testers)

      Now with a fancy landing page & video:

      https://iamlamprey.com/altar

      https://www.youtube.com/watch?v=xOqfnTtuwT8

      (use this link for the latest version, the drive link is outdated)

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: drawAnalyserPath but only some of it

      @d-healey No there's a duplicate of the chain purely for the FFT display (otherwise the output would be playing the dirac-delta sample)

      posted in Scripting
      iamlampreyI
      iamlamprey
    • RE: So close to Rubberband-ing

      @d-healey The actual DSP in the third-party node is pretty simple, the main stuff was getting all of the includes to work together (and using the right class in RB that doesn't need 2 separate buffers)

      The RB time-stretching stuff might also be possible using this third-party node and just swapping a few things out, I don't want to give out false hope just yet but

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: So close to Rubberband-ing

      Progress! I have it compiling and "working" in Ableton, as long as I stick to ASIO and not MME (which means I can't record any clips just yet).

      MME / Windows Audio crashes instantly.

      posted in General Questions
      iamlampreyI
      iamlamprey
    • So close to Rubberband-ing

      Hello old friends.

      I have a real-time pitch-shifter working completely in HISE using Rubberband, but unfortunately it's throwing all kinds of strange errors when it comes time to export the .VST:

      0e5f6c96-61bf-4f36-9d6f-a2ec0a6bd182-image.png

      ChatGPT seems to think it has something to do with the Rubberband library using #include windows.h> before the JUCE stuff, which is causing clashes.

      Christoph also mentioned:

      @Christoph-Hart said in Connecting Rubberband Library for use in HISE:

      Just looked at their repo and it seems that they have a single .cpp file that you can add. Just include that in your node file and you should be good (you might have to adapt some Rubberband compiler flags to enable a single translation unit build).

      If anyone can help me finish this one, I'll post the full writeup for it on the forum 🙂

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Modeling an Analog EQ in HISE

      @andrei-s Either a complex transfer function (lots of maths) or a neural model like Wavenet or some of the stuff Christian Steinmetz was doing (also lots of math)

      posted in Scripting
      iamlampreyI
      iamlamprey
    • RE: random float 0. - 1. how to?

      @Rognvald No problem 🙂

      This is a bit cleaner:

      inline function onButton6Control(component, value)
      {
      	if (!value) { return; } // works the same as if (value) but the scope is a little bit cleaner
      
          local Knob1_value = Math.randInt(20, 20000); // this is already fine
          local Knob3_value = Math.random(); // you don't need range here, Math.random() is already within the range you're expecting
      
          Knob1.setValue(Knob1_value); Knob1.changed(); // these can be single lines if you prefer 
          Knob3.setValue(Knob3_value); Knob3.changed(); 
      };
      
      Content.getComponent("Button6").setControlCallback(onButton6Control);
      

      If Knob1 and Knob3 already have their own Control Callbacks, you also don't need to independently call these:

      SimpleGain1.setAttribute(SimpleGain1.Gain, Knob1_value); // already handled by Knob1.changed();
      SimpleGain2.setAttribute(SimpleGain2.Gain, Knob3_value); // already handled by Knob3.changed();
      

      Control.changed() is essentially simulating changing the control with the mouse, so you're basically calling the setAttribute function twice.

      posted in Scripting
      iamlampreyI
      iamlamprey

    Latest posts made by iamlamprey

    • RE: Modeling an Analog EQ in HISE

      @andrei-s Either a complex transfer function (lots of maths) or a neural model like Wavenet or some of the stuff Christian Steinmetz was doing (also lots of math)

      posted in Scripting
      iamlampreyI
      iamlamprey
    • RE: Sampler randomly triggering help!

      @JamesC Looks like this issue:

      https://forum.hise.audio/topic/12049/the-worlds-most-annoying-bug/6

      Edit: Apparently I deleted the original video, but it's the same as yours only for note 89

      posted in Newbie League
      iamlampreyI
      iamlamprey
    • RE: Introducing Altar (and looking for Windows testers)

      @Sawatakashi I'll have to look into which libraries I can & can't include in the repo (license reasons), but for now the complete list is:

      XSIMD: https://github.com/xtensor-stack/xsimd
      Rubberband: https://github.com/breakfastquay/rubberband
      JSON: https://github.com/nlohmann/json
      RTNeural: https://github.com/jatinchowdhury18/RTNeural
      RTNeural-NAM: https://github.com/jatinchowdhury18/RTNeural-NAM
      math_approx: https://github.com/Chowdhury-DSP/math_approx
      AudioDSPTools: https://github.com/sdatkinson/AudioDSPTools

      I also have the WDL folder from Reaper in there locally, but I just deleted it and it still compiled fine so I don't think I'm using it anymore.

      Fair warning, it's kind of a pain getting everything compiling. I had to change a few of the HISE source files because the Rubberband library overlaps with the using juce namespace

      There are notes about that in the transpose.h file, and there's some notes about FileSystem.browse() in the cabDesigner.js file if you want it to work properly when the user cancels the file explorer.

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Introducing Altar (and looking for Windows testers)

      Now with a fancy landing page & video:

      https://iamlamprey.com/altar

      https://www.youtube.com/watch?v=xOqfnTtuwT8

      (use this link for the latest version, the drive link is outdated)

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Duplicate Script FX Network

      clanker strikes again lol

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Duplicate Script FX Network

      @DanH

      Open the duplicated .xml file in a text editor and give it a unique name, I've highlighted the areas you need to change:

      b8752ded-e962-4dec-8ced-26b5ee76a028-image.png

      posted in General Questions
      iamlampreyI
      iamlamprey
    • Ableton Automation can't do math?

      Video example:

      https://www.youtube.com/watch?v=alTXNLYzLu8

      Is this a HISE thing or an Ableton thing? Seems like any value other than 0.0 using this "Edit Value" option sets it to the min/max instead. Super weird.

      44c1dcf7-89c5-4edd-8e05-5c97eb55a587-{76213A42-EF86-43D2-8361-D140A7E70C04}.png

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: random float 0. - 1. how to?

      @Rognvald No problem 🙂

      This is a bit cleaner:

      inline function onButton6Control(component, value)
      {
      	if (!value) { return; } // works the same as if (value) but the scope is a little bit cleaner
      
          local Knob1_value = Math.randInt(20, 20000); // this is already fine
          local Knob3_value = Math.random(); // you don't need range here, Math.random() is already within the range you're expecting
      
          Knob1.setValue(Knob1_value); Knob1.changed(); // these can be single lines if you prefer 
          Knob3.setValue(Knob3_value); Knob3.changed(); 
      };
      
      Content.getComponent("Button6").setControlCallback(onButton6Control);
      

      If Knob1 and Knob3 already have their own Control Callbacks, you also don't need to independently call these:

      SimpleGain1.setAttribute(SimpleGain1.Gain, Knob1_value); // already handled by Knob1.changed();
      SimpleGain2.setAttribute(SimpleGain2.Gain, Knob3_value); // already handled by Knob3.changed();
      

      Control.changed() is essentially simulating changing the control with the mouse, so you're basically calling the setAttribute function twice.

      posted in Scripting
      iamlampreyI
      iamlamprey
    • RE: random float 0. - 1. how to?

      @Rognvald You don't pass anything into Math.random():

      Math.random(0.0, 1.0); // wrong
      Math.random(); // right
      
      posted in Scripting
      iamlampreyI
      iamlamprey
    • RE: random float 0. - 1. how to?

      @Rognvald

      You can use Math.random() for a random float between 0.0 and 1.0.

      You also need to add

      Knob1.changed();
      Knob2.changed();
      

      Afterwards if you want the affected controls to actually change anything.

      posted in Scripting
      iamlampreyI
      iamlamprey