From 8778880bff3acfb8932e05a8cac7b2ebb310c750 Mon Sep 17 00:00:00 2001 From: stooch <58619199+stooch@users.noreply.github.com> Date: Tue, 23 Dec 2025 15:31:59 -0700 Subject: [PATCH 1/2] Release MIDI Keytracked Velocity (Nait) v1.0 First release for Reapack --- .../nait_MIDI Keytracked Velocity (Nait).jsfx | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx diff --git a/MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx b/MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx new file mode 100644 index 0000000..7bf1f51 --- /dev/null +++ b/MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx @@ -0,0 +1,128 @@ +desc: MIDI Keytracked Velocity (Nait) +author: Nait +version: 1.0 +changelog: First release for Reapack +about: + Allows setting of the MIDI velocity based on keytracking (ex. high notes play give higher velocities, lower notes lower velocities). + + Parameters + Keytracked Velocity Limit (Min/Max): Keytracking velocity will stay within this min/max range and scale accordingly. Does not affect played velocity (which is important to know for the "Keytrack Mode" parameter). + + Note Range (Min/Max): Only played notes falling within this range will potentially have their velocity keytracked. Next parameter describes how they're handled if outside range. + + How to Handle Notes (Below/Above) Note Range: If notes played are outside the note range, do you want hem to snap to the min/max limit, or have velocity as played? + + Velocity Inversion: + - Normal: Higher notes have higher velocities. + - Invert: Lower notes have higher velocities. + + Keytrack Mode: + - Never Keytrack: Essentially disables this plugin. This allows another easy way to toggle keytracking on/off. Only played velocity is used. + - Always Keytrack: Keytracking velocity is always used. + - Keytrack If Stronger: Will use keytracking velocity, unless played velocity is higher than what keytrack velocity would be. + - Keytrack If Softer: Will use keytracking velocity, unless played velocity is lower than what keytrack velocity would be. + +slider1:0<0,127,1>Keytracked Velocity Limit (Min) +slider2:127<0,127,1>Keytracked Velocity Limit (Max) +slider3:0<0,127,1>Note Range (Min) +slider4:127<0,127,1>Note Range (Max) +slider5:0<0,1,1{Set to Min/Max Vel,Keep Original Velocity}>How to Handle Notes Below Note Range +slider6:0<0,1,1{Set to Min/Max Vel,Keep Original Velocity}>How to Handle Notes Above Note Range +slider7:0<0,1,1{Normal (High Notes = High Velocity),Invert (High Notes = Low Velocity)}>Velocity Inversion +slider8:1<0,3,1{Never Keytrack, Always Keytrack, Keytrack If Stronger, Keytrack If Softer}>Keytrack Mode + +@init +NOTE_OFF = 0x80; +NOTE_ON = 0x90; + +@slider +lowvel = min(slider1, slider2); +highvel = max(slider1, slider2); +lownote = min(slider3, slider4); +highnote = max(slider3, slider4); + +// this will update how they display +slider1 = lowvel; +slider2 = highvel; +slider3 = lownote; +slider4 = highnote; + +lowmode = slider5; +highmode = slider6; +invert = slider7; +keytrackmode = slider8; + +@block +while ( + midirecv(offset, msg1, msg23) +) +( + status = msg1 & 0xF0; + notenumber = msg23 & 0xFF; // note number + playedvel = (msg23 >> 8) & 0xFF; // velocity + + // Check for Note On with velocity > 0, and within the note range + status == NOTE_ON && playedvel > 0 ? ( + // Calculate Keytracking Velocity + notenumber >= lownote && notenumber <= highnote?( + // note values are in the set range + // Set velocity based on note number + range = max(1, highnote - lownote); + pos = (notenumber - lownote) / range; + invert ? pos = 1 - pos : pos = pos; // invert if invert is 1 + keytrackedvel = floor(pos * (highvel - lowvel)) + lowvel; + ) : + notenumber < lownote && lowmode == 0 ? ( + // note value is below range + invert ? keytrackedvel = highvel : keytrackedvel = lowvel; + ) : + notenumber > highnote && highmode == 0 ? ( + // note value is above range + invert ? keytrackedvel = lowvel : keytrackedvel = highvel; + ) : ( + // else, keep the velocity as whatever it originally played at + keytrackedvel = playedvel; + ); + + // Apply Keytrack Mode + keytrackmode == 0 ? ( + // Never Keytrack + finalvel = playedvel; + ) : + keytrackmode == 1 ? ( + // Always Keytrack + finalvel = keytrackedvel; + ) : + keytrackmode == 2 ? ( + // Keytrack if stronger than played + finalvel = max(keytrackedvel, playedvel); + ) : + ( + // Keytrack if softer than played + finalvel = min(keytrackedvel, playedvel); + ); + + msg23 = notenumber | (finalvel << 8); + ); + midisend(offset, msg1, msg23); +); + +@gfx 360 60 +// For displaying of Note Value & Velocity, mainly for debugging. +gfx_a = 1; +gfx_r = gfx_g = gfx_b = 1; +gfx_x = 5; +gfx_y = 10; +gfx_drawstr("Midi Info: "); + +gfx_x = 5; +gfx_y = 30; +gfx_drawstr("Note: "); +gfx_drawnumber(notenumber,0); +gfx_drawstr(" Velocity [Played/Keytracked/Final]: ["); +gfx_drawnumber(playedvel,0); +gfx_drawstr("/"); +gfx_drawnumber(keytrackedvel,0); +gfx_drawstr("/"); +gfx_drawnumber(finalvel,0); +gfx_drawstr("]"); From eed2d58d41b6ba10e6552d089c07ef17aac17c39 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Tue, 23 Dec 2025 18:09:16 -0500 Subject: [PATCH 2/2] remove duplicate author name Authorship is sufficiently documented with the author prefix (name_Package name.jsfx) plus package metadata. --- ... Velocity (Nait).jsfx => nait_MIDI Keytracked Velocity.jsfx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename MIDI/{nait_MIDI Keytracked Velocity (Nait).jsfx => nait_MIDI Keytracked Velocity.jsfx} (99%) diff --git a/MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx b/MIDI/nait_MIDI Keytracked Velocity.jsfx similarity index 99% rename from MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx rename to MIDI/nait_MIDI Keytracked Velocity.jsfx index 7bf1f51..6ad587c 100644 --- a/MIDI/nait_MIDI Keytracked Velocity (Nait).jsfx +++ b/MIDI/nait_MIDI Keytracked Velocity.jsfx @@ -1,4 +1,4 @@ -desc: MIDI Keytracked Velocity (Nait) +desc: MIDI Keytracked Velocity author: Nait version: 1.0 changelog: First release for Reapack