HISE Logo Forum
    • Categories
    • Register
    • Login

    Issues with plugin latency and oversampling

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 74 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.
    • B
      Bicrome
      last edited by

      Hello.
      I'm building an audio effect with HISE and I've added a button to enable or disable 4x oversampling.
      The thing is that when I enable the oversampling the processing has 11 samples of latency, BUT the plugin still reports 0 samples of latency.

      I've read here that audio effect plugins made with HISE can only have a single latency value that doesn't dinamically update. Am I right?
      If so, is my only option to always have 11 samples of latency on my plugin? And how do I achieve that?

      HISEnbergH 1 Reply Last reply Reply Quote 0
      • HISEnbergH
        HISEnberg @Bicrome
        last edited by

        @Bicrome This is your best friend here:
        https://docs.hise.dev/scripting/scripting-api/engine/index.html#setlatencysamples

        There is Engine.setLatnecySamples() and there is also a Engine.getLatencySamples(). Setting the latency will report the latency introduced by your plugin to the host so it can correct the output to align correctly.

        You probably know this already but you can test the latency introduced by your plugin in HISE (Tools>Check Latency of signal chain).

        I presume these come from JUCE's AudioProcessor class, and it explicitly says "The processor should call this as soon as it can during initialisation, and can call it later if the value changes.":
        https://docs.juce.com/master/classAudioProcessor.html#ac902e27eb0950adac57bb69680b6e709

        I.e. you want to call this early in your script, and yes, you can change the latency set by your plugin. I've experimented with this in Ableton and Logic and it worked properly for me. It probably depends on the host's ability to detect that type of change, so I imagine a host like FL Studio is going to miss this (though I could be mistaken).

        So in your case, some pseudo code would be:

        if (btnOversample == 0) // oversample is off
             Engine.setLatencySamples(0);
        else (btnOversample == 1) // oversamples is on
             Engine.setLatencySamples(11);
        
        
        ustkU B 2 Replies Last reply Reply Quote 2
        • ustkU
          ustk @HISEnberg
          last edited by

          @HISEnberg said in Issues with plugin latency and oversampling:

          You probably know this already but you can test the latency introduced by your plugin in HISE (Tools>Check Latency of signal chain).

          Well not me! That's just insane I've never seen this function! I've made a script of myself that does exactly this, create an impulse buffer I send through the whole chain and analyse the delay lol 😁
          Thanks mate! 🤙

          Hise made me an F5 dude, browser just suffers...

          HISEnbergH 1 Reply Last reply Reply Quote 3
          • HISEnbergH
            HISEnberg @ustk
            last edited by

            @ustk it's a really new feature (couple of weeks old) after I bugged Christoph long enough for it! Testing with an impulse was my way to go too (actually this is exactly what this new feature does). It's quite a time saver.

            This actually had me thinking how great (and advanced) it could be if HISE introduced some new tools for analysing phase and magnitude response (as well as other nifty features that PluginDoctor offers). Food for thought....

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

              @HISEnberg said in Issues with plugin latency and oversampling:

              it's a really new feature (couple of weeks old)

              Makes sense then, I'm not that crazy... lol...

              Hise made me an F5 dude, browser just suffers...

              1 Reply Last reply Reply Quote 0
              • B
                Bicrome @HISEnberg
                last edited by

                @HISEnberg tysm for the answer! This is exactly what I needed.

                But, how do I actually add the code to my project? I'm not a really good programmer and I don't know much about the HISE API.
                I've tried asking Gemini for some help but I still can't figure it out.

                Where do I put each part of the code? I the place where it says Content.makeFrontInterface(600, 600); ? Don't I have to add code to two different places?
                And If you don't mind, could you write what code do I need?

                Also, using Tools>Check Latency of signal chain i could check that the latency with oversampling is 12 samples (idk why I wrote 11 before, but checking with bertom eq analyzer and doing some comb filtering test i'm sure that's 12 samples). BUT when I check with oversampling OFF, it says it has 1 sample of latency, even tho I'm sure that's actually 0, by testing like I've explained before.

                1 Reply Last reply Reply Quote 0
                • B Bicrome referenced this topic
                • First post
                  Last post

                26

                Online

                1.9k

                Users

                12.4k

                Topics

                107.9k

                Posts