HISE Logo Forum
    • Categories
    • Register
    • Login

    Make the Gain knob smooth the gain?

    Scheduled Pinned Locked Moved General Questions
    77 Posts 3 Posters 1.1k 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 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.SNaKbSxVdvhADjq3byMiA7U9Ux5zgYIoblAm8LtjrKKW9ruJalruNqwI2xwIw8TmiG20k3k31p6FdCivbrNsNj3MiwQX2NjAHB5ebip9oaTi5ysBT6HHxYaynxcaSXm1MATOaE7qmu8lXIV4I5ACvqMwSRUhf1ljif2AA9kL5aRDMk71vKg2xoAWW31cbwx32gTuz5sAXCh43TdGlfJ6F8k341EqQUDukdUpzpQxx3DIHifk5CgL1643mpW1wgXICEvoz25G+v71K5w+YAG+MzqQYD+Xn9G9W5u13E3iHFOlvHdJim4Phk9miZrz1ibrzcsjvwuuGlIZyEwXbMRK59blxJDB74B30O4m1S4MiBeCN1Kwsdyi1BTxDooFV1wy+ZwZs3cXxXWClbXgnMGyPzScIND8m2CZnDYlTn5I96ozAerPZPNBh2rssvXUixr5fSXVKOBHtJ05oTgLGDu1i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Rase4K0s1O86dq8mYahnQh+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 CatABCC 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?:

            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

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

                      @Chazrox I used Synth.noteOffByEventId() instead and it works fine now

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

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

                        78de0978-090b-4ebd-a447-30862f5e9150-QQ_1752416294304.png
                        4e35b4a3-650e-4fa4-9317-8642508125be-QQ_1752566058573.png
                        @d-healey

                        I found that KS will overwrite the value of lastNote. When the third KS is triggered, eventIds.setValue(lastNote, Synth.playNote(lastNote, Message.getVelocity())); does not play the original note value. Is it possible to write the lastNote value back to the first value in the onNoteOff function?

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

                          @CatABC I didnt know you can eventId.setValue(). That works?

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

                          36

                          Online

                          1.8k

                          Users

                          12.1k

                          Topics

                          105.7k

                          Posts