HISE Logo Forum
    • Categories
    • Register
    • Login

    HISE FX and delay compensation

    Scheduled Pinned Locked Moved General Questions
    66 Posts 11 Posters 4.0k 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.
    • Christoph HartC
      Christoph Hart @Dan Korneff
      last edited by

      @Dan-Korneff ah the example might precede the broadcaster addition, so that‘s kind of outdated as a best practice but if it works…

      T 1 Reply Last reply Reply Quote 0
      • T
        tomekslesicki @Christoph Hart
        last edited by

        @Christoph-Hart could you please share an example of checking the sample rate with a broadcaster? I see a attachToProcessingSpecs call in the docs but a simple example would be of great help!

        T 1 Reply Last reply Reply Quote 0
        • T
          tomekslesicki @tomekslesicki
          last edited by

          Is this the correct logic?

          // Broadcaster definition
          const var SampleRateBroadcaster = Engine.createBroadcaster({
            "id": "SampleRateBroadcaster",
            "args": ["sampleRate", "blockSize"],
            "tags": []
          });
          
          // attach to event Type
          SampleRateBroadcaster.attachToProcessingSpecs("");
          
          SampleRateBroadcaster.addListener("sampleRate", "blockSize", function(component, event)
          {
          	Console.print(Engine.getSampleRate());
          });
          
          Christoph HartC resonantR 2 Replies Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @tomekslesicki
            last edited by

            @tomekslesicki no you get the samplerate and blocksize as function arguments (which you named component and event).

            T 1 Reply Last reply Reply Quote 0
            • T
              tomekslesicki @Christoph Hart
              last edited by

              @Christoph-Hart could you please tell me how should I call this then? I'm new to broadcasters!

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @tomekslesicki
                last edited by

                @tomekslesicki You have them

                34a589c9-acd2-4256-b001-e3d55ae3b90d-image.png

                component = samplerrate
                event = blocksize

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                T Christoph HartC 2 Replies Last reply Reply Quote 0
                • T
                  tomekslesicki @d.healey
                  last edited by

                  @d-healey thank you!

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @d.healey
                    last edited by

                    On a very high level you give the broadcaster an event source (in this case a change to the processing specifications) and then you can add functions (=listeners) that are called whenever the source event occurs. You are free to call the function parameters as you wish, but there is a expected number of parameters for each event source - in this case it's two, and the first parameter will hold the sample rate and the second one the block size.

                    Now you've probably copy & pasted this from somewhere (or the broadcaster wizard spat this out) and the function parameters are named component and event (probably from a mouse callback source type), just rename them and address them.

                    SampleRateBroadcaster.addListener("sampleRate", "blockSize", function(component, event)
                    {
                    	Console.print(Engine.getSampleRate());
                    });
                    

                    Also where you put "sampleRate" and "blockSize" in your example, it expects a object and a comment that will show up in the broadcaster map, but both are optional, it's looks a bit misleading.

                    So basically you need to do this instead:

                    SampleRateBroadcaster.addListener("", "will be called when sample rate changes", function(sampleRate, blockSize)
                    {
                    	Console.print(sampleRate);
                    });
                    
                    T 1 Reply Last reply Reply Quote 2
                    • resonantR
                      resonant @tomekslesicki
                      last edited by

                      @tomekslesicki said in HISE FX and delay compensation:

                      Is this the correct logic?

                      // Broadcaster definition
                      const var SampleRateBroadcaster = Engine.createBroadcaster({
                        "id": "SampleRateBroadcaster",
                        "args": ["sampleRate", "blockSize"],
                        "tags": []
                      });
                      
                      // attach to event Type
                      SampleRateBroadcaster.attachToProcessingSpecs("");
                      
                      SampleRateBroadcaster.addListener("sampleRate", "blockSize", function(component, event)
                      {
                      	Console.print(Engine.getSampleRate());
                      });
                      

                      So how can this broadcaster be used for dynamic delay compensation?

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

                        @resonant Call this function instead of Console.print in the callback and hope that every DAW supports dynamic changing of the latency.

                        resonantR 1 Reply Last reply Reply Quote 1
                        • resonantR
                          resonant @Christoph Hart
                          last edited by resonant

                          @Christoph-Hart said in HISE FX and delay compensation:

                          @resonant Call this function instead of Console.print in the callback and hope that every DAW supports dynamic changing of the latency.

                          I understand, I hope it works correctly in every DAW.

                          I've never tried it before, but my approach for dynamic delay compensation is to set it to the highest stable delay compensation value and try to compensate with a delay node at lower delay values while the oversampling value changes.

                          1 Reply Last reply Reply Quote 0
                          • T
                            tomekslesicki @Christoph Hart
                            last edited by

                            @Christoph-Hart is this broadcaster supposed to fire when audio is converted to a different sample rate during bounce? I'm testing in Ableton and Reaper so far, and in both DAWs, rendering to a lower sample rate is triggering the broadcaster.

                            Screenshot 2025-07-12 at 17.38.40.png

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @tomekslesicki
                              last edited by

                              @tomekslesicki Perhaps you can use the transport handler isNonRealtime function to control the behaviour?

                              Link Preview Image
                              HISE | Scripting | TransportHandler

                              A class that manages callbacks for host playback events

                              favicon

                              (docs.hise.audio)

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              Christoph HartC 1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart @d.healey
                                last edited by

                                Of course it is triggering the callback, why shouldn‘t it do it?

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  tomekslesicki @Christoph Hart
                                  last edited by

                                  @Christoph-Hart because if I remember it correctly, what's actually happening is the DAW bounces the file at the currently set (preferences) sample rate, and then converts the result to the target?

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

                                    @tomekslesicki but then the DAW tells the plugin a wrong information, which I'm pretty sure would cause issues with all plugins.

                                    I'm just forwarding the call with the specs provided by the DAW and it shouldn't be the plugin's responsibility to care about whether it's an offline bounce and the DAW might be giving you the wrong information.

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

                                    28

                                    Online

                                    1.8k

                                    Users

                                    12.1k

                                    Topics

                                    105.4k

                                    Posts