ArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2009-01-17T01:13:14+02:00 https://brainmodular.com/forums/app.php/feed/topic/1302 2009-01-17T01:13:14+02:00 2009-01-17T01:13:14+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7167#p7167 <![CDATA[Need a script]]> It work like a charm and it's exactly what I need.
Thanks you again for your help.
Regards

Statistics: Posted by moody33 — 17 Jan 2009, 00:13


]]>
2009-01-15T23:01:50+02:00 2009-01-15T23:01:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7158#p7158 <![CDATA[Need a script]]>

CODE:

VAR pIn, pOut, pReset &#58; tParameter;VAR tmp &#58; tMidi;VAR len, i &#58; integer;PROCEDURE Init;BEGIN   pIn &#58;= CreateParam&#40;'midi in', ptMidi&#41;; SetIsOutput&#40;pIn, FALSE&#41;;   pOut &#58;= CreateParam&#40;'array out', ptArray&#41;; SetIsInput&#40;pOut, FALSE&#41;;   pReset &#58;= CreateParam&#40;'reset to 0', ptButton&#41;; SetIsOutput&#40;pReset, FALSE&#41;;   SetLength&#40;pOut, 128&#41;;END; // Init// mainBEGIN   len &#58;= GetLength&#40;pIn&#41;;   FOR i &#58;= 0 TO &#40;len - 1&#41; DO BEGIN      GetMidiArrayValue&#40;pIn, i, tmp&#41;;      IF &#40;&#40;tmp.msg = 144&#41; AND &#40;tmp.data2 > 0&#41;&#41; THEN BEGIN // NoteOn         SetDataArrayValue&#40;pOut, tmp.data1, 1&#41;;         //writeln&#40;'NoteOn&#58;'+IntToStr&#40;tmp.data1&#41;&#41;;      END      ELSE IF &#40;   &#40;tmp.msg = 128&#41;               OR &#40;&#40;tmp.msg = 144&#41; AND &#40;tmp.data2 = 0&#41;&#41;&#41; THEN BEGIN // NoteOff         SetDataArrayValue&#40;pOut, tmp.data1, 0&#41;;         //writeln&#40;'NoteOff&#58;'+IntToStr&#40;tmp.data1&#41;&#41;;      END;   END;   IF &#40;GetValue&#40;pReset&#41; = 1&#41; THEN BEGIN      FOR i &#58;= 0 TO 127 DO BEGIN         SetDataArrayValue&#40;pOut, i, 0&#41;;      END;      SetValue&#40;pReset, 0&#41;;   END;END.

Statistics: Posted by bsork — 15 Jan 2009, 22:01


]]>
2009-01-15T14:10:29+02:00 2009-01-15T14:10:29+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7150#p7150 <![CDATA[Need a script]]> I remember a patch ( 12notes switch) but it send integer values, and I don't want 127 wire !

Here is the script ( I dont remember who is the author) . I want quite the same thing but with a single array output in place of integer values. Hope it help.

//////////////////////////
// Remaps each midi note from range 60-71 to triggers
/////////////////////////
// parameters declaration

var input : Tparameter;

var msg : Tparameter;
var data1 : Tparameter;
var data2 : Tparameter;

var trigs : array of Tparameter;

// initialisation : create parameters
procedure init;
var i : integer;
begin
Input := CreateParam('In',ptMidi);
msg := CreateParam('msg', ptdataField);
data1 := CreateParam('data1', ptdataField);
data2 := CreateParam('msg', ptdataField);

SetIsOutPut(Input,false);
SetIsInput(msg, false);
SetIsInput(data1, false);
SetIsInput(data2, false);

setarraylength(trigs,12);
for i := 0 to 11
do begin
trigs := CreateParam('trig'+inttostr(i+1), ptSwitch);
setisInput(trigs, false);
end;
end;

// Global variables

var nbOfMidi : integer;
var Miditmp : TMidi;
var i : integer;
var index : integer;

//////////////////////////////
// main proc
//////////////////////////////
begin

nbOfMidi := GetLength(input); // get the number of incoming midi codes
if nbOfMidi > 0
then begin
for i := 0 to nbOfMidi - 1 do begin
GetMidiArrayValue(input, i, Miditmp);
setValue(msg,MidiTmp.msg);
setValue(data1,MidiTmp.data1);
setValue(data2,MidiTmp.data2);

if ((MidiTmp.msg = 144) or (MidiTmp.msg = 128))
and (MidiTmp.data1 >= 60) and (MidiTmp.data1 <= 71)
then begin
index := MidiTmp.data1 - 60;
if (MidiTmp.msg = 128)
or((MidiTmp.data2 = 0) and (MidiTmp.msg = 144))
then // NoteOff
SetValue(trigs[index], 0)
else
SetValue(trigs[index], 1);
end;
end;
end;
end.

--------------------------------------------------------------------------------

