HISE Logo Forum
    • Categories
    • Register
    • Login

    Make the Gain knob smooth the gain?

    Scheduled Pinned Locked Moved General Questions
    74 Posts 3 Posters 972 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 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.3oc6Y8tbSaDDWx1hAInzRKszOJX5GrYRShTbBICCC4eNPJXhm3Pnei4P5j8MQ9N2SmB3oCO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ko6V6AmvHVelCx2jBZoIHEfORpGICOOZdnz3zMzIdlUAddH3d0LzAwzmatTsOa.VrlPvIuFVVMC8roxYLilzqGoqQtKbX6KyNUG5k0LuyCMk9Ovo7bzicNZ7n+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
                        • ChazroxC
                          Chazrox @CatABC
                          last edited by

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

                          I need to rethink my thinking

                          I really think you do.

                          And

                          Link Preview Image
                          HISE | Introduction

                          An introduction to HISE

                          favicon

                          (docs.hise.dev)

                          ๐Ÿ‘

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

                            @Chazrox Yes, I have searched the HISE documentation many times, but because I am a novice, I donโ€™t know how to use many APIs, and I am crying because of my stupidity.๐Ÿ˜‚

                            //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?:

                              crying because of my stupidity

                              You're not stupid. We all start at the beginning. Everything is hard until it becomes easy. Keep going.

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

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

                                @d-healey

                                Thanks for the encouragement David,Please teach me again, when I trigger the second C#0, how can I add a fade-out to the note that responded to the first time?

                                a0dfdeab-6679-4c8b-9e2c-14fb7881e3e3-QQ_1752058364900.png

                                //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 Replace the Synth.noteOff with Synth.addVolumeFade - set the volume to -100 and that will also turn the note off.

                                  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 think I have it working. Next I need to move on to multiple generators to test!
                                    Thank you so much for your teaching ๏ผŒDavid, I love you๐Ÿ˜˜

                                    function onNoteOn()
                                    {
                                    	local n = Message.getNoteNumber();
                                    	
                                    	if (n == ks)
                                    	{
                                    		if (eventIds.getValue(lastNote) != -99)
                                    		{
                                    			 Synth.noteOffByEventId(eventIds.getValue(lastNote));
                                    		}
                                    	
                                    		if (Synth.isKeyDown(lastNote))
                                    			eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity()));		
                                    		
                                    	
                                    		return Message.ignoreEvent(true);
                                    	}
                                    	if (n == 25)
                                    		{	 
                                    			if (eventIds.getValue(lastNote) != -99)
                                    				{
                                    					Synth.addVolumeFade(eventIds.getValue(lastNote), 500, -100);
                                    				}
                                    			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 Looks like it's almost there. But you have added that n == 25 block. If 25 is your keyswitch then you should be using the code I put already above that and just replace the noteOff with the volumeFade. No need for the extra block.

                                      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 tried to replace it directly, but it brought some problems, such as the note received the new KS and the previous note could not be stopped.

                                        //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 tried to replace it directly, but it brought some problems, such as the note received the new KS and the previous note could not be stopped.

                                          Show me what you tried, we do it all one step at a time.

                                          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

                                            When I do this, there will be errors like this, addVolumeFade seems to be invalid on the second KS

                                            function onNoteOn()
                                            {
                                            	local n = Message.getNoteNumber();
                                            	
                                            	if (n == ks)
                                            	{
                                            	
                                            
                                            		if (eventIds.getValue(lastNote) != -99)
                                            		{
                                            			 //Synth.noteOffByEventId(eventIds.getValue(lastNote));
                                            			 Synth.addVolumeFade(eventIds.getValue(lastNote), 500, -100);
                                            		}
                                            	
                                            		if (Synth.isKeyDown(lastNote))
                                            			eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity()));		
                                            		
                                            	
                                            		return Message.ignoreEvent(true);
                                            	}
                                            	
                                            	lastNote = n;
                                            	eventIds.setValue(n, Message.makeArtificial());	
                                            
                                            onNoteOn() - Line 12, column 24: NoteOn with ID173 wasn't found 
                                            onNoteOn() - Line 12, column 24: NoteOn with ID178 wasn't found
                                            

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

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            36

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.5k

                                            Posts