HISE Logo Forum
    • Categories
    • Register
    • Login

    Make the Gain knob smooth the gain?

    Scheduled Pinned Locked Moved General Questions
    74 Posts 3 Posters 1.0k 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 snippet implements the function of switching two Samplers on a note, but it will fail when the third KS is triggered on the same note.
      I didn't use the key method you used on Patreon because that seems to be a bit buggy. Here is the most basic method I used

      HiseSnippet 1721.3oc6aszaaaDDlTxLMRoORJBP5Q1fdPJvwPj5QhggQ7K4FiDGKX43zCEHXC4JoEhZWUxktQHv+.Z+ATfboH+IZ60bs+K5sdMnG501YIoDIsoTkUhSsBnArg2YmY14wtyLexvMrYFXGGlsjb9CFzGKI+wJMGP4c1rChPk1YKAgCYVt8vaiLwRaLnOxwAaJIKm8qEbHmaAIuudy81.YgnF3PRRRGxHF3GR5Q3gTar1CHVVBsc.oWDtqr1NFL5lLKlKXMYUJI0GYzE0F+HjfsLJR2G4zQR9VJU0KaTw7Nl55UWtlApFd4VnVszJaVoRs6trV4kQUtaMbopRxWptIgyraxQbrij7BavLGzrC66o9GvgDGxyrvhEZRMgS1m71LKSgKJnJsYGhkYiggIGII4OpQXPKqeP65J6RLIinGF7tp2FpgRDM.JmIt4kMl4oE07JEw7RvjjiXRK3aRWSoogMoOObGg8bEkcnbrcKjQ7boOuRY96rJax.Nn7k5g5h21FVLRhB0JUZQU3GEWIedHW4vUOBYqJ7vccAdzTWU06xyRsw7XAjB2LjoaBRmfv5Siv5iQ3xSivkAga4RM3DFUkQeDii2iVnX9WjOetbjVpE1Ej.tuIzgXyG416YX6BEUWcUU8JEAldA7ctPOYIGLecN2l7LXYgHzIsoLa7FtbNitnpHbEUN8wHm9IjS6DxUdLxUNQ4NdJbppytSoMiNUoycmp16emZVyTkBbpiyqdxKlsZ4cyL2I1S73zlYYI71D1VTQ0dRBV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p8IEiKQjXalcuH7c40FRTOJwFHZLkAqioocEYvgK+i6Umhf6.MwfmatmiADXDW6i9RqgqkC9IDSdGsnBFRVOJ46irMgTlw4OTpKMeCkR+r.kpZJTp4anTUlWgRclM6K.foRgRkBk5rAkROEJ0GDPozSgRkBkZd4OAyje8AyoewNKdCE.uftpWpT8+mb4EFbokGGtzWcqe7W9.EW5qd4Kq95Dvkd0jvkBvHmdboE+1+7cItTvP+8TboSKtzxSBW5ObBbo0RwkNugKc9GT5bxeVxTnnoPQmAnnkmCfhFntTnnS.JZ4TnnoPQSghlBE8cGTz2GmQOjgM6oF9U2EO5urGEvuod+GgjSYWwZUsS2SnGzB6oFFwU0oDTeVEr7rJXkYUvpypf0lUAuyrJ3c+uETLgw5tbVO+2F.h6F08FlQV1Grs2yDo+EPmCvVF
      

      8e0c8173-1b08-4ea4-9d01-44d3eecb8041-QQ_1752343395182.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 d.healey

        This is exactly what the video is for, did you watch the one I provided a link to?

        You don't need to use one script per sampler because you want everything to work together as a single unit it needs to be controlled from a single script.

        You can use the snippet I posted earlier in this thread to retrigger the note and the key switcher from the video to change the samplers. Then it should be pretty much complete.

        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 said in Make the Gain knob smooth the gain?:

          @CatABC I posted a video to Patreon at the start of the month about keyswitching using midi muters. It will probably help you here.

          Yes, I watched this video and followed it, but it didn't work.

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

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

            @CatABC
            In what way did it not work?

            I'll make an example for you in a little while.

            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 @CatABC
              last edited by

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

              @d-healey said in Make the Gain knob smooth the gain?:

              @CatABC I posted a video to Patreon at the start of the month about keyswitching using midi muters. It will probably help you here.

              Yes, I watched this video and followed it, but it didn't work.

              The problem at the moment is not with the MidiMuter, but with the third KS, it is not possible to trigger the playing of the pressed note again and the fading out of the previous note

              //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 but the key switcher on its own works?

                Libre Wave - 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

                  @d-healey said in Make the Gain knob smooth the gain?:

                  @CatABC but the key switcher on its own works?
                  KS is valid, in addition, the KS system you made on Patreon, in this case, it has some minor problems (cannot stop notes, can not normally switch the corresponding articulation)

                  e9e8edd1-3c2c-48b0-a77a-9bced193a51b-QQ_1752345003530.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 is that my keyswitcher on its own or your implementation of it?

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

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

                      @d-healey is your code. I followed the video step by step to reproduce your operation.When KS is before the note, it works fine, but if KS is triggered at the same time as the note, the problem I described will occur

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

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

                        @d-healey said in Make the Gain knob smooth the gain?:

                        @CatABC is that my keyswitcher on its own or your implementation of it?

                        function onNoteOn()
                        {
                        	local n = Message.getNoteNumber();
                        	
                        	if (n >= knbLoKey.getValue() && n <= knbHiKey.getValue())
                        	{
                        		Message.ignoreEvent(true);	 
                        		
                        		knbArticulation.setValue( n - knbLoKey.getValue());
                        		knbArticulation.changed();
                        		changeArticulation(n - knbLoKey.getValue());
                        	}
                        }
                        
                        changeArticulation(n - knbLoKey.getValue());
                        

                        I just explored it and found that this line of code cannot be deleted. Keeping it will not cause articulation confusion.

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

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

                          but if KS is triggered at the same time as the note, the problem I described will occur

                          Aha ok, I think you will run into an issue here because two notes triggered at the same time, how does it know which one to process first?

                          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 CatABC

                            @d-healey said in Make the Gain knob smooth the gain?:

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

                            but if KS is triggered at the same time as the note, the problem I described will occur

                            Aha ok, I think you will run into an issue here because two notes triggered at the same time, how does it know which one to process first?

                            // articulationSwitcher/onInit    add these
                             const eventIds = Engine.createMidiList();
                             eventIds.fill(-99);
                             reg lastNote;
                            
                            // articulationSwitcher/onNoteOn    add these
                            		if (eventIds.getValue(lastNote) != -99)
                            		{
                            			Synth.addVolumeFade(eventIds.getValue(lastNote), 500, -100);
                            		}
                            			
                            		if (Synth.isKeyDown(lastNote))
                            			eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity()));	
                            		
                            	}
                            	lastNote = n;
                            	eventIds.setValue(n, Message.makeArtificial());
                            
                            function onNoteOff()
                            {
                            	local n = Message.getNoteNumber();
                            	
                            	if (eventIds.getValue(n) != -99)
                            	{
                            		Synth.noteOffByEventId(eventIds.getValue(n));
                            		eventIds.setValue(n, -99);
                            	}
                            }
                             
                            

                            I combined the previous code, and the first two KS can work normally, but when the third KS is triggered, it can't transition normally. I'm stuck here.
                            bbd75801-31f7-418c-8f7a-53aa31c86382-QQ_1752347821807.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 d.healey

                              @CatABC This turned out to be more complicated than I thought. At first I tried the muter method, but the problem is that switching the muter is too slow, so you have to press the keyswitch before triggering the sound, which I think is the problem you were describing.

                              The solution I found is to add one script per sound generator as you were doing. They are all aware of the range of keyswitches so each script can check if its keyswitch has been triggered, and if it has it will play sounds, if it hasn't it will just ignore them.

                              The last challenge was to prevent hanging notes after the keyswitch has changed, to do that I'm tracking the last key press before the switch and then turning off the last note in the note off callback.

                              It's possible there might still be hanging notes under certain conditions, so if you come across any you will have some debugging to do - hanging note issues are always fun 😧

                              HiseSnippet 1752.3oc6aztTaaD7DfHwNscRRSa5OUyzIicGJCx.NPnzX9vjv3PvClP5+xbHcx9FKemqtyTbyj2k9lz12f9HzGg7.zYZ2Sx1RhHLNNjTfJ+CO91a281Ota+ZfpdbKhPv8PZY2uaaBR6Szq0kIarQCLkg1dSjVF8lBYCJqNZ8tswBAwFooM4iUaqkYJj+m27n0wtXlEIDDBc.mZQdJsEUFBsZoJTW2sv1j8oshf8Bk11hy1f6x6.hxj5ygZisZhqSdFVg1D5nmfEMPZeq9hEl2ZA6GXWnvhKWzBWjrrC1wwbd6EVn3RKaN+x3EVpHYtEQZSW1lJ4d0jXIQfzlZctc2ZM3+LK3.NfJnG5RTKLQ0fSN.7VbWakJpfh1nA00tZeaj.gztV0PK1jAVr6nuC0lN.dnk6l9aXDRQTCn1DwEuIiIdlQEu4hHdIHRZQDooBDoaoWyxi1VFtiRdtg91LIwyAC9onhR.tHs+PeCNf.SNaKbSxV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ECahCtiqzPzDxm6RYMI16y8wGMRpPeituVjEcoUKB799ZwudATKt32qSrJzxzWFqQa01kTlcDjhBfnjwaCuR70y9PiWe1NbFucCNiZEsN28Hf0pdchWTYOQEZMoDa0LDxcJsGwkfiVy92T5oPYdXOvNQFSag46b0pI5u9J8.w0PEH238wuM0n42Fdg+mK8qN4U69U2i2QRY02ACWHUgKfBQpAsIZQfSmwHtpjoZSnR6Erdt9QRpQX19K9G3SuMMUq05soY+Miph2seOwp1eC6I9K7W6v8ZcQokXyD6INFzSPQgDoHFzMg5uXwYc.nXXoLEaAlhH3c8R8AVHZnfpXVLlAqiwocngQrQ+0iJyvvkhZDPys2UXAFFkcN5yvpcbEjWPskMLiRXH3BQA+DrmM3CsNG5fOdb9H3mPzno+P0N+4RPm2mV6Kj1ZeZq8os1m1ZeZq8WRase4K0s1O86dq8mYahnQh+Cqu6ysi3zaJ9rOhqxcrVHsi0++0w54t7N9cu9Q0zo5H33KOd56pCcpUvv2ca7eu+9h63BJjNtfA.uYRiK35oiK3J13BlOcbAoiKHcbAoiKHcbAWRGWvCSGWP53BtrMtf4SGWP53BRGWP53BtXLtfOFmQKrkG+kVAYaUALttODPuY9+6HkQeG0ZCySllEo9arh9RKq3r5sHrv3R37iKgKLtDt33RXwwkvGLtDtzYSnpY305H4sBdmfP6TsreYQZZAy+v+IC5ewhpACk
                              

                              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 your Snippet, and I don't know if you have the same problem. When the third KS is triggered, the note triggered by the third KS cannot be stopped. In addition, when switching from the first KS to the second KS, and then switching from the second KS back to the original KS, there will be no sound, but there is always a level display on the waveform generator. I searched for a long time, but I couldn't solve the problem. This problem is too frustrating.
                                78de0978-090b-4ebd-a447-30862f5e9150-QQ_1752416294304.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 said in Make the Gain knob smooth the gain?:

                                  the note triggered by the third KS cannot be stopped.

                                  Yeah this is the kind of hanging note issue I said you might run into. I'm just testing with my keyboard in realtime, haven't tried with MIDI in a daw but I expect it is less forgiving.

                                  You'll need to dig into the code to see how to mitigate the hanging notes.

                                  It's a bit cumbersome to work on because each time you make a change to one of the scripts you need to copy it over to the others. If you move it to an external file it might automatically update the others when it's compiled, I'm not sure though.

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

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

                                    @d-healey

                                    Aha, here is a free software loopMIDI, which can transfer DAW MIDI information to HISE in real time.

                                    loopMIDI | Tobias Erichsen

                                    favicon

                                    (www.tobias-erichsen.de)

                                    //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 There is a MIDI player built into HISE, you don't need to transfer it from the DAW. You could also build HISE as a plugin if you really wanted to work within the DAW.

                                      Libre Wave - 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

                                        @d-healey said in Make the Gain knob smooth the gain?:

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

                                        the note triggered by the third KS cannot be stopped.

                                        Yeah this is the kind of hanging note issue I said you might run into. I'm just testing with my keyboard in realtime, haven't tried with MIDI in a daw but I expect it is less forgiving.

                                        You'll need to dig into the code to see how to mitigate the hanging notes.

                                        It's a bit cumbersome to work on because each time you make a change to one of the scripts you need to copy it over to the others. If you move it to an external file it might automatically update the others when it's compiled, I'm not sure though.

                                        I added this line of code to each onNoteOff,

                                        	Synth.addVolumeFade(eventIds.getValue(lastNote), 500, -100);
                                        

                                        and it will have this error,

                                        ! onNoteOff() - Line 11, column 21: Event ID must be positive
                                        

                                        but the note can be stopped. In addition, there is currently a problem that the third note does not play the note pressed above, but the note of KS itself.

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

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

                                          @CatABC the last number is a delay time. You cant have a negative delay time. Thats saying you're trying to turn off a note that you havent played yet. Its usually 'zero' unless your compensating your a delayedNoteOn message in which case it should be a positive number equal to your delayed message amount / or more, hence your error.

                                          must be positive

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

                                          17

                                          Online

                                          1.8k

                                          Users

                                          12.1k

                                          Topics

                                          105.5k

                                          Posts