http://www.reaper.fm/reaplugs/
http://www.reaper.fm/sdk/js/js.php
I've struggled the chord based MIDI manipulations, and IMO this is the easiest way
https://www.youtube.com/watch?v=L4ZCwrU7XYk
created the most basic 'hello world' like project for self education purpose, maybe it can help to able to start the work with it to somebody so share it
Code: Select all
desc:MIDI transpose
slider1:0<0, 3, 1>Octave offset
// enables processing optimizations
// MIDI-only FX should always have these lines.
in_pin:none
out_pin:none
@init
note_buffer = 0; // 4 entries per open note: orignote, channel, vel, transnote
buffer_length = 127;
@slider
octaveShift = slider1;
@block
octaveShift != last_octaveShift ?
(i = 0;
loop
(buffer_length,
midisend(0, $x80|last_channel, i); // clear the sustaining transposed note
note_buffer[i] = 0;
i += 1;
);
last_octaveShift = octaveShift;
);
while
(
midirecv(offs, m1, m2) ?
(
in_channel = m1&$xF; // channel
in_message = m1&$xF0;
in_note = m2&$xFF; // original note
velocity = (m2&$xFF00)/256; // velocity
new_note = in_note + octaveShift * 12; // octave shift
note_change = new_note - in_note; // difference between the two ones
(in_message == $x80 ? //note-off
(note_buffer[new_note] = 0;
m2 += note_change;
)
:
(in_message == $x90 ? // note-on or note-off
(note_buffer[new_note] == 1 ?
(midisend(0, $x80|in_channel, new_note);); // clear the sustaining transposed note
note_buffer[new_note] = 1;
m2 += note_change;
);
);
);
midisend(offs, m1, m2);
);
);
have fun with it
ps. hello Bitwig developers a JS based similar one pls