Forum
    • Categories
    • Register
    • Login

    Peak-based Action

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 82 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 1
        • ustkU
          ustk @VorosMusic
          last edited by ustk

          @VorosMusic I would go for a global_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...

          VorosMusicV 1 Reply Last reply Reply Quote 3
          • VorosMusicV
            VorosMusic @ustk
            last edited by

            @ustk Thats what I thought too. Not a fan of the continuous times thing, but I didn't know any other way.

            I have never used a global_cable do you have a starting point for me?

            ps. @David-Healey thank you for the reduced version! Currently still no effect in DAW.

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

              @VorosMusic Here's a snippet that demonstrates how to handle the detection and integration part in the DSP.
              Notice that the callback only fires when the value changes from peak (value==1) to clean (value==0) and vice-versa, with no extra firing in between (that's not entirely true as it fires sometimes but this might be due to the AsyncNotification not being fast enough when the changes are erratic like in this example)

              HiseSnippet 2117.3oc6Y0DaijTEt63TdF6YfcWsgENrG5YDG7.iL1IYlLqVwDm33Dh1IYLwdyBmhJ2cY6RtcU81c4Lwf1Sb.twYPBI3NGPbCIPLmQZ3Nm3D2yo85xqppa6tcamI1IY2cP3QZRWU8dc89468SWUcetMIHf6aXlu4POhg4cQMFxDcq1ESYF6uig4Jn8b4svtUwsbI0NC22ykXr8PObP.wwvzLydRJMysrg524atM1EyrIimxv3XN0l7LZepX7rdU9Hpq6tXGRSZ+XTudk8s4rpbW9.PpxfJY3gs6g6PNDKIaIjwOBGz0v76gVi37AOoLYiG2pzFqtZI6MHOlr9ZNsdhy5kINqSvq8AO5QjMV0vLaMGpf62PfEj.3ktM2YXit7Wvzavwz.JnbxAkMZ.6rdZipcotN0iLQAFFln5iMXYzFrUPGPcnilerg6sUKXMli3FMyktHQp7bHRlwDok0hz6fZX6S8DiWQJO2AsOSP7aisS5+zzZrze0DUkCTvDE6i6Q10GFLhiBOtToGZA+2C9v74A+Sfv5Tru0dGcf0OzpFqCkQJ1gHzPki3CDTVmCvLvs4W.XYLGdDbuS5XCbA7JYQgqJb+v4uu78mObPQeRGZ.HAUwtts.TPg1CX1BJmU3Tr6.xCx+yymi11ROx5oVkJ9nGjOWNPMB3tjhd9Tlnv8umU8Za8Q26d2S9xyQbCHoo4oVUcIXVwhEUDkK+m8PqsBFxrOjKnso1X4t9fOLZ+s3LXAxyYETxP9OKu0jK0t8TWSZh84ttR6xTVVFK3eQLVfMneKh+CsFaAjDB99j.prWN.ks1iGiPNaeFU7bOR33c4tNRfh74zvOiPHC7zGu+NXAVhHCmCny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LgTZXahvInFC72hx4SGGoo+0DCsThXnYlZ5FCkbslZZtg+STw+15xfkm+Bni37BL2eBTAkFXAu5.KWZOhElYAeYOoiBKAOZw8cH9VBtUOBwyR.0akcZAqzl62WkZyBCrJDtDKWNqCHPEKdM1K36hHfw2EX+j1bYe1SVL98QNCY39T6fhooLsUYZuuan1FyGUzn7WI8MlnTwkKySke8jYd98oqiCyZ8pe2q1TiN2RHv18lQzRVj5TJuRAJqWY9KML25QNzQDWBNfb0UDXumhhfTGQq98oPiKPYgokI6hJK7VQm6ZCZGFDncimQK4WpLB7O2caEi2an1s9lnNpyb8Da44n9+665Mi9t9Eu7e7Gp84ytuqqX70Wya6ZVcHLAVNQz16g70mmVwDzjNjahWR7vtbY2y6O+Ey8IDDKtazWtFdCESMRc1M5c22HZz67Y.KOeyDwaSGiNo9arMm2qOVcxjW4qH315EuE5PNEpvoO1c0yV6QfNHU32uTuaRyLIOt3kubGWbxayHF8S4v0W9l5NGW9xcd+ulK.5q+2fShqmHWjL1fJ6YsVXKzgXoPf+nYiKjGvY7niEeL74Hhvm1oCIYP4zzmv9KGMyJUh5TazTe2JOCBSw9pSIawLEy+sEOU202IrcXKY.f0Uws8kJJ6Z3R3t1k2upuPt7QYTqNv+TRsO0HriZcRZe5mZU6GmrN5f96RcUouCuzoswpajRaz9i+f+yeWNQ4QVw2dPE4DqlLSKyYsImX83F9c2sYMlrFsV2y7lz8t8+J6QersO+jvuiQBbtsZFv1xBOs3CjisJab5jsszGJzbhscxWUJFWcQYbsEkw0WTFezhx3iWTF2XQY7IudFk8AD1tlLMHzlY8Z5CXwLVTmw+Ebk3BYI
              

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

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

              13

              Online

              2.3k

              Users

              13.6k

              Topics

              118.5k

              Posts