HISE Logo Forum
    • Categories
    • Register
    • Login

    Set volume for message

    Scheduled Pinned Locked Moved Scripting
    8 Posts 4 Posters 2.4k 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.

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - 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!

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - 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?

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - 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 :)

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - 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

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

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

                    29

                    Online

                    2.0k

                    Users

                    12.7k

                    Topics

                    110.0k

                    Posts