HISE Logo Forum
    • Categories
    • Register
    • Login

    Changing Hise Legato To only 2 Octaves???

    Scheduled Pinned Locked Moved Scripting
    52 Posts 4 Posters 2.4k 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.
    • NatanN
      Natan
      last edited by

      This is The Code From Source On HardcodedScriptProcessor.h

      class LegatoProcessor: public HardcodedScriptProcessor
      {
      public:
      
      	SET_PROCESSOR_NAME("LegatoWithRetrigger", "Legato with Retrigger", "Enables monophonic mode and retriggers the pressed key if there was a key release. ");
      
      	LegatoProcessor(MainController *mc, const String &id, ModulatorSynth *ms):
      		HardcodedScriptProcessor(mc, id, ms)
      	{
      		onInit();	
      	};
      
      	void onInit() override
      	{
      		lastNote = -1;
      		lastEventId = -1;
      		possibleRetriggerNote = -1;		
      		possibleRetriggerChannel = -1;
      		lastVelo = 0;
      	}
      
      	void onNoteOn() override
      	{
      		int newID = Message.makeArtificial();
      
      		if(lastNote != -1)
      		{
      			Synth.noteOffByEventId(lastEventId);
      		
      			possibleRetriggerNote = lastNote;
      			possibleRetriggerChannel = lastChannel;
      		}
      	
      		
      		lastEventId = newID;
      
      		lastNote = Message.getNoteNumber();
      		lastVelo = Message.getVelocity();
      		lastChannel = Message.getChannel();
      	};
      
      	void onNoteOff() override
      	{
      		if (Message.getNoteNumber() == lastNote && Message.getChannel() == lastChannel)
      		{
      			Message.ignoreEvent(true);
      			Synth.noteOffByEventId(lastEventId);
      		}
      
      		int number = Message.getNoteNumber();
      	
      		int channel = Message.getChannel();
      
      		if(number == possibleRetriggerNote && channel == possibleRetriggerChannel)
      		{
      			possibleRetriggerNote = -1;
      			possibleRetriggerChannel = -1;
      		}
      	
      		if(number == lastNote)
      		{
      			if(possibleRetriggerNote != -1 && possibleRetriggerChannel != -1)
      			{
      				lastEventId = Synth.addNoteOn(possibleRetriggerChannel, possibleRetriggerNote, lastVelo, 0);
      
      				lastNote = possibleRetriggerNote;
      				lastChannel = possibleRetriggerChannel;
      				possibleRetriggerNote = -1;
      				possibleRetriggerChannel = -1;
      			}
      			else
      			{
      				lastNote = -1;
      			}
      		}
      	}
      
      
      1 Reply Last reply Reply Quote 0
      • NatanN
        Natan
        last edited by

        Here is A Legato Script Made By David Healey, But It Affects All Notes and It is
        Not Like The Bult in One,

        And Once I Release The Second Note It won't Go Back To The First Note.
        PS "I Changed The Fade Time, To Make It Faster"

        HiseSnippet 1035.3oc4W0saaaCElx1ZnxcoXcnnXWpArKb.RBrV61ZQQPShicgwhSLhyx1cErRGYSDIRMIJuYDj2w8nz2fsCojhjS07bMvRA17Ulemyg767KoFGKbgjDQLwv5hEQ.w3yMmrfKm0aFkwICOlX7HyQzDIDamAczhHZRB3QLLZ9FEfgUKh926e8Qz.J2EJgHjKELW3DVHSVhN9fejEDLf5AWvBqn8yOXnqf2SDHRQ9zzrKIh5dEcJbJUoVCShwm02iIEwSjTIjPLZcjvawjYheimo+krD16B.0BGxDbixfGHB7TLV8eRuYr.uwE9cBgXXNtLJzLKJ7DyQLO1s3kQiuPKvtzhpwCiFqhdNUoW2ZomSMziTgcsxXGRBgWZ.UtLyToibALwxYpgbIvSXxEUSWeRo6iMGyjtypmuMpguXh5ea9lm72xruuO3JKIaKyA+x8al9QYT4glSXbP2QpIxS0qs+Y5bv9M.GhUAUmUzT9GqaSYzZ2TdlqDO9Kho7jHQxRa7DHjcgfqhHkf+TBLHF90yUY4p38Dz3ZE89WO.cxZsYBUlFqKWNLTjxkKUdzbsyIUGNrbWSE8qYRQqOASJ9HFjY7g8dO1bhaLKRVJQwsGXF.SwRmk3TlhjFW2vLFlZCyAtbnm89169xW9psZqvBvaBNUHgbP+TtqJnYK3Jzy3c1dq1WuUaqQ3Qgys2KjdEbXrj4ybYzfNaiaCJk4a2QWRuGK4DMOTs6wyUZfafkZGzJUPguVebJQVVYFR87tTDjFBpB1B81w1o6N165zsa9AUqxEbaJH6mYWms2wVYHdDu5i1J8YYci97JCY0otRuJAvJpnPNMM7cPrVqatab02uHvphJ+MFZu+92letMJl4J7rM4nEEbImnEgo6lpsrtShNyCqxqdBtLVDDnN41W21p8MssqHVMCodI4F1gqo8N1XVOEtUQrtc4FiGtdMF3HJ7BCYEEE7gbl7rHH+oAEkne.hueUnR+pJp1cpQsRnU2YR5kwO0zvgGSkTUyZNFpWDf8HJu03XXNNZNq00x7XH4JoH5d7I.MWu6w9Gl8XUvwIrvn.nOeNDfNolieI5U9zz.YA5x2dMRvEQyDbla0Q6mCxX1zoPbUtWqCcnThuYrD4IGbND.zpWS8MGbBd8BMFiSvFFKbV+XwpxWekYFcsU0W1+23oaM++4S2NWjJY7oinXg5uieRANUdB9hIW.YBmCA3AYZzPMIHacW05rmLw8zK9S7WtPG0ZibgNEBuWNiPpar3stYi2T0xOPif9MW+QXV3WChqscH5A2nclc2qKIDepyaccUg6cw3S817safMOaCr44afMe2FXy2uA17CafMuXk1ndk4goRQXVqHBLtu9JFCi9bJVIqq5I+E.ysMjw
        
        d.healeyD 1 Reply Last reply Reply Quote 1
        • ulrikU
          ulrik @Natan
          last edited by ulrik

          @natan said in Changing Hise Legato To only 2 Octaves???:

          Hey everyone

          As The Title Says, I Need to Change The Legato Range From All Notes To Only 2 Octaves,
          Starting From Note 48 To 72.

          make an if statement maybe?

          if (Message.getNotenumber() > 47 && Message.getNoteNumber() < 73) ==> then apply the legato script?
          

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

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

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @ulrik
              last edited by

              @Natan this script deals with held notes as well

              HiseSnippet 1108.3oc2W0saaaCElxNZn1aYacnXXWpArKrAbBr1x5VQPVShiSgwxOFwYYCnnnfU5XahPQpIQ4Mih7.s2l8nz2fsCojrjRbBRMPKVmg8E77G+NeGdNjdXjzChikQDqFmOODHVeh8n4B0z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guVsPxi18LfCzxWn9M6dDdQHMB4IXE4B225qRVZ85qrSgqi9LryGtOfr9+ue.4YxDESL4XJdH7Ow4D3fpQ3617.b2EBbdHJypltKOccW85zGtI7MK9G7SlRW8ZqLkt4JeurGATuH4K8RmJpOm9.iDLuEl+ZWC6i0qcbIlIkne1c2rKI.e80K87zT7F3vsk6y2tB97cqfOasB978qfOOdE74GVAe9w6zG8Ce2KQICRa4PAC6at9vxpufhmdMmzI+KG5iZZA
              

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              NatanN lalalandsynthL 2 Replies Last reply Reply Quote 1
              • NatanN
                Natan @ulrik
                last edited by

                @ulrik Thank you So Much Ulrik, It is A Very Nice Legato Script

                But The Question Is How To Make It Limited To Only 2 Octaves?

                ulrikU 1 Reply Last reply Reply Quote 0
                • lalalandsynthL
                  lalalandsynth @ulrik
                  last edited by

                  @ulrik Anyone made a legato script with selectable hi-last-low note priority ?

                  https://lalalandaudio.com/

                  https://lalalandsynth.com/

                  https://www.facebook.com/lalalandsynth

                  https://www.facebook.com/lalalandsynth

                  NatanN ulrikU 2 Replies Last reply Reply Quote 0
                  • NatanN
                    Natan @lalalandsynth
                    last edited by

                    @lalalandsynth Lala How are You Man, You Doing Good?
                    It was so Long I Did'nt See You round :)

                    Looks Like We Are On Some Train With Legato And Spicific Notes :)

                    lalalandsynthL 1 Reply Last reply Reply Quote 1
                    • ulrikU
                      ulrik @Natan
                      last edited by ulrik

                      @natan

                      if (Message.getNoteNumber() > 47 && Message.getNoteNumber() < 73) ==> then apply the legato script?
                      

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

                      NatanN lalalandsynthL 2 Replies Last reply Reply Quote 1
                      • ulrikU
                        ulrik @lalalandsynth
                        last edited by

                        @lalalandsynth what do you mean?
                        if several pressed always the highest note is sounding or?

                        Hise Develop branch
                        MacOs 15.3.1, Xcode 16.2
                        http://musikboden.se

                        1 Reply Last reply Reply Quote 0
                        • NatanN
                          Natan @ulrik
                          last edited by

                          @ulrik Thank you Ulrik, let me Check and See if I Can Do The Changes

                          1 Reply Last reply Reply Quote 0
                          • lalalandsynthL
                            lalalandsynth @ulrik
                            last edited by lalalandsynth

                            @ulrik On a classic monosynth - it might have low note priority , so if you play C1 , you cannot play any notes above that , but you could play B0 and it would overtake the C1 , opposite for High note priority.

                            And yes, by the same token if you play several notes at the same time , say a chord , only the highest note would play.

                            Essential for modeling analog synth behaviour.

                            I guess the tricky part is that it has to remember note 1 when note 2 is played.
                            On on analog monosynth you could hold C1 , also play B0 - that now plays and when you let go of C1 would play again.
                            Without retriggering the ADSR/VCA.

                            Last note priority , would allow either way .

                            Sorry if I am explaining something that is already clear :P

                            https://lalalandaudio.com/

                            https://lalalandsynth.com/

                            https://www.facebook.com/lalalandsynth

                            https://www.facebook.com/lalalandsynth

                            ulrikU 1 Reply Last reply Reply Quote 0
                            • lalalandsynthL
                              lalalandsynth @Natan
                              last edited by

                              @natan Hi mate , yes doing great , took a bit of a break , working on hardware these days .

                              https://lalalandaudio.com/

                              https://lalalandsynth.com/

                              https://www.facebook.com/lalalandsynth

                              https://www.facebook.com/lalalandsynth

                              1 Reply Last reply Reply Quote 0
                              • ulrikU
                                ulrik @lalalandsynth
                                last edited by

                                @lalalandsynth Ok, I think I understand.
                                The legato script above remember all pressed notes so I think it would be doable to have a "LowNote/HighNote priority switch, try it!

                                Hise Develop branch
                                MacOs 15.3.1, Xcode 16.2
                                http://musikboden.se

                                lalalandsynthL 1 Reply Last reply Reply Quote 0
                                • lalalandsynthL
                                  lalalandsynth @ulrik
                                  last edited by

                                  @ulrik demonstration :)
                                  https://youtu.be/6B14tqEW0Uc

                                  https://lalalandaudio.com/

                                  https://lalalandsynth.com/

                                  https://www.facebook.com/lalalandsynth

                                  https://www.facebook.com/lalalandsynth

                                  ulrikU 1 Reply Last reply Reply Quote 1
                                  • NatanN
                                    Natan
                                    last edited by

                                    @ulrik
                                    Ulrik
                                    Can You Help Here:
                                    Where I supposed To Place the Extra Range Code:

                                    if (Message.getNotenumber() > 47 && Message.getNoteNumber() < 73) ==> then apply the legato script?
                                    
                                    
                                    function onNoteOn()
                                    {
                                    	Message.makeArtificial();
                                    
                                    	if (Synth.isLegatoInterval())
                                    	{
                                    		if (eventId != -99)
                                    		{
                                    			Synth.addVolumeFade(eventId, 10, -100);
                                    			heldNotes.push(lastNote);
                                    		}
                                    		
                                    		Synth.addVolumeFade(Message.getEventId(), 0, -99);
                                    		Synth.addVolumeFade(Message.getEventId(), 0, 0);
                                    	}
                                    
                                    	eventId = Message.getEventId();
                                    	lastNote = Message.getNoteNumber();
                                    }
                                    
                                    ulrikU 1 Reply Last reply Reply Quote 0
                                    • ulrikU
                                      ulrik @Natan
                                      last edited by

                                      @natan What have you tried?

                                      Hise Develop branch
                                      MacOs 15.3.1, Xcode 16.2
                                      http://musikboden.se

                                      NatanN 1 Reply Last reply Reply Quote 1
                                      • NatanN
                                        Natan @ulrik
                                        last edited by

                                        @ulrik I Just Placed The If Statement Before The if (Synth.isLegatoInterval())
                                        It shows Some Errors about Message.getNotenumber

                                        ulrikU 2 Replies Last reply Reply Quote 0
                                        • ulrikU
                                          ulrik @Natan
                                          last edited by ulrik

                                          @natan what if you combine all the if statements?
                                          if (Synth.... && Message.getN... > 47 && Message.get....), have you tried that?

                                          Hise Develop branch
                                          MacOs 15.3.1, Xcode 16.2
                                          http://musikboden.se

                                          1 Reply Last reply Reply Quote 0
                                          • ulrikU
                                            ulrik @Natan
                                            last edited by

                                            @natan I see the code is misspelled, my bad, it should be Message.getNoteNumber()

                                            Hise Develop branch
                                            MacOs 15.3.1, Xcode 16.2
                                            http://musikboden.se

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

                                            31

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.0k

                                            Posts