Forum
    • Categories
    • Register
    • Login
    1. Home
    2. iamlamprey
    • Profile
    • Following 0
    • Followers 1
    • Topics 25
    • Posts 112
    • Groups 0

    iamlamprey

    @iamlamprey

    53
    Reputation
    31
    Profile views
    112
    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: Invalid use of incomplete type vSIMDType

      @David-Healey said in Invalid use of incomplete type vSIMDType:

      did you make a pull request?

      you vastly overestimate my understanding of git 😄

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: C++ Version Preprocessor?

      @Christoph-Hart said in C++ Version Preprocessor?:

      everything will explode

      I am yet to experience an explosion, RTNeural-NAM is using std::span and the Linux/Mac compilers are complaining unless I switch the AutoGeneratedProject.jucer to C++20

      C++17 works fine on Windows so I'm not even sure if the span is ever actually created

      Edit: Yep it's some weird ghost function which isn't being called anywhere, might be for a specific edge-case but I can comment it out and use C++17

      posted in General Questions
      iamlampreyI
      iamlamprey
    • C++ Version Preprocessor?

      Is there a preprocessor definition (in HISE settings) to set the C++ version for export?

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Invalid use of incomplete type vSIMDType

      @David-Healey said in Invalid use of incomplete type vSIMDType:

      We know the issue isn't in the JUCE modules because those haven't been touched.

      The reference to Point is ambiguous error I'm getting is a confirmed JUCE issue (it was patched in a later version of JUCE), but it's caused by a clash with the Rubberband library so it's not HISE's fault. Either way I'm going to test the signalsmith shifter instead which sounds better out of the box anyway

      I'm also getting a bunch of fftw errors when compiling your fork (development branch), I assume I need to install that on MacOS?

      Edit: Yep signalsmith solved all of my woes 🙂

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: Invalid use of incomplete type vSIMDType

      @David-Healey said in Invalid use of incomplete type vSIMDType:

      @iamlamprey have you tried a diff between my fork and the develop branch?

      not sure what that is or how to do it lol but I'll start googling

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: Invalid use of incomplete type vSIMDType

      Still working at this, found another juce thread:

      https://forum.juce.com/t/dsp-module-no-longer-compiles-on-linux-after-april-17th-commit/27684/6

      d3de2b48-0322-48d0-bbae-2317a8f5ab2d-{7D973138-55F5-4E38-85B3-2BA3EC9FBD57}.png

      possibly related to the explicit template with jmin? there's a few of those in that monolith file

      this clank also fixes that particular error:

      // Include this AFTER juce_dsp.h
      // It aliases unsigned long to the existing uint64_t SIMDNativeOps specialization,
      // fixing builds on platforms where MaskType resolves to unsigned long.
      
      #pragma once
      
      #include "juce_dsp/juce_dsp.h"
      
      namespace juce { namespace dsp {
          template<> struct SIMDNativeOps<unsigned long> : SIMDNativeOps<std::uint64_t> {};
      }}
      

      which forces it to use uint64_t, but I'm also getting a bunch of Reference to Point is ambiguous errors so this all might just be xcode doing xcode things...

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: Invalid use of incomplete type vSIMDType

      @David-Healey Whatever the default is, I think clang

      I should clarify: this error is happening when I try and compile third-party nodes, HISE itself built just fine. i doubt I could use your fork since mine has Altar-specific changes to include the Rubberband library

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: Invalid use of incomplete type vSIMDType

      This SIMD stuff is quite the pest, getting similar errors on MacOS even after my "fix":

      In file included from /Users/user/Documents/altar/DspNetworks/Binaries/Source/Main.cpp:6:
      In file included from /Users/user/Documents/HISE/hi_dsp_library/hi_dsp_library.h:55:
      In file included from /Users/user/Documents/HISE/hi_tools/hi_tools.h:148:
      In file included from /Users/user/Documents/HISE/hi_dsp_library/../hi_tools/../hi_streaming/hi_streaming.h:62:
      In file included from /Users/user/Documents/HISE/JUCE/modules/juce_dsp/juce_dsp.h:236:
      /Users/user/Documents/HISE/hi_dsp_library/../hi_tools/../hi_streaming/../JUCE/modules/juce_dsp/containers/juce_SIMDRegister.h:85:32: error: implicit instantiation of undefined template 'juce::dsp::SIMDNativeOps<unsigned long>'
          using vSIMDType = typename NativeOps::vSIMDType;
      

      And here's an old post from the man himself:

      https://forum.juce.com/t/dsp-module-breaks-compilation-on-linux/27346/4

      Seems like it's either a JUCE issue, or just the different behaviors of different compilers

      posted in Bug Reports
      iamlampreyI
      iamlamprey
    • RE: Looking for Linux Testers :)

      @David-Healey eugh ok thanks for letting me know, between this and the gcc strictness linux really hasn't been a smooth experience lol

      posted in General Questions
      iamlampreyI
      iamlamprey
    • RE: Looking for Linux Testers :)

      @David-Healey said in Looking for Linux Testers :):

      Which version of mint did you use?

      22.2 Cinnamon, im not interested in ensuring compatibility with edge case distros when the linux userbase is already like 5% AND it's a free plugin lol

      also tried makeself, post install script was giving permissions issues despite chmod, got bored and gave up, replaced it with a simple bash script instead

      posted in General Questions
      iamlampreyI
      iamlamprey