Statistics: Posted by moody33 — 15 Jan 2009, 13:10


]]>
2009-01-15T14:05:22+02:00 2009-01-15T14:05:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7149#p7149 <![CDATA[Need a script]]>
Midi data input flow: Midi note On and Note Off only .
Array ouput format? Don't sure to understand. I need a 127 size array ( corresponding to the 127 note range in midi flow. )
When a Note On ( number 32 for example) is detect, the number off the note activate the corresponding array position (32 here) and set it to 1.
when a Note Off is detect, (32 again), the corresponding array position is set to 0 . 0 is the defaut value for the array.

do you understand what I mean?

Statistics: Posted by moody33 — 15 Jan 2009, 13:05


]]>
2009-01-15T13:59:24+02:00 2009-01-15T13:59:24+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7148#p7148 <![CDATA[Need a script]]>
This could however be done with patching of not too many modules, using SetArrayElement with index=NoteNumber and a bit checking for values (remember that a NoteOn with velocity = 0 is a NoteOff...).

Can't help anything more right now, so if you haven't found out how to patch it and noone else has done it in the meantime, I can create something for you before the weekend.

Statistics: Posted by bsork — 15 Jan 2009, 12:59


]]>
2009-01-15T13:49:26+02:00 2009-01-15T13:49:26+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7147#p7147 <![CDATA[Need a script]]> as amiga909 ask , can you be more precise about your needs.....?

Statistics: Posted by nay-seven — 15 Jan 2009, 12:49


]]>
2009-01-15T13:33:11+02:00 2009-01-15T13:33:11+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7146#p7146 <![CDATA[Need a script]]>
Re: Need a script

for what do u need this?


what kind of midi data do you put in there?

what kind of array data do you need (eg. format, precision)?

Statistics: Posted by amiga909 — 15 Jan 2009, 12:33


]]>
2009-01-15T13:06:13+02:00 2009-01-15T13:06:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7142#p7142 <![CDATA[Need a script]]>
As I don't understand scripts , I ask you for help !

I need a simple script like this:

One Midi input. Range 0-127
One Array output. Range 0-127 (or user defined?)

Each time a note number is triggered, array output is set to 1 until received a note off ( 0 )
For example, if Note number 64 is pressed, then array position "64" is set to 1 .
Of course, I need a polyphonic script, so if I pressed note number 64 and note number 72, array position 64 and 72 would be set to 1, and the other to 0.

Thansk in advance for those who can help me.

And why not, another script that make the inverse? array trigger midi notes?

Statistics: Posted by moody33 — 15 Jan 2009, 12:06


]]>
BrainModular BrainModular Users Forum 2009-01-17T01:13:14+02:00 https://brainmodular.com/forums/app.php/feed/topic/1302 2009-01-17T01:13:14+02:00 2009-01-17T01:13:14+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7167#p7167 <![CDATA[Need a script]]> It work like a charm and it's exactly what I need.
Thanks you again for your help.
Regards

Statistics: Posted by moody33 — 17 Jan 2009, 00:13


]]>
2009-01-15T23:01:50+02:00 2009-01-15T23:01:50+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7158#p7158 <![CDATA[Need a script]]>

CODE:

VAR pIn, pOut, pReset &#58; tParameter;VAR tmp &#58; tMidi;VAR len, i &#58; integer;PROCEDURE Init;BEGIN   pIn &#58;= CreateParam&#40;'midi in', ptMidi&#41;; SetIsOutput&#40;pIn, FALSE&#41;;   pOut &#58;= CreateParam&#40;'array out', ptArray&#41;; SetIsInput&#40;pOut, FALSE&#41;;   pReset &#58;= CreateParam&#40;'reset to 0', ptButton&#41;; SetIsOutput&#40;pReset, FALSE&#41;;   SetLength&#40;pOut, 128&#41;;END; // Init// mainBEGIN   len &#58;= GetLength&#40;pIn&#41;;   FOR i &#58;= 0 TO &#40;len - 1&#41; DO BEGIN      GetMidiArrayValue&#40;pIn, i, tmp&#41;;      IF &#40;&#40;tmp.msg = 144&#41; AND &#40;tmp.data2 > 0&#41;&#41; THEN BEGIN // NoteOn         SetDataArrayValue&#40;pOut, tmp.data1, 1&#41;;         //writeln&#40;'NoteOn&#58;'+IntToStr&#40;tmp.data1&#41;&#41;;      END      ELSE IF &#40;   &#40;tmp.msg = 128&#41;               OR &#40;&#40;tmp.msg = 144&#41; AND &#40;tmp.data2 = 0&#41;&#41;&#41; THEN BEGIN // NoteOff         SetDataArrayValue&#40;pOut, tmp.data1, 0&#41;;         //writeln&#40;'NoteOff&#58;'+IntToStr&#40;tmp.data1&#41;&#41;;      END;   END;   IF &#40;GetValue&#40;pReset&#41; = 1&#41; THEN BEGIN      FOR i &#58;= 0 TO 127 DO BEGIN         SetDataArrayValue&#40;pOut, i, 0&#41;;      END;      SetValue&#40;pReset, 0&#41;;   END;END.

