HISE Logo Forum
    • Categories
    • Register
    • Login

    Release Triggers with Sustain pedal support

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    4 Posts 2 Posters 258 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.
    • It_UsedI
      It_Used
      last edited by

      I tried to write a script with Release Triggers, something seemed to work out, but still I wanted to do it the same way as it is implemented in Hardcoded scripts, that is, to add the ability to adjust attenuation, but I can't even imagine how it could be created. I found this script, but here it is broken, it is always the most recent value of the table horizontally, no matter how much time is set by the Time knob. Since I have very little programming experience, I would like to ask for advice on how to improve the script.

      // Init
      reg CC64;
      reg NoteID = [];
      reg VelID = [];
      reg i = 0;
      reg KeyPressed = 0;
      reg Cycle;
      
      
      // Callbacks
      
      
      function onNoteOn()
      {
      	Message.ignoreEvent(true);
      	if (CC64 == 1)
      	{
      		NoteID[i] = Message.getNoteNumber();
      		VelID[i] = Message.getVelocity();
      	}
      	else
      	{
      		NoteID[i] = Message.getNoteNumber();
      		VelID[i] = Message.getVelocity();
      	}
      	i++;
      }
      
      
      function onNoteOff()
      {
      	Message.ignoreEvent(true);
      	if (CC64 == 0)
      	{
      		for (i = 0; i < NoteID.length && VelID.length; i++)
      		{
      			Synth.playNote(NoteID[i], VelID[i]);
      		}
      		NoteID = [];
      		VelID = [];
      		i = 0;
      	}
      }
      
      function CallReleases()
      {
      	for (i = 0; i < NoteID.length && VelID.length; i++)
      	{
      		Synth.playNote(NoteID[i], VelID[i]);
      	}
      }
      
      
      function onController()
      {
      	if (Message.getControllerNumber() == 64)
      	{
      		if (Message.getControllerValue() >= 64)
      		{
      			i = 0;
      			NoteID = [];
      			VelID = [];
      			CC64 = 1;
      			Cycle = 1;
      		}
      		else
      		{
      			if (Cycle == 1)
      			{
      				CallReleases();
      				Cycle = 0;
      			}
      			i = 0;
      			CC64 = 0;
      		}
      	}
      }
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @It_Used
        last edited by

        @It_Used This is my most recent release trigger script with attenuation support. Perhaps it will help provide some guidance for your script.

        https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/modules/ReleaseTrigger.js#L58

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        It_UsedI 2 Replies Last reply Reply Quote 1
        • It_UsedI
          It_Used @d.healey
          last edited by

          @d-healey Thank you, I will study it and maybe make some changes, or I will use it as a reference.

          1 Reply Last reply Reply Quote 1
          • It_UsedI
            It_Used @d.healey
            last edited by

            @d-healey i find bug, your midi list isn't cleanup after function complete. This error may trigger the release notes again, even if they have already been played. And this happens if you send another message from controller 64, no matter what value it will be, 0, or more than 63 - releases will still be triggered.
            Add this at the end of function playReleaseNote

            noteIds.clear();
            velocityValues.clear();
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post

            20

            Online

            2.0k

            Users

            12.7k

            Topics

            109.8k

            Posts