HISE Logo Forum
    • Categories
    • Register
    • Login

    Set volume for message

    Scheduled Pinned Locked Moved Scripting
    8 Posts 4 Posters 1.8k 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.
    • d.healeyD
      d.healey
      last edited by

      Is there an equivalent function to Message.setFineDetune(); but for volume/gain rather than pitch? I'm thinking that I want to fade a note in from silence so I'll need to silence it first.

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

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

        Yes, Message.setGain(volume) (it was missing in the API list, but it's there). volume is the decibel value, and -100 means silence.

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

          Brilliant, thanks!

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

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

            I'm assuming these won't work with script generated notes... is there a way to do the same thing using event IDs?

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

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

              You'll get the new event ID of the artificial note as return value of the Synth.playNote() function and can use this to make a zero time fade:

              local i = Synth.playNote(Message.getNoteNumber(), Message.getVelocity());
              Synth.addVolumeFade(i, 0, -12);
              

              However, the second line doesn't work yet because you'll need to apply a positive time. I'll fix this.

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

                Yes I tried this with the pitchFade but it didn't work, I assumed it was because only the last fade command in the on note callback had any effect, now I know the reason :)

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

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

                  I fixed this now, so that these two lines are equivalent:

                  Message.setGain(-12);
                  Synth.addVolumeFade(Message.getEventId(), 0, -12);
                  

                  But you can use the latter method to use other event IDs than the one from the callback (including artificial events). However, the first line is a bit faster, because you don't have to add another event so if possible I'd prefer this one. The corresponding pitch methods are fixed the same way of course.

                  And its true that only the last fade command is used (with the new exception when the fade time is zero) so you can't implement zig zag curves like this:

                  Synth.addPitchFade(id, 500, -12, 0); // this will be ignored
                  Synth.addPitchFade(id, 1000, 0, 0);
                  
                  Synth.addPitchFade(id, 0, -12, 0); // this will be OK
                  Synth.addPitchFade(id, 1000, 0, 0);
                  // ...
                  

                  The command just tells the synth to ramp to the given value but the target value (and time if non zero) will be overwritten.

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

                    Brilliant, thanks :) this will be very helpful

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

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

                    57

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    101.8k

                    Posts