HISE Logo Forum
    • Categories
    • Register
    • Login

    Release Triggers with Sustain pedal support

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    3 Posts 2 Posters 40 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.

        Link Preview Image
        RhapsodyBoilerplate/modules/ReleaseTrigger.js at main

        RhapsodyBoilerplate - Boilerplate code used by Rhapsody.

        favicon

        Codeberg.org (codeberg.org)

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

        It_UsedI 1 Reply Last reply Reply Quote 0
        • 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
          • First post
            Last post

          28

          Online

          1.9k

          Users

          12.3k

          Topics

          106.9k

          Posts