HISE Logo Forum
    • Categories
    • Register
    • Login

    Make the Gain knob smooth the gain?

    Scheduled Pinned Locked Moved General Questions
    79 Posts 4 Posters 3.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.
    • 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
                    • CatABCC
                      CatABC
                      last edited by

                      @d-healey @Chazrox
                      I'm back. After many days, I reviewed the code again today and finally succeeded!
                      We need a loop!
                      I would also like to thank all my friends who provided me with help and various solutions! I love you all😘

                      function onNoteOn()
                      {
                      	local n = Message.getNoteNumber();
                      	local v = Message.getVelocity();
                      	if (n >= knbLoKey.getValue() && n <= knbHiKey.getValue())
                      		lastKs = n;		
                      
                      	if (Synth.isArtificialEventActive(eventIds.getValue(lastNote)))
                      		Synth.addVolumeFade(eventIds.getValue(lastNote), knbFadeTime.getValue(), -100);
                      
                      
                      for (i = 48; i < 127; i++) {
                      	local e = eventIds.getValue(i);
                      		       
                      	if (e != -1)
                      	    Synth.noteOffByEventId(e);
                      	    
                      		if (n == knbKs.getValue() && Synth.isKeyDown(i))
                      		{
                      			ADSR.setAttribute(ADSR.Attack, fadeIn.getValue());
                      
                      			lastKs = n;
                      			
                      			eventIds.setValue(i, Synth.playNote(i, v));	
                      				
                      			return Message.ignoreEvent(true);
                      		}else{
                      			ADSR.setAttribute(ADSR.Attack, knbResetAt.getValue());
                      		}
                      	}	
                      		lastNote = n;
                      		
                      		if (lastKs != knbKs.getValue())
                      			return Message.ignoreEvent(true);
                      	
                      		eventIds.setValue(n, Message.makeArtificial());
                      	
                      }
                      

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

                      GUJIANG 1 Reply Last reply Reply Quote 2
                      • GUJIANG
                        GUJIAN @CatABC
                        last edited by

                        @CatABC Send a complete example to learn from

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

                        20

                        Online

                        1.9k

                        Users

                        12.4k

                        Topics

                        108.2k

                        Posts