HISE Logo Forum
    • Categories
    • Register
    • Login

    Make the Gain knob smooth the gain?

    Scheduled Pinned Locked Moved General Questions
    77 Posts 3 Posters 1.3k 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.
    • CatABCC
      CatABC @d.healey
      last edited by

      @d-healey
      When I use Message.getEventId();, and play two different notes, the previous note does not close.And I don't know how to convert the events into notes🤡

      function onNoteOn()
      {
      	if(eventIds != -1)
      	{
      		Synth.noteOffByEventId(eventIds);
      	}	
      	eventIds = Message.makeArtificial();
      
      	if (Message.getNoteNumber() == 36)
      	{
      		
      		Message.ignoreEvent(true);	
      		Synth.playNote(60, 20);
      	}
      	
      }
      function onNoteOff()
      {
      	if(Message.makeArtificial() == eventIds)
      	{
      		eventIds = -1;
      	}
      
      	if(Message.makeArtificial() == 0)
      	{
      		Engine.allNotesOff();
      	}
      	
      }
      

      //I am a new student at HISE._
      //Windows11 & MacOS Ventura 13.6.7_

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

        @CatABC

        This returns an event ID that you need to store, so that you can turn the note off when the key is lifted. Otherwise you'll get hanging notes.

        Synth.playNote(60, 20);

        @CatABC said in Make the Gain knob smooth the gain?:

        if(Message.makeArtificial() == eventIds)

        Here you should use Message.getEventId() instead of makeArtificial

        @CatABC said in Make the Gain knob smooth the gain?:

        if(Message.makeArtificial() == 0)
        {
        Engine.allNotesOff();
        }

        What's this meant to do?

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

        CatABCC 1 Reply Last reply Reply Quote 0
        • CatABCC
          CatABC @d.healey
          last edited by

          @d-healey

          Synth.playNote(60, 20);
          

          The 60 here should be the note that was pressed before,

          Synth.playNote("eventIds's note", 20);
          

          I can't stop the artificial notes

          
          function onNoteOn()
          {
          	
          	if(eventIds != -1)
          	{
          		Synth.noteOffByEventId(eventIds);
          	}	
          	eventIds = Message.getEventId();
          
          	if (Message.getNoteNumber() == 36)
          	{
          		
          		Message.ignoreEvent(true);	
          		
          		Synth.playNote(60, 20);
          		
          	}
          
          }
          
          function onNoteOff()
          {
          
          
          	if(Message.getEventId() == eventIds || Message.getEventId() == Message.makeArtificial())
          	{
          		eventIds = -1;
          	}
          	
          	
          }
           
           
          

          5505e20b-18d0-4802-82b3-4495df412210-image.png
          In this case, the D3 note cannot be turned off

          //I am a new student at HISE._
          //Windows11 & MacOS Ventura 13.6.7_

          d.healeyD 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @CatABC
            last edited by

            @CatABC said in Make the Gain knob smooth the gain?:

            Synth.playNote(60, 20);

            You need to store the ID of the note in a variable so that you can turn it off later.

            @CatABC said in Make the Gain knob smooth the gain?:

            Message.makeArtificial()

            I think you're misunderstanding the purpose of this function.

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

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

              @CatABC Here's a basic example using a sine-wave generator.

              I've put everything in the interface script but in a real project it should be in a separate MIDI processor.

              HiseSnippet 1122.3oc2Ws0aZbDEdVr2ntj1nlpnp73Vo9.T4ZAXLwnHqXaLNEUiMx33z2hlL6YgQdYlMyNKsnJ+er+Txq8o1yrKW10F4hQsMpkGPbNy4x245LzSIYPTjTQrJd4jPfX8418mHzCaMjxEjNGSrdhcWZjFTtorNZRHMJB7HVVa7ZCCKmMIIe93qNhFPELXAKB4JImAmxGw0K316fejGDbB0CtjOJiz0OnCSJZICjwHd1vtBIjxtlN.NiZDqfM4GnQCIVem8t01gU26Ed0psayFLZCnoO02u5Nd0q2XulU2oIs9dMfJ6RrdTaOtVp5qoZHBM5QRuI8GJ+YQpCthGwee.XHpR5idNkMo0PdfWuYImHBwxt2hT0FoopmY2k6wmyeQJ6KSNvcgFYSZVEtOHU8A.IqLPZyTH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ave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 0
              • CatABCC
                CatABC @d.healey
                last edited by CatABC

                @d-healey
                I tested your snippet, but in this case the second C0 triggers the playing of C2 again, is it possible to not trigger the playing note when there is no note above?

                a148739a-fa1d-45fb-b89f-0de9484836c3-image.png

                //I am a new student at HISE._
                //Windows11 & MacOS Ventura 13.6.7_

                d.healeyD ChazroxC 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @CatABC
                  last edited by

                  @CatABC said in Make the Gain knob smooth the gain?:

                  is it possible to not trigger the playing note when there is no note above?

                  Yes, this was just an example to get you started. Synth.isKeyDown() might help here.

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

                  CatABCC 1 Reply Last reply Reply Quote 0
                  • ChazroxC
                    Chazrox
                    last edited by Chazrox

                    Have you messed with scriptnode fx at all? This seems like its pretty simple in scriptnodeFX. You can rig as many samplers as you need and trigger them with built in X-Fade nodes and so much more.... ??? Skim thru the documentation for the entire scriptnodeFX section and see all the stuff you have at your fingertips!

                    Link Preview Image
                    HISE | ScriptNode | Scriptnode

                    An introduction to scriptnode

                    favicon

                    (docs.hise.dev)

                    1 Reply Last reply Reply Quote 0
                    • ChazroxC
                      Chazrox @CatABC
                      last edited by

                      @CatABC for example....

                      wanna fade between 3 samplers that start at the same time?....different times? You can do that too...either way check this method out. The fader node has different fade modes, blend & switch modes.

                      Screenshot 2025-07-07 at 6.45.45 PM.png

                      CatABCC 1 Reply Last reply Reply Quote 0
                      • CatABCC
                        CatABC @Chazrox
                        last edited by

                        @Chazrox This looks like a good choice. I tried it, but there is a problem. When KeySwitch is triggered, it requires the Fade knob to automatically and smoothly go from 0 to 1. How can I control it?

                        //I am a new student at HISE._
                        //Windows11 & MacOS Ventura 13.6.7_

                        ChazroxC 1 Reply Last reply Reply Quote 0
                        • CatABCC
                          CatABC @d.healey
                          last edited by

                          @d-healey This seems to be back to the HISE snippet I provided at the beginning😲

                          function onNoteOn()
                          {
                          	local n = Message.getNoteNumber();
                          	
                          	local v = Message.getVelocity();
                          
                          	Message.ignoreEvent(true);
                          	
                          	for (i = 0; i < 127; i++) {
                          			
                          	       // turn off previous event
                          	       local e = eventIds.getValue(i);
                          	       	       
                          	       if (e != -1)
                          	           Synth.noteOffByEventId(e);
                          		//Synth.addVolumeFade(e, 2000, -90);
                          	       // play new note if key is down
                          	       if (Synth.isKeyDown(i)) {
                          		       
                          	           local newNote = Synth.addNoteOn(1, i, v, 0);
                          	           eventIds.setValue(i, newNote);
                          	       }
                          	       
                          	   }
                          
                          }
                          

                          I don't know where to put Synth.addVolumeFade(); to make it succeed

                          //I am a new student at HISE._
                          //Windows11 & MacOS Ventura 13.6.7_

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

                            @CatABC Don't use that snippet, use the one I gave you as a starting point.

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

                            CatABCC 1 Reply Last reply Reply Quote 0
                            • CatABCC
                              CatABC @d.healey
                              last edited by

                              @d-healey
                              I used something like this to prevent lastNote from being triggered when only ks is pressed. Now, I tried adding VolumeFade to the old events, but this doesn't seem to work

                              function onNoteOn()
                              {
                              	local n = Message.getNoteNumber();
                              	
                              	if (n == ks)
                              	{
                              	
                              
                              		if (Synth.getNumPressedKeys() > 1 && lastNote >= 0 && eventIds.getValue(lastNote) != -99)
                              		{
                              			//Synth.noteOffByEventId(eventIds.getValue(lastNote));
                              			Synth.addVolumeFade(eventIds.getValue(lastNote), 2000, -99);
                              			
                              			eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity()));
                              		}
                              	
                              		return Message.ignoreEvent(true);
                              	}
                              	
                              	lastNote = n;
                              			
                              	eventIds.setValue(n, Message.makeArtificial());	
                              
                              
                              }	
                              

                              //I am a new student at HISE._
                              //Windows11 & MacOS Ventura 13.6.7_

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

                                @CatABC I was thinking more like this

                                HiseSnippet 1134.3oc2W01aZbDDdOfqpGoMpoJJpR8KWk5GfJWDXiIFEYE+FNEEiMx331uEsYu4fU9X2K6sGsnJ+er+Tx+f1YuiWtyl35fZpZJe.wL6L67ryKO6RekjAQQREwp7ESCAh0WXOXpPO5vQTtfz8Hh0Cs6QizfxMU0ASCoQQfGwxp3KLJrbJQR97tme.MfJXvRUDxkRNCNgOlqWps+dujGDbL0CtfONi0M2qKSJNTFHiQ7TztNIjxthNDNkZLqfM4mnQiHV+f81atEqo2S81bysa2hQaAs8o99M1xqYyV6ztwVsoM2oETeah0m0wiqkpAZpFhHVkNP5McvH4uJRCvk7H9aB.iPCx.LxopOVF3YNhFsjCGwC75OOQEQHV18Wl1Jll1drcOtGeg9kouuJYA2kdjMAZUHO7JlCdMxBu5Yf2JfjUFHUJEROxd.SwC0KWwfmGX2UfUSeJVmxBkTaIE91h1GJQKD5ZioWAGqPgEdToU85a3heU8YkKi0pHs6UQt65tYyExvDz0tdFscDC4BnFSA3oyjENgGoqftN2lZ9XePkercay1ofgtAXm1oRM7L+XASykBWovHelnR0x+dYm.IiF3Jv8tGdhvNiZCgDGNMd7a.kYucJ6v8cqf1rKhspkcP2RzrHnnKWRChgJyiVU2uaWWCJPKMV6jLATSXBru+AS6j54csCl.6bc4YgJ0edzKgoGg0xLlY18EaSzM2lMbS8LLfN0HmYgLm2KALMv0SqTECqiiInJPGqDKLhOTHUPBrqnUwfAcWaxLy2OLAJPc2FIhkQxT82Wo49bFmFTI8HV95xt2r136+gVbtchTjoFXJA26JfnZ5gKOtLcvJYPfIpFncikMzNqdkYNVQj.4MbmXBxBCwQq7yq1u+40rzIrzApLFJEcEb8Ygf38QxPlMEh+5UcOhpolg7Y5P6BArzXff0QvDjhMcj2w9HH5JsLDIYuEe.xDI8hCn57zSFR7YKf4fbbBl4dQD1pkkj+eLNq6KDejcetlMZ0XrvJvHlo9XfwYL8eocGeefoWBvR1G+Kebn0yF9GlF9GXO.IUSlORB9SRjc+Y5Dv8Ef.TljWi63Z5+39dMc389Z5yXZL7WnnhnPYTtMd.LlegTXxBKU9pH7dE3smaplY0enjpV4Ru64GiGxU5y.JR8kzVr+XYrPmqMn3cc6ei071+R+m61+OAF1y8.Em4Xb.ebX.zQLAuRC0Xv3WiTX9z3.8bs46k6IExvQRAmksPeNnU7gCAUVruxCz9ZM9lxkZd7dmCA.MaS62u2IXyFUg4IXMyEM9fer1JqWeicJbcMCfte5RRW7+2jzmKi0bwvdTrI72vGEfu2Y.xMx.L5BADXdnfUAC+VpbcibJ4nvKQ3OwOyVrgQ1Z1hMlu3+JwXLkojulk9DHSe5mmnAO2hj+.lC9OAQY2FjjmEksVNFY4dMikeqtkiattNt055Xy00wsWWGastN9z00wc96czbIz9wZ43zQSBoW+NIuozxpifhc4ISDj+R75.WQ
                                

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

                                CatABCC 1 Reply Last reply Reply Quote 0
                                • d.healeyD d.healey referenced this topic
                                • CatABCC
                                  CatABC @d.healey
                                  last edited by CatABC

                                  @d-healey Yes, it is indeed more logical to use isKeyDown,
                                  I put the code into the MIDI processor of the two waveform generators, but now I can't control the fade-out of the sound of the previous generator and the fade-in of the sound of the next generator when the KeySwitch is triggered. I used MIDIMuter, but I found that this is the wrong way to do it. When I use two waveform generators, I need to ensure that only one generator makes a sound at a time. Once I use MIDIMuter, they either make no sound or the sound can't be stopped.

                                  HiseSnippet 1587.3oc6Y8tbSaDDWx1hAInzRKszOJX5GrYRShTbBICCC4eNPJXhm3Pnei4P5j8MQ9N2SmB3oCOK8snO.8YnO.7HvzWf18jjsjRTLNdRfIzjYfI2d6t29ua2emRKNyAGDv3JpF6MnOVQ85ZsGPEc2nKhPU1dSE0qo8T7f1ugHb5pr9f9nf.rqhp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7bzicNZ7n+0GzHVxwoAoIqCFs96Fdbw5fD.HO2DpfyvZBm5iTWvQU2LIg299nAx0Y1HSDaeLDHgwPUqAGerJg+wwPWH5H9hCGQdPUAGPY.F56Lzm6dF5X+.rIwCBx2ISP9TGhshT48lSlyFZmPpkBTOtGRS8.I7r0.3EdDGBxuZs3r9XweM4ENGOUQyjkk94Dmio0hiYWh86yE1uylWUnOzFaS502G2fdHb+AnHswuE7JOTnuXH07sbaxnr9cYThS1N56hg6Fc5f4Ys8BcH3VD7PvTJ2Z0cw9XTV7I+zpOCZSi3PbBOkwBqS8KrJLe8iZwlqorF17KCL6k++Il8cYgBBsSSDTn9VnWBzlrM.U1ACVBkB8+AZpkjcBhWOubcLVYpazh+E9IYSK4Z0jMsFtYV281Cw6IeBP56B99n0dLduI3YAu+Wdxebt+r.qBeWPNpGQB6BkHG0MgAuz7pNlTNtjghsfPQF9t5pCIZmkXKDMmxf04zTSYJc3x2+nFTDTfzFCdt6NANPfQFmyofPXf+KIthtVYELkrcVxOAwcgbnyj+JlKReMpSwqXNkf0sKDr9UpjGr9hmKf0Goxbv0smD351mqv0sOArj1E.W+SFZ84lKVRjq69L+vdXYmjwI1LlKK+9gwA+KbP8OB79IMkXknlyD.9FQ.7uDd+EL38e7Oji8EfOjSh5NG9PNe47tG6Ke2yku64Ko+VEi+FJfg9hSl91Z.tdaynzs4m+78mhGW9o3L5gb3rW4DOYP1v3pQT.+lF8msWWqobso0wGEzCF+8JGm7p5XBZOsBtvzJX8oUvEmVAWZZE79SqfK+wEThNYsPAqW78D3IysZDADRUM90xQWYT9OfKn+WO
                                  

                                  //I am a new student at HISE._
                                  //Windows11 & MacOS Ventura 13.6.7_

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

                                    @CatABC said in Make the Gain knob smooth the gain?:

                                    I put the code into the MIDI processor of the two waveform generators,

                                    Why?

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

                                    CatABCC 1 Reply Last reply Reply Quote 0
                                    • ChazroxC
                                      Chazrox @CatABC
                                      last edited by Chazrox

                                      @CatABC I would script a UI button with 3 discrete stops. This knob will control your paramter knob from your scriptnode. Make sure the parameter knob in scriptnode is also set from 0-3 with stepsize 1.0. Changed the fader node to switch mode. Add a value ramp/smoothing node in between the faders mod outputs and the target gain knobs for each sampler. It should trigger the faders values either 1-2-3 to smoothly fade between one another. The part you have to script is what midi keys trigger each value of your parameter knob. Sorry if this is sloppy, this is off the top of my head without making a snippet example.

                                      • based on the example I gave you above.

                                      Honestly have a look at the scriptnode list in the documentation. You can really get crazy with the cheeze wiz if you see whats available.

                                      1 Reply Last reply Reply Quote 0
                                      • CatABCC
                                        CatABC @d.healey
                                        last edited by

                                        @d-healey I thought that if working between multiple generators, each generator should have separate controls, maybe I'm wrong?

                                        //I am a new student at HISE._
                                        //Windows11 & MacOS Ventura 13.6.7_

                                        d.healeyD 1 Reply Last reply Reply Quote 0
                                        • CatABCC
                                          CatABC @CatABC
                                          last edited by

                                          I need to rethink my thinking. What I want to do is to use KS to split a note.
                                          1.png

                                          //I am a new student at HISE._
                                          //Windows11 & MacOS Ventura 13.6.7_

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

                                            @CatABC said in Make the Gain knob smooth the gain?:

                                            @d-healey I thought that if working between multiple generators, each generator should have separate controls, maybe I'm wrong?

                                            I don't think it's needed for this use case because we want to work with both as a single unit. You might even only need one sampler, depending on how many samples you have and how you want to map them.

                                            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

                                            29

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.8k

                                            Posts