HISE Logo Forum
    • Categories
    • Register
    • Login

    Setting a value of a volume knob...

    Scheduled Pinned Locked Moved Scripting
    7 Posts 4 Posters 238 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.
    • Xenox.AFLX
      Xenox.AFL
      last edited by

      HI all,

      first post here, i must admit that i started some days ago with Hise and so i'm a pure beginner, i made some Kontakt Instrument/scripts but stopped 2, 3 years ago and i forgot a lot about scripting in Kontakt! :)

      I have a Sample Player and a bypass button to switch the layer OFF and a volume knob.Both works fine, i can switch the sample player with the knob on/off and i can change the volume of the player.

      But, i want, that the old level of the volume knob when i switch the bypass button on.

      It works when i set the volume by hand, for example:

      const var a = -100 //level down
      const var b = 0 //old level

      When i switch the button on/off, the volume has the levels from a or b. But when i try to read the actual volume from the slider, it isn't working.

      Any ideas?

      When i look in the array of the knob, i can see the right volume but why it isn't working when i send it to the sample player?

      Engine.getGainFactorForDecibels(b));

      When i use const var b = VolumeSlider it isn't working.

      Hm...


      http://www.particular-sound.de

      griffinboyG 1 Reply Last reply Reply Quote 0
      • griffinboyG
        griffinboy @Xenox.AFL
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          Avoid setting the volume of the sampler directly as this can cause audio artifacts if it is done while audio is playing back, also you have to mess around with the gain factor conversion thing.

          Instead add a Simple Gain effect to your sampler and control its Gain parameter. This is a smoothed value so it avoids the artifact issue I mentioned, and the value is set in decibels so no conversion needed.

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

          1 Reply Last reply Reply Quote 2
          • Xenox.AFLX
            Xenox.AFL
            last edited by

            Thank you, David, of course i added a "Simple gain" because i read somewhere else, that it's getting problems when i bypass the sampler... But thank you for the reminder, David.


            http://www.particular-sound.de

            1 Reply Last reply Reply Quote 0
            • Xenox.AFLX
              Xenox.AFL
              last edited by

              Ok. Thank you guys for your help, it's working fine...

              But, i have another little question, when i store a value in a array, how can i update the value in the array...

              Sometimes i have to change the value so i need to update it, when i use

              arr.clear();

              i got an error...

              Sorry for my newbie questions...

              Frank


              http://www.particular-sound.de

              d.healeyD Oli UllmannO 2 Replies Last reply Reply Quote 0
              • d.healeyD
                d.healey @Xenox.AFL
                last edited by

                @Xenox-AFL

                const myArr = [1, 2, 3]; // This creates a new array
                myArr[0] = 10; // This sets the first element of the array to 10
                
                Console.print(trace(myArr)); // [10, 2, 3]
                

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

                1 Reply Last reply Reply Quote 1
                • Oli UllmannO
                  Oli Ullmann @Xenox.AFL
                  last edited by Oli Ullmann

                  @Xenox-AFL
                  If you want to set the value of a button/slider/component in an array you have to do something like this:

                  array[0].setValue();
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  16

                  Online

                  1.7k

                  Users

                  11.8k

                  Topics

                  102.6k

                  Posts