Release Triggers with Sustain pedal support
-
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; } } }
-
@It_Used This is my most recent release trigger script with attenuation support. Perhaps it will help provide some guidance for your script.
RhapsodyBoilerplate/modules/ReleaseTrigger.js at main
RhapsodyBoilerplate - Boilerplate code used by Rhapsody.
Codeberg.org (codeberg.org)
-
@d-healey Thank you, I will study it and maybe make some changes, or I will use it as a reference.