Forum
    • Categories
    • Register
    • Login

    Peak-based Action

    Scheduled Pinned Locked Moved Scripting
    3 Posts 3 Posters 48 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.
    • VorosMusicV
      VorosMusic
      last edited by

      const var TimPan = Content.getComponent("TimPan");
      
      TimPan.setTimerCallback(function()
      {
      	var Peak = Engine.getMasterPeakLevel("L");
      	
      	if (Peak > 0.1)
      	{
      		Sat1.set("visible", false);
      		Sat2.set("visible", true);
      	}
      	else
      	{
      		Sat1.set("visible", true);
      		Sat2.set("visible", false);
      	}
      });
      
      TimPan.startTimer(50);
      

      I have written the code above, trying to switch between two graphics based on the output peak. I think it worked for oscillators in hise, but I want it to react to the sound coming from the DAW. (it's an effects-plugin)

      Any ideas if and how I could achieve something like that.
      ps. it would be good if something like that would be possible with low performance cost

      David HealeyD ustkU 2 Replies Last reply Reply Quote 0
      • David HealeyD
        David Healey @VorosMusic
        last edited by

        @VorosMusic That code looks like it should work. You could reduce it a bit

        TimPan.setTimerCallback(function()
        {
        	var state = Engine.getMasterPeakLevel("L") > 0.1;
        
        	Sat1.set("visible", !state);
        	Sat2.set("visible", state);
        });
        

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

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

          @VorosMusic I would go for a glibal_cable instead of a timer so the callback only fires when the value changed.
          Even better, it allows you to place the logic on the DSP side so the script callback we really just fire when necessary.

          That been said this is still a lightweight job for the script, but when I can prevent a timer for running all the time, I do…

          Hise made me an F5 dude, any other app just suffers...

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

          10

          Online

          2.3k

          Users

          13.6k

          Topics

          118.5k

          Posts