Skip to content

Commit

Permalink
Release MIDI Keyvel Filter v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagolr committed Oct 1, 2023
1 parent 8c90a04 commit 27825c5
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions FX/tilr_MIDI Keyvel Filter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- @description MIDI Keyvel Filter
-- @author tilr
-- @version 1.0
-- @about
-- #MIDI Keyvel Filter
--
-- Filter notes by key and velocity, also transposes notes.

desc:MIDI Keyvel Filter

slider1:0<0, 127, 1>Note min
slider2:127<0, 127, 1>Note max
slider3:0<0, 127, 1>Vel min
slider4:127<0, 127, 1>Vel max
slider5:0<-60,60,1>Transpose

@init
NOTE_ON = $x90;
NOTE_OFF = $x80;

@slider
slider1 > slider2 ? slider2 = slider1;
slider3 > slider4 ? slider3 = slider4;
noteMin = slider1;
noteMax = slider2;
velMin = slider3;
velMax = slider4;
transpose = slider5;

@block

while
(
midirecv(offset,msg1,note,vel) ?
(
status = msg1 & $xF0;
channel = msg1 & $x0F;

status == NOTE_ON || status == NOTE_OFF ?
(
(note >= slider1 && note <= slider2 && vel >= slider3 && vel <= slider4) || status == NOTE_OFF ?
(
note += transpose;
note < 0 ? note = 0; note > 127 ? note = 127;
midisend(offset, msg1, note, vel);
);
) : (
midisend(offset, msg1, note, vel);
);
1; // Force loop to continue until all messages have been processed
);
);

0 comments on commit 27825c5

Please sign in to comment.