Statistics: Posted by bsork — 15 Jan 2009, 22:01


]]>
2009-01-15T14:10:29+02:00 2009-01-15T14:10:29+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7150#p7150 <![CDATA[Need a script]]> I remember a patch ( 12notes switch) but it send integer values, and I don't want 127 wire !

Here is the script ( I dont remember who is the author) . I want quite the same thing but with a single array output in place of integer values. Hope it help.

//////////////////////////
// Remaps each midi note from range 60-71 to triggers
/////////////////////////
// parameters declaration

var input : Tparameter;

var msg : Tparameter;
var data1 : Tparameter;
var data2 : Tparameter;

var trigs : array of Tparameter;

// initialisation : create parameters
procedure init;
var i : integer;
begin
Input := CreateParam('In',ptMidi);
msg := CreateParam('msg', ptdataField);
data1 := CreateParam('data1', ptdataField);
data2 := CreateParam('msg', ptdataField);

SetIsOutPut(Input,false);
SetIsInput(msg, false);
SetIsInput(data1, false);
SetIsInput(data2, false);

setarraylength(trigs,12);
for i := 0 to 11
do begin
trigs := CreateParam('trig'+inttostr(i+1), ptSwitch);
setisInput(trigs, false);
end;
end;

// Global variables

var nbOfMidi : integer;
var Miditmp : TMidi;
var i : integer;
var index : integer;

//////////////////////////////
// main proc
//////////////////////////////
begin

nbOfMidi := GetLength(input); // get the number of incoming midi codes
if nbOfMidi > 0
then begin
for i := 0 to nbOfMidi - 1 do begin
GetMidiArrayValue(input, i, Miditmp);
setValue(msg,MidiTmp.msg);
setValue(data1,MidiTmp.data1);
setValue(data2,MidiTmp.data2);

if ((MidiTmp.msg = 144) or (MidiTmp.msg = 128))
and (MidiTmp.data1 >= 60) and (MidiTmp.data1 <= 71)
then begin
index := MidiTmp.data1 - 60;
if (MidiTmp.msg = 128)
or((MidiTmp.data2 = 0) and (MidiTmp.msg = 144))
then // NoteOff
SetValue(trigs[index], 0)
else
SetValue(trigs[index], 1);
end;
end;
end;
end.

--------------------------------------------------------------------------------

Statistics: Posted by moody33 — 15 Jan 2009, 13:10


]]>
2009-01-15T14:05:22+02:00 2009-01-15T14:05:22+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7149#p7149 <![CDATA[Need a script]]>
Midi data input flow: Midi note On and Note Off only .
Array ouput format? Don't sure to understand. I need a 127 size array ( corresponding to the 127 note range in midi flow. )
When a Note On ( number 32 for example) is detect, the number off the note activate the corresponding array position (32 here) and set it to 1.
when a Note Off is detect, (32 again), the corresponding array position is set to 0 . 0 is the defaut value for the array.

do you understand what I mean?

Statistics: Posted by moody33 — 15 Jan 2009, 13:05


]]>
2009-01-15T13:59:24+02:00 2009-01-15T13:59:24+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7148#p7148 <![CDATA[Need a script]]>
This could however be done with patching of not too many modules, using SetArrayElement with index=NoteNumber and a bit checking for values (remember that a NoteOn with velocity = 0 is a NoteOff...).

Can't help anything more right now, so if you haven't found out how to patch it and noone else has done it in the meantime, I can create something for you before the weekend.

Statistics: Posted by bsork — 15 Jan 2009, 12:59


]]>
2009-01-15T13:49:26+02:00 2009-01-15T13:49:26+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7147#p7147 <![CDATA[Need a script]]> as amiga909 ask , can you be more precise about your needs.....?

Statistics: Posted by nay-seven — 15 Jan 2009, 12:49


]]>
2009-01-15T13:33:11+02:00 2009-01-15T13:33:11+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7146#p7146 <![CDATA[Need a script]]>
Re: Need a script

for what do u need this?


what kind of midi data do you put in there?

what kind of array data do you need (eg. format, precision)?

Statistics: Posted by amiga909 — 15 Jan 2009, 12:33


]]>
2009-01-15T13:06:13+02:00 2009-01-15T13:06:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=1302&p=7142#p7142 <![CDATA[Need a script]]>
As I don't understand scripts , I ask you for help !

I need a simple script like this:

One Midi input. Range 0-127
One Array output. Range 0-127 (or user defined?)

Each time a note number is triggered, array output is set to 1 until received a note off ( 0 )
For example, if Note number 64 is pressed, then array position "64" is set to 1 .
Of course, I need a polyphonic script, so if I pressed note number 64 and note number 72, array position 64 and 72 would be set to 1, and the other to 0.

Thansk in advance for those who can help me.

And why not, another script that make the inverse? array trigger midi notes?

Statistics: Posted by moody33 — 15 Jan 2009, 12:06


]]>