Posted: 20 Feb 2018, 11:45
Sorry to seem lazy, but can anyone tell me if there is a module or patch that will allow you to draw a curve and remap midi messages (such as to change the keyboard velocity response curve).
BrainModular Users Forum
https://www.brainmodular.com/forums/
https://www.brainmodular.com/forums/viewtopic.php?f=6&t=6134
Code: Select all
//////////////////////////
// transpose midi example
/////////////////////////
// parameters declaration
var input : Tparameter;
var output : Tparameter;
var velocitiesIN : TParameter;
// initialisation : create parameters
procedure init;
begin
Input := CreateParam('midi in',ptMidi);
Output := CreateParam('midi out',ptMidi);
velocitiesIN := CreateParam('velocities',ptArray);
SetIsInput(Output,false);
SetIsOutPut(Input,false);
SetIsOutPut(velocitiesIN,false);
SetLength(velocitiesIN, 128);
end;
// Global variables
var i : integer;
var nbOfMidi : integer;
var ReceivedMidi : TMidi;
var newVelocity : integer;
//////////////////////////////
// main proc
//////////////////////////////
procedure Process;
begin
nbOfMidi := GetLength(input); // get the number of incoming midi codes
if nbOfMidi > 0
then begin
SetLength(outPut,nbOfMidi); // set the number of output codes
for i := 0 to nbOfMidi-1 // loop for all input codes, for polyphonic data (chords)
do begin
GetMidiArrayValue(input,i,ReceivedMidi); // get each code
newVelocity := round(getDataArrayValue(velocitiesIN,ReceivedMidi.data2));
ReceivedMidi.data2 := trunc(newVelocity); // calculate vel
SetMidiArrayValue(output,i,ReceivedMidi); // set output value
end;
end
else SetLength(outPut,0); // nothing received, set out length to 0
end;